File size: 4,621 Bytes
b90d9df
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e86549f
9a45c2e
 
 
2137b63
9a45c2e
 
 
 
e86549f
9a45c2e
 
 
2137b63
9a45c2e
 
 
 
193e6b8
9a45c2e
 
 
2137b63
9a45c2e
4e93b4e
b30eb75
2137b63
9a45c2e
4e93b4e
b30eb75
1ae8590
9a45c2e
 
e86549f
b90d9df
 
 
 
487cc43
9a45c2e
 
 
 
 
 
 
 
 
 
 
 
b90d9df
 
 
 
4f1a86d
b90d9df
 
 
ea11515
 
b90d9df
 
 
 
 
 
 
 
 
9a45c2e
ea11515
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9a45c2e
ea11515
 
93a7062
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ea11515
93a7062
 
 
 
 
ea11515
93a7062
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
---
language:
- en
multilinguality:
- monolingual
size_categories:
- <1K
task_categories:
- feature-extraction
- sentence-similarity
pretty_name: ms-marco-mini
tags:
- sentence-transformers
- colbert
- lightonai
dataset_info:
- config_name: triplet
  features:
  - name: query
    dtype: string
  - name: positive
    dtype: string
  - name: negative
    dtype: string
  splits:
  - name: train
    num_examples: 30
- config_name: queries
  features:
  - name: query_id
    dtype: string
  - name: text
    dtype: string
  splits:
  - name: train
    num_examples: 19
- config_name: documents
  features:
  - name: document_id
    dtype: string
  - name: text
    dtype: string
  splits:
  - name: train
    num_examples: 32
- config_name: train
  features:
  - name: query_id
    dtype: string
  - name: document_ids
    sequence:
      value:
        dtype: string
  - name: scores
    sequence:
      value:
        dtype: float16
  splits:
  - name: train
    num_examples: 19
configs:
- config_name: triplet
  data_files:
  - split: train
    path: triplet.parquet
- config_name: queries
  data_files:
  - split: train
    path: queries.parquet
- config_name: documents
  data_files:
  - split: train
    path: documents.parquet
- config_name: train
  data_files:
  - split: train
    path: train.parquet
---

# ms-marco-mini

This dataset gathers very few samples from [MS MARCO](https://microsoft.github.io/msmarco/) to provide an example of triplet-based / knowledge distillation dataset formatting.

#### `triplet` subset

The `triplet` file is all we need to fine-tune a model based on contrastive loss.

* Columns: "query", "positive", "negative"
* Column types: `str`, `str`, `str`
* Examples:
    ```python
    {
      "query": "what are the liberal arts?",
      "positive": 'liberal arts. 1. the academic course of instruction at a college intended to provide general knowledge and comprising the arts, humanities, natural sciences, and social sciences, as opposed to professional or technical subjects.',
      "negative": 'The New York State Education Department requires 60 Liberal Arts credits in a Bachelor of Science program and 90 Liberal Arts credits in a Bachelor of Arts program. In the list of course descriptions, courses which are liberal arts for all students are identified by (Liberal Arts) after the course number.'
    }
    ```
* Datasets
   ```python
   from datasets import load_dataset

   dataset = load_dataset("lightonai/lighton-ms-marco-mini", "triplet", split="train") 
   ```

#### `knowledge distillation` subset

To fine-tune a model using knowledge distillation loss we will need three distinct file:

* Datasets
    ```python
    from datasets import load_dataset
    
    train = load_dataset(
        "lightonai/lighton-ms-marco-mini",
        "train",
        split="train",
    )
    
    queries = load_dataset(
        "lightonai/lighton-ms-marco-mini",
        "queries",
        split="train",
    )
    
    documents = load_dataset(
        "lightonai/lighton-ms-marco-mini",
        "documents",
        split="train",
    )
    ```

Where:
- `train` contains three distinct columns: `['query_id', 'document_ids', 'scores']`

```python
{
    "query_id": 54528,
    "document_ids": [
        6862419,
        335116,
        339186,
        7509316,
        7361291,
        7416534,
        5789936,
        5645247,
    ],
    "scores": [
        0.4546215673141326,
        0.6575686537173476,
        0.26825184192900203,
        0.5256195579370395,
        0.879939718687207,
        0.7894968184862693,
        0.6450100468854655,
        0.5823844608171467,
    ],
}
```

Assert that the length of document_ids is the same as scores.

- `queries` contains two distinct columns: `['query_id', 'text']`

```python
{"query_id": 749480, "text": "what is function of magnesium in human body"}
```

- `documents` contains two distinct columns: `['document_ids', 'text']`

```python
{
    "document_id": 136062,
    "text": "2. Also called tan .a fundamental trigonometric function that, in a right triangle, is expressed as the ratio of the side opposite an acute angle to the side adjacent to that angle. 3. in immediate physical contact; touching; abutting. 4. a. touching at a single point, as a tangent in relation to a curve or surface.lso called tan .a fundamental trigonometric function that, in a right triangle, is expressed as the ratio of the side opposite an acute angle to the side adjacent to that angle. 3. in immediate physical contact; touching; abutting. 4. a. touching at a single point, as a tangent in relation to a curve or surface.",
}
```