Datasets:
Tasks:
Question Answering
Modalities:
Text
Sub-tasks:
closed-domain-qa
Languages:
English
Size:
1K - 10K
ArXiv:
License:
Update files from the datasets library (from 1.16.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.16.0
qasper.py
CHANGED
@@ -18,7 +18,6 @@
|
|
18 |
|
19 |
|
20 |
import json
|
21 |
-
import os
|
22 |
|
23 |
import datasets
|
24 |
|
@@ -39,8 +38,8 @@ A dataset containing 1585 papers with 5049 information-seeking questions asked b
|
|
39 |
"""
|
40 |
|
41 |
_HOMEPAGE = "https://allenai.org/data/qasper"
|
42 |
-
|
43 |
-
|
44 |
|
45 |
_VERSION = "0.1.0"
|
46 |
|
@@ -107,24 +106,26 @@ class Qasper(datasets.GeneratorBasedBuilder):
|
|
107 |
)
|
108 |
|
109 |
def _split_generators(self, dl_manager):
|
110 |
-
|
111 |
|
112 |
return [
|
113 |
datasets.SplitGenerator(
|
114 |
name=datasets.Split.TRAIN,
|
115 |
-
gen_kwargs={"filepath":
|
116 |
),
|
117 |
datasets.SplitGenerator(
|
118 |
name=datasets.Split.VALIDATION,
|
119 |
-
gen_kwargs={"filepath":
|
120 |
),
|
121 |
]
|
122 |
|
123 |
-
def _generate_examples(self, filepath):
|
124 |
"""This function returns the examples in the raw (text) form."""
|
125 |
logger.info("generating examples from = %s", filepath)
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
|
|
|
|
|
18 |
|
19 |
|
20 |
import json
|
|
|
21 |
|
22 |
import datasets
|
23 |
|
|
|
38 |
"""
|
39 |
|
40 |
_HOMEPAGE = "https://allenai.org/data/qasper"
|
41 |
+
_URL = "https://qasper-dataset.s3-us-west-2.amazonaws.com/qasper-train-dev-v0.1.tgz"
|
42 |
+
_DATA_FILES = {"train": "qasper-train-v0.1.json", "dev": "qasper-dev-v0.1.json"}
|
43 |
|
44 |
_VERSION = "0.1.0"
|
45 |
|
|
|
106 |
)
|
107 |
|
108 |
def _split_generators(self, dl_manager):
|
109 |
+
archive = dl_manager.download(_URL)
|
110 |
|
111 |
return [
|
112 |
datasets.SplitGenerator(
|
113 |
name=datasets.Split.TRAIN,
|
114 |
+
gen_kwargs={"filepath": _DATA_FILES["train"], "files": dl_manager.iter_archive(archive)},
|
115 |
),
|
116 |
datasets.SplitGenerator(
|
117 |
name=datasets.Split.VALIDATION,
|
118 |
+
gen_kwargs={"filepath": _DATA_FILES["dev"], "files": dl_manager.iter_archive(archive)},
|
119 |
),
|
120 |
]
|
121 |
|
122 |
+
def _generate_examples(self, filepath, files):
|
123 |
"""This function returns the examples in the raw (text) form."""
|
124 |
logger.info("generating examples from = %s", filepath)
|
125 |
+
for path, f in files:
|
126 |
+
if path == filepath:
|
127 |
+
qasper = json.loads(f.read().decode("utf-8"))
|
128 |
+
for id_ in qasper:
|
129 |
+
qasper[id_]["id"] = id_
|
130 |
+
yield id_, qasper[id_]
|
131 |
+
break
|