Datasets:
Tasks:
Multiple Choice
Modalities:
Text
Formats:
parquet
Sub-tasks:
multiple-choice-qa
Languages:
English
Size:
100K - 1M
ArXiv:
License:
Update files from the datasets library (from 1.0.2)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.0.2
- dataset_infos.json +1 -1
- dummy/{0.1.0 → all/0.1.0}/dummy_data.zip +2 -2
- dummy/high/0.1.0/dummy_data.zip +3 -0
- dummy/middle/0.1.0/dummy_data.zip +3 -0
- race.py +26 -24
dataset_infos.json
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"
|
|
|
1 |
+
{"high": {"description": "Race is a large-scale reading comprehension dataset with more than 28,000 passages and nearly 100,000 questions. The\n dataset is collected from English examinations in China, which are designed for middle school and high school students.\nThe dataset can be served as the training and test sets for machine comprehension.\n\n", "citation": "@article{lai2017large,\n title={RACE: Large-scale ReAding Comprehension Dataset From Examinations},\n author={Lai, Guokun and Xie, Qizhe and Liu, Hanxiao and Yang, Yiming and Hovy, Eduard},\n journal={arXiv preprint arXiv:1704.04683},\n year={2017}\n}\n", "homepage": "http://www.cs.cmu.edu/~glai1/data/race/", "license": "", "features": {"example_id": {"dtype": "string", "id": null, "_type": "Value"}, "article": {"dtype": "string", "id": null, "_type": "Value"}, "answer": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "options": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "race", "config_name": "high", "version": {"version_str": "0.1.0", "description": null, "major": 0, "minor": 1, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 6989121, "num_examples": 3498, "dataset_name": "race"}, "train": {"name": "train", "num_bytes": 126243396, "num_examples": 62445, "dataset_name": "race"}, "validation": {"name": "validation", "num_bytes": 6885287, "num_examples": 3451, "dataset_name": "race"}}, "download_checksums": {"http://www.cs.cmu.edu/~glai1/data/race/RACE.tar.gz": {"num_bytes": 25443609, "checksum": "b2769cc9fdc5c546a693300eb9a966cec6870bd349fbc44ed5225f8ad33006e5"}}, "download_size": 25443609, "post_processing_size": null, "dataset_size": 140117804, "size_in_bytes": 165561413}, "middle": {"description": "Race is a large-scale reading comprehension dataset with more than 28,000 passages and nearly 100,000 questions. The\n dataset is collected from English examinations in China, which are designed for middle school and high school students.\nThe dataset can be served as the training and test sets for machine comprehension.\n\n", "citation": "@article{lai2017large,\n title={RACE: Large-scale ReAding Comprehension Dataset From Examinations},\n author={Lai, Guokun and Xie, Qizhe and Liu, Hanxiao and Yang, Yiming and Hovy, Eduard},\n journal={arXiv preprint arXiv:1704.04683},\n year={2017}\n}\n", "homepage": "http://www.cs.cmu.edu/~glai1/data/race/", "license": "", "features": {"example_id": {"dtype": "string", "id": null, "_type": "Value"}, "article": {"dtype": "string", "id": null, "_type": "Value"}, "answer": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "options": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "race", "config_name": "middle", "version": {"version_str": "0.1.0", "description": null, "major": 0, "minor": 1, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 1786297, "num_examples": 1436, "dataset_name": "race"}, "train": {"name": "train", "num_bytes": 31065322, "num_examples": 25421, "dataset_name": "race"}, "validation": {"name": "validation", "num_bytes": 1761937, "num_examples": 1436, "dataset_name": "race"}}, "download_checksums": {"http://www.cs.cmu.edu/~glai1/data/race/RACE.tar.gz": {"num_bytes": 25443609, "checksum": "b2769cc9fdc5c546a693300eb9a966cec6870bd349fbc44ed5225f8ad33006e5"}}, "download_size": 25443609, "post_processing_size": null, "dataset_size": 34613556, "size_in_bytes": 60057165}, "all": {"description": "Race is a large-scale reading comprehension dataset with more than 28,000 passages and nearly 100,000 questions. The\n dataset is collected from English examinations in China, which are designed for middle school and high school students.\nThe dataset can be served as the training and test sets for machine comprehension.\n\n", "citation": "@article{lai2017large,\n title={RACE: Large-scale ReAding Comprehension Dataset From Examinations},\n author={Lai, Guokun and Xie, Qizhe and Liu, Hanxiao and Yang, Yiming and Hovy, Eduard},\n journal={arXiv preprint arXiv:1704.04683},\n year={2017}\n}\n", "homepage": "http://www.cs.cmu.edu/~glai1/data/race/", "license": "", "features": {"example_id": {"dtype": "string", "id": null, "_type": "Value"}, "article": {"dtype": "string", "id": null, "_type": "Value"}, "answer": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "options": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "race", "config_name": "all", "version": {"version_str": "0.1.0", "description": null, "major": 0, "minor": 1, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 8775394, "num_examples": 4934, "dataset_name": "race"}, "train": {"name": "train", "num_bytes": 157308694, "num_examples": 87866, "dataset_name": "race"}, "validation": {"name": "validation", "num_bytes": 8647200, "num_examples": 4887, "dataset_name": "race"}}, "download_checksums": {"http://www.cs.cmu.edu/~glai1/data/race/RACE.tar.gz": {"num_bytes": 25443609, "checksum": "b2769cc9fdc5c546a693300eb9a966cec6870bd349fbc44ed5225f8ad33006e5"}}, "download_size": 25443609, "post_processing_size": null, "dataset_size": 174731288, "size_in_bytes": 200174897}}
|
dummy/{0.1.0 → all/0.1.0}/dummy_data.zip
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:86b18d4638b1557a5c2360e62cd07877c0475324c6ff47403c8c768ed63afe66
|
3 |
+
size 25917
|
dummy/high/0.1.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4b10107665a293521ceebd7354c8d77e5cd3bb16305c26f16d73630b2844eae9
|
3 |
+
size 13484
|
dummy/middle/0.1.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:88b445588ec0540d6b11d9f0e82773dc48e91562faa64b91f1d7ec5f4a562ca1
|
3 |
+
size 16125
|
race.py
CHANGED
@@ -4,11 +4,11 @@ from __future__ import absolute_import, division, print_function
|
|
4 |
|
5 |
import json
|
6 |
import os
|
|
|
7 |
|
8 |
import datasets
|
9 |
|
10 |
|
11 |
-
# TODO(race): BibTeX citation
|
12 |
_CITATION = """\
|
13 |
@article{lai2017large,
|
14 |
title={RACE: Large-scale ReAding Comprehension Dataset From Examinations},
|
@@ -18,7 +18,6 @@ _CITATION = """\
|
|
18 |
}
|
19 |
"""
|
20 |
|
21 |
-
# TODO(race):
|
22 |
_DESCRIPTION = """\
|
23 |
Race is a large-scale reading comprehension dataset with more than 28,000 passages and nearly 100,000 questions. The
|
24 |
dataset is collected from English examinations in China, which are designed for middle school and high school students.
|
@@ -30,19 +29,28 @@ _URL = "http://www.cs.cmu.edu/~glai1/data/race/RACE.tar.gz"
|
|
30 |
|
31 |
|
32 |
class Race(datasets.GeneratorBasedBuilder):
|
33 |
-
"""
|
34 |
|
35 |
-
# TODO(race): Set up version.
|
36 |
VERSION = datasets.Version("0.1.0")
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
def _info(self):
|
39 |
-
# TODO(race): Specifies the datasets.DatasetInfo object
|
40 |
return datasets.DatasetInfo(
|
41 |
# This is the description that will appear on the datasets page.
|
42 |
description=_DESCRIPTION,
|
43 |
# datasets.features.FeatureConnectors
|
44 |
features=datasets.Features(
|
45 |
{
|
|
|
46 |
"article": datasets.Value("string"),
|
47 |
"answer": datasets.Value("string"),
|
48 |
"question": datasets.Value("string"),
|
@@ -61,43 +69,36 @@ class Race(datasets.GeneratorBasedBuilder):
|
|
61 |
|
62 |
def _split_generators(self, dl_manager):
|
63 |
"""Returns SplitGenerators."""
|
64 |
-
#
|
65 |
# dl_manager is a datasets.download.DownloadManager that can be used to
|
66 |
-
# download and extract URLs
|
67 |
dl_dir = dl_manager.download_and_extract(_URL)
|
|
|
|
|
|
|
68 |
return [
|
69 |
datasets.SplitGenerator(
|
70 |
name=datasets.Split.TEST,
|
71 |
# These kwargs will be passed to _generate_examples
|
72 |
-
gen_kwargs={
|
73 |
-
"files": sorted(os.listdir(os.path.join(dl_dir, "RACE/test/high"))),
|
74 |
-
"filespath": os.path.join(dl_dir, "RACE/test/high"),
|
75 |
-
},
|
76 |
),
|
77 |
datasets.SplitGenerator(
|
78 |
name=datasets.Split.TRAIN,
|
79 |
# These kwargs will be passed to _generate_examples
|
80 |
-
gen_kwargs={
|
81 |
-
"files": sorted(os.listdir(os.path.join(dl_dir, "RACE/train/high"))),
|
82 |
-
"filespath": os.path.join(dl_dir, "RACE/train/high"),
|
83 |
-
},
|
84 |
),
|
85 |
datasets.SplitGenerator(
|
86 |
name=datasets.Split.VALIDATION,
|
87 |
# These kwargs will be passed to _generate_examples
|
88 |
-
gen_kwargs={
|
89 |
-
"files": sorted(os.listdir(os.path.join(dl_dir, "RACE/dev/high"))),
|
90 |
-
"filespath": os.path.join(dl_dir, "RACE/dev/high"),
|
91 |
-
},
|
92 |
),
|
93 |
]
|
94 |
|
95 |
-
def _generate_examples(self,
|
96 |
"""Yields examples."""
|
97 |
-
|
98 |
-
for
|
99 |
-
|
100 |
-
with open(
|
101 |
data = json.load(f)
|
102 |
questions = data["questions"]
|
103 |
answers = data["answers"]
|
@@ -107,6 +108,7 @@ class Race(datasets.GeneratorBasedBuilder):
|
|
107 |
answer = answers[i]
|
108 |
option = options[i]
|
109 |
yield i, {
|
|
|
110 |
"article": data["article"],
|
111 |
"question": question,
|
112 |
"answer": answer,
|
|
|
4 |
|
5 |
import json
|
6 |
import os
|
7 |
+
from pathlib import Path
|
8 |
|
9 |
import datasets
|
10 |
|
11 |
|
|
|
12 |
_CITATION = """\
|
13 |
@article{lai2017large,
|
14 |
title={RACE: Large-scale ReAding Comprehension Dataset From Examinations},
|
|
|
18 |
}
|
19 |
"""
|
20 |
|
|
|
21 |
_DESCRIPTION = """\
|
22 |
Race is a large-scale reading comprehension dataset with more than 28,000 passages and nearly 100,000 questions. The
|
23 |
dataset is collected from English examinations in China, which are designed for middle school and high school students.
|
|
|
29 |
|
30 |
|
31 |
class Race(datasets.GeneratorBasedBuilder):
|
32 |
+
"""ReAding Comprehension Dataset From Examination dataset from CMU"""
|
33 |
|
|
|
34 |
VERSION = datasets.Version("0.1.0")
|
35 |
|
36 |
+
BUILDER_CONFIGS = [
|
37 |
+
datasets.BuilderConfig(name="high", description="Exams designed for high school students", version=VERSION),
|
38 |
+
datasets.BuilderConfig(
|
39 |
+
name="middle", description="Exams designed for middle school students", version=VERSION
|
40 |
+
),
|
41 |
+
datasets.BuilderConfig(
|
42 |
+
name="all", description="Exams designed for both high school and middle school students", version=VERSION
|
43 |
+
),
|
44 |
+
]
|
45 |
+
|
46 |
def _info(self):
|
|
|
47 |
return datasets.DatasetInfo(
|
48 |
# This is the description that will appear on the datasets page.
|
49 |
description=_DESCRIPTION,
|
50 |
# datasets.features.FeatureConnectors
|
51 |
features=datasets.Features(
|
52 |
{
|
53 |
+
"example_id": datasets.Value("string"),
|
54 |
"article": datasets.Value("string"),
|
55 |
"answer": datasets.Value("string"),
|
56 |
"question": datasets.Value("string"),
|
|
|
69 |
|
70 |
def _split_generators(self, dl_manager):
|
71 |
"""Returns SplitGenerators."""
|
72 |
+
# Downloads the data and defines the splits
|
73 |
# dl_manager is a datasets.download.DownloadManager that can be used to
|
|
|
74 |
dl_dir = dl_manager.download_and_extract(_URL)
|
75 |
+
case = str(self.config.name)
|
76 |
+
if case == "all":
|
77 |
+
case = ""
|
78 |
return [
|
79 |
datasets.SplitGenerator(
|
80 |
name=datasets.Split.TEST,
|
81 |
# These kwargs will be passed to _generate_examples
|
82 |
+
gen_kwargs={"train_test_or_eval": os.path.join(dl_dir, f"RACE/test/{case}")},
|
|
|
|
|
|
|
83 |
),
|
84 |
datasets.SplitGenerator(
|
85 |
name=datasets.Split.TRAIN,
|
86 |
# These kwargs will be passed to _generate_examples
|
87 |
+
gen_kwargs={"train_test_or_eval": os.path.join(dl_dir, f"RACE/train/{case}")},
|
|
|
|
|
|
|
88 |
),
|
89 |
datasets.SplitGenerator(
|
90 |
name=datasets.Split.VALIDATION,
|
91 |
# These kwargs will be passed to _generate_examples
|
92 |
+
gen_kwargs={"train_test_or_eval": os.path.join(dl_dir, f"RACE/dev/{case}")},
|
|
|
|
|
|
|
93 |
),
|
94 |
]
|
95 |
|
96 |
+
def _generate_examples(self, train_test_or_eval):
|
97 |
"""Yields examples."""
|
98 |
+
current_path = Path(train_test_or_eval)
|
99 |
+
files_in_dir = [str(f.absolute()) for f in sorted(current_path.glob("**/*.txt"))]
|
100 |
+
for file in sorted(files_in_dir):
|
101 |
+
with open(file, encoding="utf-8") as f:
|
102 |
data = json.load(f)
|
103 |
questions = data["questions"]
|
104 |
answers = data["answers"]
|
|
|
108 |
answer = answers[i]
|
109 |
option = options[i]
|
110 |
yield i, {
|
111 |
+
"example_id": data["id"],
|
112 |
"article": data["article"],
|
113 |
"question": question,
|
114 |
"answer": answer,
|