Datasets:
Tasks:
Question Answering
Formats:
parquet
Sub-tasks:
open-domain-qa
Languages:
English
Size:
10K - 100K
License:
Commit
•
f73fd1a
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/additional/1.0.0/dummy_data.zip +3 -0
- dummy/main/1.0.0/dummy_data.zip +3 -0
- openbookqa.py +165 -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 |
+
{"main": {"description": "OpenBookQA aims to promote research in advanced question-answering, probing a deeper understanding of both the topic \n(with salient facts summarized as an open book, also provided with the dataset) and the language it is expressed in. In \nparticular, it contains questions that require multi-step reasoning, use of additional common and commonsense knowledge, \nand rich text comprehension.\nOpenBookQA is a new kind of question-answering dataset modeled after open book exams for assessing human understanding of\na subject. \n", "citation": "@inproceedings{OpenBookQA2018,\n title={Can a Suit of Armor Conduct Electricity? A New Dataset for Open Book Question Answering},\n author={Todor Mihaylov and Peter Clark and Tushar Khot and Ashish Sabharwal},\n booktitle={EMNLP},\n year={2018}\n}\n", "homepage": "https://allenai.org/data/open-book-qa", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "question_stem": {"dtype": "string", "id": null, "_type": "Value"}, "choices": {"feature": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"dtype": "string", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}, "answerKey": {"dtype": "string", "id": null, "_type": "Value"}}, "supervised_keys": null, "builder_name": "openbookqa", "config_name": "main", "version": {"version_str": "1.0.0", "description": "", "datasets_version_to_prepare": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 124295, "num_examples": 500, "dataset_name": "openbookqa"}, "train": {"name": "train", "num_bytes": 1186990, "num_examples": 4957, "dataset_name": "openbookqa"}, "validation": {"name": "validation", "num_bytes": 131304, "num_examples": 500, "dataset_name": "openbookqa"}}, "download_checksums": {"https://s3-us-west-2.amazonaws.com/ai2-website/data/OpenBookQA-V1-Sep2018.zip": {"num_bytes": 1446098, "checksum": "82368cf05df2e3b309c17d162e10b888b4d768fad6e171e0a041954c8553be46"}}, "download_size": 1446098, "dataset_size": 1442589, "size_in_bytes": 2888687}, "additional": {"description": "OpenBookQA aims to promote research in advanced question-answering, probing a deeper understanding of both the topic \n(with salient facts summarized as an open book, also provided with the dataset) and the language it is expressed in. In \nparticular, it contains questions that require multi-step reasoning, use of additional common and commonsense knowledge, \nand rich text comprehension.\nOpenBookQA is a new kind of question-answering dataset modeled after open book exams for assessing human understanding of\na subject. \n", "citation": "@inproceedings{OpenBookQA2018,\n title={Can a Suit of Armor Conduct Electricity? A New Dataset for Open Book Question Answering},\n author={Todor Mihaylov and Peter Clark and Tushar Khot and Ashish Sabharwal},\n booktitle={EMNLP},\n year={2018}\n}\n", "homepage": "https://allenai.org/data/open-book-qa", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "question_stem": {"dtype": "string", "id": null, "_type": "Value"}, "choices": {"feature": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"dtype": "string", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}, "answerKey": {"dtype": "string", "id": null, "_type": "Value"}}, "supervised_keys": null, "builder_name": "openbookqa", "config_name": "additional", "version": {"version_str": "1.0.0", "description": "", "datasets_version_to_prepare": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 124295, "num_examples": 500, "dataset_name": "openbookqa"}, "train": {"name": "train", "num_bytes": 1186990, "num_examples": 4957, "dataset_name": "openbookqa"}, "validation": {"name": "validation", "num_bytes": 131304, "num_examples": 500, "dataset_name": "openbookqa"}}, "download_checksums": {"https://s3-us-west-2.amazonaws.com/ai2-website/data/OpenBookQA-V1-Sep2018.zip": {"num_bytes": 1446098, "checksum": "82368cf05df2e3b309c17d162e10b888b4d768fad6e171e0a041954c8553be46"}}, "download_size": 1446098, "dataset_size": 1442589, "size_in_bytes": 2888687}}
|
dummy/additional/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6df295e28a58f16936961c4602310580a1583cf4cffd19f71c6b4b01c1352a67
|
3 |
+
size 2748
|
dummy/main/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f9d70bb37f78dd357b55d4b3b5e7a06fac382b793ab10a1cc006178a6bf7e863
|
3 |
+
size 2568
|
openbookqa.py
ADDED
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""TODO(openBookQA): Add a description here."""
|
2 |
+
|
3 |
+
from __future__ import absolute_import, division, print_function
|
4 |
+
|
5 |
+
import json
|
6 |
+
import os
|
7 |
+
import textwrap
|
8 |
+
|
9 |
+
import datasets
|
10 |
+
|
11 |
+
|
12 |
+
# TODO(openBookQA): BibTeX citation
|
13 |
+
_CITATION = """\
|
14 |
+
@inproceedings{OpenBookQA2018,
|
15 |
+
title={Can a Suit of Armor Conduct Electricity? A New Dataset for Open Book Question Answering},
|
16 |
+
author={Todor Mihaylov and Peter Clark and Tushar Khot and Ashish Sabharwal},
|
17 |
+
booktitle={EMNLP},
|
18 |
+
year={2018}
|
19 |
+
}
|
20 |
+
"""
|
21 |
+
|
22 |
+
# TODO(openBookQA):
|
23 |
+
_DESCRIPTION = textwrap.dedent(
|
24 |
+
"""\
|
25 |
+
OpenBookQA aims to promote research in advanced question-answering, probing a deeper understanding of both the topic
|
26 |
+
(with salient facts summarized as an open book, also provided with the dataset) and the language it is expressed in. In
|
27 |
+
particular, it contains questions that require multi-step reasoning, use of additional common and commonsense knowledge,
|
28 |
+
and rich text comprehension.
|
29 |
+
OpenBookQA is a new kind of question-answering dataset modeled after open book exams for assessing human understanding of
|
30 |
+
a subject.
|
31 |
+
"""
|
32 |
+
)
|
33 |
+
_URL = "https://s3-us-west-2.amazonaws.com/ai2-website/data/OpenBookQA-V1-Sep2018.zip"
|
34 |
+
|
35 |
+
|
36 |
+
class OpenbookqaConfig(datasets.BuilderConfig):
|
37 |
+
def __init__(self, data_dir, **kwargs):
|
38 |
+
"""BuilderConfig for openBookQA dataset
|
39 |
+
|
40 |
+
Args:
|
41 |
+
data_dir: directory for the given dataset name
|
42 |
+
**kwargs: keyword arguments forwarded to super.
|
43 |
+
|
44 |
+
"""
|
45 |
+
|
46 |
+
super(OpenbookqaConfig, self).__init__(version=datasets.Version("1.0.0", ""), **kwargs)
|
47 |
+
|
48 |
+
self.data_dir = data_dir
|
49 |
+
|
50 |
+
|
51 |
+
class Openbookqa(datasets.GeneratorBasedBuilder):
|
52 |
+
"""TODO(openBookQA): Short description of my dataset."""
|
53 |
+
|
54 |
+
# TODO(openBookQA): Set up version.
|
55 |
+
VERSION = datasets.Version("0.1.0")
|
56 |
+
BUILDER_CONFIGS = [
|
57 |
+
OpenbookqaConfig(
|
58 |
+
name="main",
|
59 |
+
description=textwrap.dedent(
|
60 |
+
"""
|
61 |
+
It consists of 5,957 multiple-choice elementary-level science questions (4,957 train, 500 dev, 500 test),
|
62 |
+
which probe the understanding of a small “book” of 1,326 core science facts and the application of these facts to novel
|
63 |
+
situations. For training, the dataset includes a mapping from each question to the core science fact it was designed to
|
64 |
+
probe. Answering OpenBookQA questions requires additional broad common knowledge, not contained in the book. The questions,
|
65 |
+
by design, are answered incorrectly by both a retrieval-based algorithm and a word co-occurrence algorithm. Strong neural
|
66 |
+
baselines achieve around 50% on OpenBookQA, leaving a large gap to the 92% accuracy of crowd-workers.
|
67 |
+
"""
|
68 |
+
),
|
69 |
+
data_dir="Main",
|
70 |
+
),
|
71 |
+
OpenbookqaConfig(
|
72 |
+
name="additional",
|
73 |
+
description=textwrap.dedent(
|
74 |
+
"""
|
75 |
+
Additionally, we provide 5,167 crowd-sourced common knowledge facts, and an expanded version of the train/dev/test questions where
|
76 |
+
each question is associated with its originating core fact, a human accuracy score, a clarity score, and an anonymized crowd-worker
|
77 |
+
ID (in the “Additional” folder).
|
78 |
+
"""
|
79 |
+
),
|
80 |
+
data_dir="Additional",
|
81 |
+
),
|
82 |
+
]
|
83 |
+
|
84 |
+
def _info(self):
|
85 |
+
# TODO(openBookQA): Specifies the datasets.DatasetInfo object
|
86 |
+
return datasets.DatasetInfo(
|
87 |
+
# This is the description that will appear on the datasets page.
|
88 |
+
description=_DESCRIPTION,
|
89 |
+
# datasets.features.FeatureConnectors
|
90 |
+
features=datasets.Features(
|
91 |
+
{
|
92 |
+
# These are the features of your dataset like images, labels ...
|
93 |
+
"id": datasets.Value("string"),
|
94 |
+
"question_stem": datasets.Value("string"),
|
95 |
+
"choices": datasets.features.Sequence(
|
96 |
+
{"text": datasets.Value("string"), "label": datasets.Value("string")}
|
97 |
+
),
|
98 |
+
"answerKey": datasets.Value("string"),
|
99 |
+
}
|
100 |
+
),
|
101 |
+
# If there's a common (input, target) tuple from the features,
|
102 |
+
# specify them here. They'll be used if as_supervised=True in
|
103 |
+
# builder.as_dataset.
|
104 |
+
supervised_keys=None,
|
105 |
+
# Homepage of the dataset for documentation
|
106 |
+
homepage="https://allenai.org/data/open-book-qa",
|
107 |
+
citation=_CITATION,
|
108 |
+
)
|
109 |
+
|
110 |
+
def _split_generators(self, dl_manager):
|
111 |
+
"""Returns SplitGenerators."""
|
112 |
+
# TODO(openBookQA): Downloads the data and defines the splits
|
113 |
+
# dl_manager is a datasets.download.DownloadManager that can be used to
|
114 |
+
# download and extract URLs
|
115 |
+
dl_dir = dl_manager.download_and_extract(_URL)
|
116 |
+
data_dir = os.path.join(dl_dir, "OpenBookQA-V1-Sep2018", "Data")
|
117 |
+
data_dir = os.path.join(data_dir, self.config.data_dir)
|
118 |
+
train_file = (
|
119 |
+
os.path.join(data_dir, "train.jsonl")
|
120 |
+
if self.config.name == "main"
|
121 |
+
else os.path.join(data_dir, "train_complete.jsonl")
|
122 |
+
)
|
123 |
+
test_file = (
|
124 |
+
os.path.join(data_dir, "test.jsonl")
|
125 |
+
if self.config.name == "main"
|
126 |
+
else os.path.join(data_dir, "test_complete.jsonl")
|
127 |
+
)
|
128 |
+
dev_file = (
|
129 |
+
os.path.join(data_dir, "dev.jsonl")
|
130 |
+
if self.config.name == "main"
|
131 |
+
else os.path.join(data_dir, "dev_complete.jsonl")
|
132 |
+
)
|
133 |
+
return [
|
134 |
+
datasets.SplitGenerator(
|
135 |
+
name=datasets.Split.TRAIN,
|
136 |
+
# These kwargs will be passed to _generate_examples
|
137 |
+
gen_kwargs={"filepath": train_file},
|
138 |
+
),
|
139 |
+
datasets.SplitGenerator(
|
140 |
+
name=datasets.Split.TEST,
|
141 |
+
# These kwargs will be passed to _generate_examples
|
142 |
+
gen_kwargs={"filepath": test_file},
|
143 |
+
),
|
144 |
+
datasets.SplitGenerator(
|
145 |
+
name=datasets.Split.VALIDATION,
|
146 |
+
# These kwargs will be passed to _generate_examples
|
147 |
+
gen_kwargs={"filepath": dev_file},
|
148 |
+
),
|
149 |
+
]
|
150 |
+
|
151 |
+
def _generate_examples(self, filepath):
|
152 |
+
"""Yields examples."""
|
153 |
+
# TODO(openBookQA): Yields (key, example) tuples from the dataset
|
154 |
+
with open(filepath, encoding="utf-8") as f:
|
155 |
+
for row in f:
|
156 |
+
data = json.loads(row)
|
157 |
+
yield data["id"], {
|
158 |
+
"id": data["id"],
|
159 |
+
"question_stem": data["question"]["stem"],
|
160 |
+
"choices": {
|
161 |
+
"text": [choice["text"] for choice in data["question"]["choices"]],
|
162 |
+
"label": [choice["text"] for choice in data["question"]["choices"]],
|
163 |
+
},
|
164 |
+
"answerKey": data["answerKey"],
|
165 |
+
}
|