update card for sequence
Browse files- README.md +2 -2
- convert.py +5 -1
- use.py +19 -2
README.md
CHANGED
|
@@ -17,13 +17,13 @@ dataset_info:
|
|
| 17 |
- name: query
|
| 18 |
dtype: string
|
| 19 |
- name: pos
|
| 20 |
-
|
| 21 |
- name: doc
|
| 22 |
dtype: string
|
| 23 |
- name: score
|
| 24 |
dtype: float
|
| 25 |
- name: neg
|
| 26 |
-
|
| 27 |
- name: doc
|
| 28 |
dtype: string
|
| 29 |
- name: score
|
|
|
|
| 17 |
- name: query
|
| 18 |
dtype: string
|
| 19 |
- name: pos
|
| 20 |
+
list:
|
| 21 |
- name: doc
|
| 22 |
dtype: string
|
| 23 |
- name: score
|
| 24 |
dtype: float
|
| 25 |
- name: neg
|
| 26 |
+
list:
|
| 27 |
- name: doc
|
| 28 |
dtype: string
|
| 29 |
- name: score
|
convert.py
CHANGED
|
@@ -67,7 +67,11 @@ def process(
|
|
| 67 |
for rel in rels
|
| 68 |
if rel.doc < len(corpus) and rel.score == 0 and corpus[rel.doc] != ""
|
| 69 |
]
|
| 70 |
-
group = {"query": queries[query], "pos": pos
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
result.append(group)
|
| 72 |
return result
|
| 73 |
|
|
|
|
| 67 |
for rel in rels
|
| 68 |
if rel.doc < len(corpus) and rel.score == 0 and corpus[rel.doc] != ""
|
| 69 |
]
|
| 70 |
+
group = {"query": queries[query], "pos": pos}
|
| 71 |
+
if len(neg) == 0:
|
| 72 |
+
group["neg"] = None
|
| 73 |
+
else:
|
| 74 |
+
group["neg"] = neg
|
| 75 |
result.append(group)
|
| 76 |
return result
|
| 77 |
|
use.py
CHANGED
|
@@ -1,3 +1,20 @@
|
|
| 1 |
-
from datasets import load_dataset
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from datasets import load_dataset, Features, Value, Sequence
|
| 2 |
|
| 3 |
+
|
| 4 |
+
# data = load_dataset("ms_marco", )
|
| 5 |
+
|
| 6 |
+
data = load_dataset(
|
| 7 |
+
"json",
|
| 8 |
+
data_files={
|
| 9 |
+
"train": "/home/shutty/data/nixiesearch-datasets/msmarco/train.jsonl",
|
| 10 |
+
"test": "/home/shutty/data/nixiesearch-datasets/msmarco/test.jsonl",
|
| 11 |
+
},
|
| 12 |
+
features=Features(
|
| 13 |
+
{
|
| 14 |
+
"query": Value("string"),
|
| 15 |
+
"pos": [{"doc": Value("string"), "score": Value("int32")}],
|
| 16 |
+
"neg": [{"doc": Value("string"), "score": Value("int32")}],
|
| 17 |
+
}
|
| 18 |
+
),
|
| 19 |
+
)
|
| 20 |
+
print(data["test"].features)
|