Datasets:
Tasks:
Multiple Choice
Modalities:
Text
Formats:
parquet
Sub-tasks:
multiple-choice-qa
Languages:
English
Size:
100K - 1M
ArXiv:
License:
Commit
•
a499813
0
Parent(s):
Update files from the datasets library (from 1.0.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.0.0
- .gitattributes +27 -0
- dataset_infos.json +1 -0
- dummy/0.1.0/dummy_data.zip +3 -0
- race.py +114 -0
.gitattributes
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
20 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
26 |
+
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"default": {"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": {"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"}}, "supervised_keys": null, "builder_name": "race", "config_name": "default", "version": {"version_str": "0.1.0", "description": null, "datasets_version_to_prepare": null, "major": 0, "minor": 1, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 6935145, "num_examples": 3498, "dataset_name": "race"}, "train": {"name": "train", "num_bytes": 125280697, "num_examples": 62445, "dataset_name": "race"}, "validation": {"name": "validation", "num_bytes": 6832070, "num_examples": 3451, "dataset_name": "race"}}, "download_checksums": {"http://www.cs.cmu.edu/~glai1/data/race/RACE.tar.gz": {"num_bytes": 88627200, "checksum": "98b54b7e656bc9e2e434f99f07863a83f89647a1f4c9428a041c3a4c51db6787"}}, "download_size": 88627200, "dataset_size": 139047912, "size_in_bytes": 227675112}}
|
dummy/0.1.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3f23aa67f2655e2757852e90787c98e91bd88dfa8f0663bfe275129a437755a4
|
3 |
+
size 10762
|
race.py
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""TODO(race): Add a description here."""
|
2 |
+
|
3 |
+
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},
|
15 |
+
author={Lai, Guokun and Xie, Qizhe and Liu, Hanxiao and Yang, Yiming and Hovy, Eduard},
|
16 |
+
journal={arXiv preprint arXiv:1704.04683},
|
17 |
+
year={2017}
|
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.
|
25 |
+
The dataset can be served as the training and test sets for machine comprehension.
|
26 |
+
|
27 |
+
"""
|
28 |
+
|
29 |
+
_URL = "http://www.cs.cmu.edu/~glai1/data/race/RACE.tar.gz"
|
30 |
+
|
31 |
+
|
32 |
+
class Race(datasets.GeneratorBasedBuilder):
|
33 |
+
"""TODO(race): Short description of my dataset."""
|
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"),
|
49 |
+
"options": datasets.features.Sequence(datasets.Value("string"))
|
50 |
+
# These are the features of your dataset like images, labels ...
|
51 |
+
}
|
52 |
+
),
|
53 |
+
# If there's a common (input, target) tuple from the features,
|
54 |
+
# specify them here. They'll be used if as_supervised=True in
|
55 |
+
# builder.as_dataset.
|
56 |
+
supervised_keys=None,
|
57 |
+
# Homepage of the dataset for documentation
|
58 |
+
homepage="http://www.cs.cmu.edu/~glai1/data/race/",
|
59 |
+
citation=_CITATION,
|
60 |
+
)
|
61 |
+
|
62 |
+
def _split_generators(self, dl_manager):
|
63 |
+
"""Returns SplitGenerators."""
|
64 |
+
# TODO(race): Downloads the data and defines the splits
|
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, files, filespath):
|
96 |
+
"""Yields examples."""
|
97 |
+
# TODO(race): Yields (key, example) tuples from the dataset
|
98 |
+
for file in files:
|
99 |
+
filepath = os.path.join(filespath, file)
|
100 |
+
with open(filepath, encoding="utf-8") as f:
|
101 |
+
data = json.load(f)
|
102 |
+
questions = data["questions"]
|
103 |
+
answers = data["answers"]
|
104 |
+
options = data["options"]
|
105 |
+
for i in range(len(questions)):
|
106 |
+
question = questions[i]
|
107 |
+
answer = answers[i]
|
108 |
+
option = options[i]
|
109 |
+
yield i, {
|
110 |
+
"article": data["article"],
|
111 |
+
"question": question,
|
112 |
+
"answer": answer,
|
113 |
+
"options": option,
|
114 |
+
}
|