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sourced
|
4 |
+
language_creators:
|
5 |
+
- found
|
6 |
+
languages:
|
7 |
+
- en
|
8 |
+
licenses:
|
9 |
+
- cc-by-sa-4.0
|
10 |
+
multilinguality:
|
11 |
+
- monolingual
|
12 |
+
size_categories:
|
13 |
+
- 10K<n<100K
|
14 |
+
source_datasets:
|
15 |
+
- original
|
16 |
+
task_categories:
|
17 |
+
- question-answering
|
18 |
+
task_ids:
|
19 |
+
- extractive-qa
|
20 |
+
- open-domain-qa
|
21 |
+
---
|
22 |
+
|
23 |
+
# Dataset Card for Dynabench.QA
|
24 |
+
|
25 |
+
## Table of Contents
|
26 |
+
- [Dataset Description](#dataset-description)
|
27 |
+
- [Dataset Summary](#dataset-summary)
|
28 |
+
- [Supported Tasks](#supported-tasks-and-leaderboards)
|
29 |
+
- [Languages](#languages)
|
30 |
+
- [Dataset Structure](#dataset-structure)
|
31 |
+
- [Data Instances](#data-instances)
|
32 |
+
- [Data Fields](#data-instances)
|
33 |
+
- [Data Splits](#data-instances)
|
34 |
+
- [Dataset Creation](#dataset-creation)
|
35 |
+
- [Curation Rationale](#curation-rationale)
|
36 |
+
- [Source Data](#source-data)
|
37 |
+
- [Annotations](#annotations)
|
38 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
39 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
40 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
41 |
+
- [Discussion of Biases](#discussion-of-biases)
|
42 |
+
- [Other Known Limitations](#other-known-limitations)
|
43 |
+
- [Additional Information](#additional-information)
|
44 |
+
- [Dataset Curators](#dataset-curators)
|
45 |
+
- [Licensing Information](#licensing-information)
|
46 |
+
- [Citation Information](#citation-information)
|
47 |
+
- [Contributions](#contributions)
|
48 |
+
|
49 |
+
## Dataset Description
|
50 |
+
|
51 |
+
- **Homepage:** [Dynabench.QA](https://dynabench.org/tasks/2#overall)
|
52 |
+
- **Paper:** [Beat the AI: Investigating Adversarial Human Annotation for Reading Comprehension](https://arxiv.org/abs/2002.00293)
|
53 |
+
- **Leaderboard:** [Dynabench QA Round 1 Leaderboard](https://dynabench.org/tasks/2#overall)
|
54 |
+
- **Point of Contact:** [Max Bartolo](max.bartolo@ucl.ac.uk)
|
55 |
+
|
56 |
+
### Dataset Summary
|
57 |
+
|
58 |
+
Dynabench.QA is an adversarially collected Reading Comprehension dataset spanning over multiple rounds of data collect.
|
59 |
+
|
60 |
+
For round 1, it is identical to the [adversarialQA dataset](https://adversarialqa.github.io/), where we have created three new Reading Comprehension datasets constructed using an adversarial model-in-the-loop.
|
61 |
+
|
62 |
+
We use three different models; BiDAF (Seo et al., 2016), BERT-Large (Devlin et al., 2018), and RoBERTa-Large (Liu et al., 2019) in the annotation loop and construct three datasets; D(BiDAF), D(BERT), and D(RoBERTa), each with 10,000 training examples, 1,000 validation, and 1,000 test examples.
|
63 |
+
|
64 |
+
The adversarial human annotation paradigm ensures that these datasets consist of questions that current state-of-the-art models (at least the ones used as adversaries in the annotation loop) find challenging. The three AdversarialQA round 1 datasets provide a training and evaluation resource for such methods.
|
65 |
+
|
66 |
+
### Supported Tasks and Leaderboards
|
67 |
+
|
68 |
+
`extractive-qa`: The dataset can be used to train a model for Extractive Question Answering, which consists in selecting the answer to a question from a passage. Success on this task is typically measured by achieving a high word-overlap [F1 score](https://huggingface.co/metrics/f1). The [RoBERTa-Large](https://huggingface.co/roberta-large) model trained on all the data combined with [SQuAD](https://arxiv.org/abs/1606.05250) currently achieves 64.35% F1. This task has an active leaderboard and is available as round 1 of the QA task on [Dynabench](https://dynabench.org/tasks/2#overall) and ranks models based on F1 score.
|
69 |
+
|
70 |
+
### Languages
|
71 |
+
|
72 |
+
The text in the dataset is in English. The associated BCP-47 code is `en`.
|
73 |
+
|
74 |
+
## Dataset Structure
|
75 |
+
|
76 |
+
### Data Instances
|
77 |
+
|
78 |
+
Data is provided in the same format as SQuAD 1.1. An example is shown below:
|
79 |
+
|
80 |
+
```
|
81 |
+
{
|
82 |
+
"data": [
|
83 |
+
{
|
84 |
+
"title": "Oxygen",
|
85 |
+
"paragraphs": [
|
86 |
+
{
|
87 |
+
"context": "Among the most important classes of organic compounds that contain oxygen are (where \"R\" is an organic group): alcohols (R-OH); ethers (R-O-R); ketones (R-CO-R); aldehydes (R-CO-H); carboxylic acids (R-COOH); esters (R-COO-R); acid anhydrides (R-CO-O-CO-R); and amides (R-C(O)-NR2). There are many important organic solvents that contain oxygen, including: acetone, methanol, ethanol, isopropanol, furan, THF, diethyl ether, dioxane, ethyl acetate, DMF, DMSO, acetic acid, and formic acid. Acetone ((CH3)2CO) and phenol (C6H5OH) are used as feeder materials in the synthesis of many different substances. Other important organic compounds that contain oxygen are: glycerol, formaldehyde, glutaraldehyde, citric acid, acetic anhydride, and acetamide. Epoxides are ethers in which the oxygen atom is part of a ring of three atoms.",
|
88 |
+
"qas": [
|
89 |
+
{
|
90 |
+
"id": "22bbe104aa72aa9b511dd53237deb11afa14d6e3",
|
91 |
+
"question": "In addition to having oxygen, what do alcohols, ethers and esters have in common, according to the article?",
|
92 |
+
"answers": [
|
93 |
+
{
|
94 |
+
"answer_start": 36,
|
95 |
+
"text": "organic compounds"
|
96 |
+
}
|
97 |
+
]
|
98 |
+
},
|
99 |
+
{
|
100 |
+
"id": "4240a8e708c703796347a3702cf1463eed05584a",
|
101 |
+
"question": "What letter does the abbreviation for acid anhydrides both begin and end in?",
|
102 |
+
"answers": [
|
103 |
+
{
|
104 |
+
"answer_start": 244,
|
105 |
+
"text": "R"
|
106 |
+
}
|
107 |
+
]
|
108 |
+
},
|
109 |
+
{
|
110 |
+
"id": "0681a0a5ec852ec6920d6a30f7ef65dced493366",
|
111 |
+
"question": "Which of the organic compounds, in the article, contains nitrogen?",
|
112 |
+
"answers": [
|
113 |
+
{
|
114 |
+
"answer_start": 262,
|
115 |
+
"text": "amides"
|
116 |
+
}
|
117 |
+
]
|
118 |
+
},
|
119 |
+
{
|
120 |
+
"id": "2990efe1a56ccf81938fa5e18104f7d3803069fb",
|
121 |
+
"question": "Which of the important classes of organic compounds, in the article, has a number in its abbreviation?",
|
122 |
+
"answers": [
|
123 |
+
{
|
124 |
+
"answer_start": 262,
|
125 |
+
"text": "amides"
|
126 |
+
}
|
127 |
+
]
|
128 |
+
}
|
129 |
+
]
|
130 |
+
}
|
131 |
+
]
|
132 |
+
}
|
133 |
+
]
|
134 |
+
}
|
135 |
+
```
|
136 |
+
|
137 |
+
### Data Fields
|
138 |
+
|
139 |
+
- title: the title of the Wikipedia page from which the context is sourced
|
140 |
+
- context: the context/passage
|
141 |
+
- id: a string identifier for each question
|
142 |
+
- answers: a list of all provided answers (one per question in our case, but multiple may exist in SQuAD) with an `answer_start` field which is the character index of the start of the answer span, and a `text` field which is the answer text
|
143 |
+
|
144 |
+
### Data Splits
|
145 |
+
|
146 |
+
For round 1, the dataset is composed of three different datasets constructed using different models in the loop: BiDAF, BERT-Large, and RoBERTa-Large. Each of these has 10,000 training examples, 1,000 validation examples, and 1,000 test examples for a total of 30,000/3,000/3,000 train/validation/test examples.
|
147 |
+
|
148 |
+
## Dataset Creation
|
149 |
+
|
150 |
+
### Curation Rationale
|
151 |
+
|
152 |
+
This dataset was collected to provide a more challenging and diverse Reading Comprehension dataset to state-of-the-art models.
|
153 |
+
|
154 |
+
### Source Data
|
155 |
+
|
156 |
+
#### Initial Data Collection and Normalization
|
157 |
+
|
158 |
+
The source passages are from Wikipedia and are the same as those used in [SQuAD v1.1](https://arxiv.org/abs/1606.05250).
|
159 |
+
|
160 |
+
#### Who are the source language producers?
|
161 |
+
|
162 |
+
The source language produces are Wikipedia editors for the passages, and human annotators on Mechanical Turk for the questions.
|
163 |
+
|
164 |
+
### Annotations
|
165 |
+
|
166 |
+
#### Annotation process
|
167 |
+
|
168 |
+
The dataset is collected through an adversarial human annotation process which pairs a human annotator and a reading comprehension model in an interactive setting. The human is presented with a passage for which they write a question and highlight the correct answer. The model then tries to answer the question, and, if it fails to answer correctly, the human wins. Otherwise, the human modifies or re-writes their question until the successfully fool the model.
|
169 |
+
|
170 |
+
#### Who are the annotators?
|
171 |
+
|
172 |
+
The annotators are from Amazon Mechanical Turk, geographically restricted the the USA, UK and Canada, having previously successfully completed at least 1,000 HITs, and having a HIT approval rate greater than 98%. Crowdworkers undergo intensive training and qualification prior to annotation.
|
173 |
+
|
174 |
+
### Personal and Sensitive Information
|
175 |
+
|
176 |
+
No annotator identifying details are provided.
|
177 |
+
|
178 |
+
## Considerations for Using the Data
|
179 |
+
|
180 |
+
### Social Impact of Dataset
|
181 |
+
|
182 |
+
The purpose of this dataset is to help develop better question answering systems.
|
183 |
+
|
184 |
+
A system that succeeds at the supported task would be able to provide an accurate extractive answer from a short passage. This dataset is to be seen as a test bed for questions which contemporary state-of-the-art models struggle to answer correctly, thus often requiring more complex comprehension abilities than say detecting phrases explicitly mentioned in the passage with high overlap to the question.
|
185 |
+
|
186 |
+
It should be noted, however, that the the source passages are both domain-restricted and linguistically specific, and that provided questions and answers do not constitute any particular social application.
|
187 |
+
|
188 |
+
|
189 |
+
### Discussion of Biases
|
190 |
+
|
191 |
+
The dataset may exhibit various biases in terms of the source passage selection, annotated questions and answers, as well as algorithmic biases resulting from the adversarial annotation protocol.
|
192 |
+
|
193 |
+
### Other Known Limitations
|
194 |
+
|
195 |
+
N/a
|
196 |
+
|
197 |
+
## Additional Information
|
198 |
+
|
199 |
+
### Dataset Curators
|
200 |
+
|
201 |
+
This dataset was initially created by Max Bartolo, Alastair Roberts, Johannes Welbl, Sebastian Riedel, and Pontus Stenetorp, during work carried out at University College London (UCL).
|
202 |
+
|
203 |
+
### Licensing Information
|
204 |
+
|
205 |
+
This dataset is distributed under [CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/).
|
206 |
+
|
207 |
+
### Citation Information
|
208 |
+
|
209 |
+
```
|
210 |
+
@article{bartolo2020beat,
|
211 |
+
author = {Bartolo, Max and Roberts, Alastair and Welbl, Johannes and Riedel, Sebastian and Stenetorp, Pontus},
|
212 |
+
title = {Beat the AI: Investigating Adversarial Human Annotation for Reading Comprehension},
|
213 |
+
journal = {Transactions of the Association for Computational Linguistics},
|
214 |
+
volume = {8},
|
215 |
+
number = {},
|
216 |
+
pages = {662-678},
|
217 |
+
year = {2020},
|
218 |
+
doi = {10.1162/tacl\_a\_00338},
|
219 |
+
URL = { https://doi.org/10.1162/tacl_a_00338 },
|
220 |
+
eprint = { https://doi.org/10.1162/tacl_a_00338 },
|
221 |
+
abstract = { Innovations in annotation methodology have been a catalyst for Reading Comprehension (RC) datasets and models. One recent trend to challenge current RC models is to involve a model in the annotation process: Humans create questions adversarially, such that the model fails to answer them correctly. In this work we investigate this annotation methodology and apply it in three different settings, collecting a total of 36,000 samples with progressively stronger models in the annotation loop. This allows us to explore questions such as the reproducibility of the adversarial effect, transfer from data collected with varying model-in-the-loop strengths, and generalization to data collected without a model. We find that training on adversarially collected samples leads to strong generalization to non-adversarially collected datasets, yet with progressive performance deterioration with increasingly stronger models-in-the-loop. Furthermore, we find that stronger models can still learn from datasets collected with substantially weaker models-in-the-loop. When trained on data collected with a BiDAF model in the loop, RoBERTa achieves 39.9F1 on questions that it cannot answer when trained on SQuAD—only marginally lower than when trained on data collected using RoBERTa itself (41.0F1). }
|
222 |
+
}
|
223 |
+
```
|
224 |
+
### Contributions
|
225 |
+
|
226 |
+
Thanks to [@maxbartolo](https://github.com/maxbartolo) for adding this dataset.
|
dataset_infos.json
ADDED
@@ -0,0 +1,434 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"dynabench.qa.r1.all": {
|
3 |
+
"description": "Dynabench.QA is a Reading Comprehension dataset collected using a human-and-model-in-the-loop. Round 1 is the AdversarialQA dataset from Bartolo et al., 2020, and consists of questions posed by crowdworkers on a set of Wikipedia articles using an adversarial model-in-the-loop.\n We use three different models; BiDAF (Seo et al., 2016), BERT-Large (Devlin et al., 2018), and RoBERTa-Large (Liu et al., 2019) in the annotation loop and construct three datasets; D(BiDAF), D(BERT), and D(RoBERTa), each with 10,000 training examples, 1,000 validation, and 1,000 test examples.\n The adversarial human annotation paradigm ensures that these datasets consist of questions that current state-of-the-art models (at least the ones used as adversaries in the annotation loop) find challenging.\n For more details on the dataset construction process, see https://adversarialqa.github.io.",
|
4 |
+
"citation": "@article{bartolo2020beat,\n author = {Bartolo, Max and Roberts, Alastair and Welbl, Johannes and Riedel, Sebastian and Stenetorp, Pontus},\n title = {Beat the AI: Investigating Adversarial Human Annotation for Reading Comprehension},\n journal = {Transactions of the Association for Computational Linguistics},\n volume = {8},\n number = {},\n pages = {662-678},\n year = {2020},\n doi = {10.1162/tacl_a_00338},\n URL = { https://doi.org/10.1162/tacl_a_00338 },\n eprint = { https://doi.org/10.1162/tacl_a_00338 },\n abstract = { Innovations in annotation methodology have been a catalyst for Reading Comprehension (RC) datasets and models. One recent trend to challenge current RC models is to involve a model in the annotation process: Humans create questions adversarially, such that the model fails to answer them correctly. In this work we investigate this annotation methodology and apply it in three different settings, collecting a total of 36,000 samples with progressively stronger models in the annotation loop. This allows us to explore questions such as the reproducibility of the adversarial effect, transfer from data collected with varying model-in-the-loop strengths, and generalization to data collected without a model. We find that training on adversarially collected samples leads to strong generalization to non-adversarially collected datasets, yet with progressive performance deterioration with increasingly stronger models-in-the-loop. Furthermore, we find that stronger models can still learn from datasets collected with substantially weaker models-in-the-loop. When trained on data collected with a BiDAF model in the loop, RoBERTa achieves 39.9F1 on questions that it cannot answer when trained on SQuAD\u2014only marginally lower than when trained on data collected using RoBERTa itself (41.0F1). }\n }",
|
5 |
+
"homepage": "https://dynabench.org/tasks/2",
|
6 |
+
"license": "",
|
7 |
+
"features": {
|
8 |
+
"id": {
|
9 |
+
"dtype": "string",
|
10 |
+
"id": null,
|
11 |
+
"_type": "Value"
|
12 |
+
},
|
13 |
+
"title": {
|
14 |
+
"dtype": "string",
|
15 |
+
"id": null,
|
16 |
+
"_type": "Value"
|
17 |
+
},
|
18 |
+
"context": {
|
19 |
+
"dtype": "string",
|
20 |
+
"id": null,
|
21 |
+
"_type": "Value"
|
22 |
+
},
|
23 |
+
"question": {
|
24 |
+
"dtype": "string",
|
25 |
+
"id": null,
|
26 |
+
"_type": "Value"
|
27 |
+
},
|
28 |
+
"answers": {
|
29 |
+
"feature": {
|
30 |
+
"text": {
|
31 |
+
"dtype": "string",
|
32 |
+
"id": null,
|
33 |
+
"_type": "Value"
|
34 |
+
},
|
35 |
+
"answer_start": {
|
36 |
+
"dtype": "int32",
|
37 |
+
"id": null,
|
38 |
+
"_type": "Value"
|
39 |
+
}
|
40 |
+
},
|
41 |
+
"length": -1,
|
42 |
+
"id": null,
|
43 |
+
"_type": "Sequence"
|
44 |
+
},
|
45 |
+
"metadata": {
|
46 |
+
"split": {
|
47 |
+
"dtype": "string",
|
48 |
+
"id": null,
|
49 |
+
"_type": "Value"
|
50 |
+
},
|
51 |
+
"round": {
|
52 |
+
"dtype": "int32",
|
53 |
+
"id": null,
|
54 |
+
"_type": "Value"
|
55 |
+
},
|
56 |
+
"subset": {
|
57 |
+
"dtype": "string",
|
58 |
+
"id": null,
|
59 |
+
"_type": "Value"
|
60 |
+
},
|
61 |
+
"model_in_the_loop": {
|
62 |
+
"dtype": "string",
|
63 |
+
"id": null,
|
64 |
+
"_type": "Value"
|
65 |
+
}
|
66 |
+
}
|
67 |
+
},
|
68 |
+
"post_processed": null,
|
69 |
+
"supervised_keys": null,
|
70 |
+
"builder_name": "dynabench_qa",
|
71 |
+
"config_name": "dynabench.qa.r1.all",
|
72 |
+
"version": {
|
73 |
+
"version_str": "1.0.0",
|
74 |
+
"description": null,
|
75 |
+
"major": 1,
|
76 |
+
"minor": 0,
|
77 |
+
"patch": 0
|
78 |
+
},
|
79 |
+
"splits": {
|
80 |
+
"train": {
|
81 |
+
"name": "train",
|
82 |
+
"num_bytes": 28188806,
|
83 |
+
"num_examples": 30000,
|
84 |
+
"dataset_name": "dynabench_qa"
|
85 |
+
},
|
86 |
+
"validation": {
|
87 |
+
"name": "validation",
|
88 |
+
"num_bytes": 2790132,
|
89 |
+
"num_examples": 3000,
|
90 |
+
"dataset_name": "dynabench_qa"
|
91 |
+
},
|
92 |
+
"test": {
|
93 |
+
"name": "test",
|
94 |
+
"num_bytes": 2952647,
|
95 |
+
"num_examples": 3000,
|
96 |
+
"dataset_name": "dynabench_qa"
|
97 |
+
}
|
98 |
+
},
|
99 |
+
"download_checksums": {
|
100 |
+
"https://adversarialqa.github.io/data/aqa_v1.0.zip": {
|
101 |
+
"num_bytes": 9018914,
|
102 |
+
"checksum": "f4f3c23224a5060b28c35e35581bd5cf46256dda3665418fb83d036d0e0c93cf"
|
103 |
+
}
|
104 |
+
},
|
105 |
+
"download_size": 9018914,
|
106 |
+
"post_processing_size": null,
|
107 |
+
"dataset_size": 33931585,
|
108 |
+
"size_in_bytes": 42950499
|
109 |
+
},
|
110 |
+
"dynabench.qa.r1.dbidaf": {
|
111 |
+
"description": "Dynabench.QA is a Reading Comprehension dataset collected using a human-and-model-in-the-loop. Round 1 is the AdversarialQA dataset from Bartolo et al., 2020, and consists of questions posed by crowdworkers on a set of Wikipedia articles using an adversarial model-in-the-loop.\n We use three different models; BiDAF (Seo et al., 2016), BERT-Large (Devlin et al., 2018), and RoBERTa-Large (Liu et al., 2019) in the annotation loop and construct three datasets; D(BiDAF), D(BERT), and D(RoBERTa), each with 10,000 training examples, 1,000 validation, and 1,000 test examples.\n The adversarial human annotation paradigm ensures that these datasets consist of questions that current state-of-the-art models (at least the ones used as adversaries in the annotation loop) find challenging.\n For more details on the dataset construction process, see https://adversarialqa.github.io.",
|
112 |
+
"citation": "@article{bartolo2020beat,\n author = {Bartolo, Max and Roberts, Alastair and Welbl, Johannes and Riedel, Sebastian and Stenetorp, Pontus},\n title = {Beat the AI: Investigating Adversarial Human Annotation for Reading Comprehension},\n journal = {Transactions of the Association for Computational Linguistics},\n volume = {8},\n number = {},\n pages = {662-678},\n year = {2020},\n doi = {10.1162/tacl_a_00338},\n URL = { https://doi.org/10.1162/tacl_a_00338 },\n eprint = { https://doi.org/10.1162/tacl_a_00338 },\n abstract = { Innovations in annotation methodology have been a catalyst for Reading Comprehension (RC) datasets and models. One recent trend to challenge current RC models is to involve a model in the annotation process: Humans create questions adversarially, such that the model fails to answer them correctly. In this work we investigate this annotation methodology and apply it in three different settings, collecting a total of 36,000 samples with progressively stronger models in the annotation loop. This allows us to explore questions such as the reproducibility of the adversarial effect, transfer from data collected with varying model-in-the-loop strengths, and generalization to data collected without a model. We find that training on adversarially collected samples leads to strong generalization to non-adversarially collected datasets, yet with progressive performance deterioration with increasingly stronger models-in-the-loop. Furthermore, we find that stronger models can still learn from datasets collected with substantially weaker models-in-the-loop. When trained on data collected with a BiDAF model in the loop, RoBERTa achieves 39.9F1 on questions that it cannot answer when trained on SQuAD\u2014only marginally lower than when trained on data collected using RoBERTa itself (41.0F1). }\n }",
|
113 |
+
"homepage": "https://dynabench.org/tasks/2",
|
114 |
+
"license": "",
|
115 |
+
"features": {
|
116 |
+
"id": {
|
117 |
+
"dtype": "string",
|
118 |
+
"id": null,
|
119 |
+
"_type": "Value"
|
120 |
+
},
|
121 |
+
"title": {
|
122 |
+
"dtype": "string",
|
123 |
+
"id": null,
|
124 |
+
"_type": "Value"
|
125 |
+
},
|
126 |
+
"context": {
|
127 |
+
"dtype": "string",
|
128 |
+
"id": null,
|
129 |
+
"_type": "Value"
|
130 |
+
},
|
131 |
+
"question": {
|
132 |
+
"dtype": "string",
|
133 |
+
"id": null,
|
134 |
+
"_type": "Value"
|
135 |
+
},
|
136 |
+
"answers": {
|
137 |
+
"feature": {
|
138 |
+
"text": {
|
139 |
+
"dtype": "string",
|
140 |
+
"id": null,
|
141 |
+
"_type": "Value"
|
142 |
+
},
|
143 |
+
"answer_start": {
|
144 |
+
"dtype": "int32",
|
145 |
+
"id": null,
|
146 |
+
"_type": "Value"
|
147 |
+
}
|
148 |
+
},
|
149 |
+
"length": -1,
|
150 |
+
"id": null,
|
151 |
+
"_type": "Sequence"
|
152 |
+
},
|
153 |
+
"metadata": {
|
154 |
+
"split": {
|
155 |
+
"dtype": "string",
|
156 |
+
"id": null,
|
157 |
+
"_type": "Value"
|
158 |
+
},
|
159 |
+
"round": {
|
160 |
+
"dtype": "int32",
|
161 |
+
"id": null,
|
162 |
+
"_type": "Value"
|
163 |
+
},
|
164 |
+
"subset": {
|
165 |
+
"dtype": "string",
|
166 |
+
"id": null,
|
167 |
+
"_type": "Value"
|
168 |
+
},
|
169 |
+
"model_in_the_loop": {
|
170 |
+
"dtype": "string",
|
171 |
+
"id": null,
|
172 |
+
"_type": "Value"
|
173 |
+
}
|
174 |
+
}
|
175 |
+
},
|
176 |
+
"post_processed": null,
|
177 |
+
"supervised_keys": null,
|
178 |
+
"builder_name": "dynabench_qa",
|
179 |
+
"config_name": "dynabench.qa.r1.dbidaf",
|
180 |
+
"version": {
|
181 |
+
"version_str": "1.0.0",
|
182 |
+
"description": null,
|
183 |
+
"major": 1,
|
184 |
+
"minor": 0,
|
185 |
+
"patch": 0
|
186 |
+
},
|
187 |
+
"splits": {
|
188 |
+
"train": {
|
189 |
+
"name": "train",
|
190 |
+
"num_bytes": 9422522,
|
191 |
+
"num_examples": 10000,
|
192 |
+
"dataset_name": "dynabench_qa"
|
193 |
+
},
|
194 |
+
"validation": {
|
195 |
+
"name": "validation",
|
196 |
+
"num_bytes": 931947,
|
197 |
+
"num_examples": 1000,
|
198 |
+
"dataset_name": "dynabench_qa"
|
199 |
+
},
|
200 |
+
"test": {
|
201 |
+
"name": "test",
|
202 |
+
"num_bytes": 961115,
|
203 |
+
"num_examples": 1000,
|
204 |
+
"dataset_name": "dynabench_qa"
|
205 |
+
}
|
206 |
+
},
|
207 |
+
"download_checksums": {
|
208 |
+
"https://adversarialqa.github.io/data/aqa_v1.0.zip": {
|
209 |
+
"num_bytes": 9018914,
|
210 |
+
"checksum": "f4f3c23224a5060b28c35e35581bd5cf46256dda3665418fb83d036d0e0c93cf"
|
211 |
+
}
|
212 |
+
},
|
213 |
+
"download_size": 9018914,
|
214 |
+
"post_processing_size": null,
|
215 |
+
"dataset_size": 11315584,
|
216 |
+
"size_in_bytes": 20334498
|
217 |
+
},
|
218 |
+
"dynabench.qa.r1.dbert": {
|
219 |
+
"description": "Dynabench.QA is a Reading Comprehension dataset collected using a human-and-model-in-the-loop. Round 1 is the AdversarialQA dataset from Bartolo et al., 2020, and consists of questions posed by crowdworkers on a set of Wikipedia articles using an adversarial model-in-the-loop.\n We use three different models; BiDAF (Seo et al., 2016), BERT-Large (Devlin et al., 2018), and RoBERTa-Large (Liu et al., 2019) in the annotation loop and construct three datasets; D(BiDAF), D(BERT), and D(RoBERTa), each with 10,000 training examples, 1,000 validation, and 1,000 test examples.\n The adversarial human annotation paradigm ensures that these datasets consist of questions that current state-of-the-art models (at least the ones used as adversaries in the annotation loop) find challenging.\n For more details on the dataset construction process, see https://adversarialqa.github.io.",
|
220 |
+
"citation": "@article{bartolo2020beat,\n author = {Bartolo, Max and Roberts, Alastair and Welbl, Johannes and Riedel, Sebastian and Stenetorp, Pontus},\n title = {Beat the AI: Investigating Adversarial Human Annotation for Reading Comprehension},\n journal = {Transactions of the Association for Computational Linguistics},\n volume = {8},\n number = {},\n pages = {662-678},\n year = {2020},\n doi = {10.1162/tacl_a_00338},\n URL = { https://doi.org/10.1162/tacl_a_00338 },\n eprint = { https://doi.org/10.1162/tacl_a_00338 },\n abstract = { Innovations in annotation methodology have been a catalyst for Reading Comprehension (RC) datasets and models. One recent trend to challenge current RC models is to involve a model in the annotation process: Humans create questions adversarially, such that the model fails to answer them correctly. In this work we investigate this annotation methodology and apply it in three different settings, collecting a total of 36,000 samples with progressively stronger models in the annotation loop. This allows us to explore questions such as the reproducibility of the adversarial effect, transfer from data collected with varying model-in-the-loop strengths, and generalization to data collected without a model. We find that training on adversarially collected samples leads to strong generalization to non-adversarially collected datasets, yet with progressive performance deterioration with increasingly stronger models-in-the-loop. Furthermore, we find that stronger models can still learn from datasets collected with substantially weaker models-in-the-loop. When trained on data collected with a BiDAF model in the loop, RoBERTa achieves 39.9F1 on questions that it cannot answer when trained on SQuAD\u2014only marginally lower than when trained on data collected using RoBERTa itself (41.0F1). }\n }",
|
221 |
+
"homepage": "https://dynabench.org/tasks/2",
|
222 |
+
"license": "",
|
223 |
+
"features": {
|
224 |
+
"id": {
|
225 |
+
"dtype": "string",
|
226 |
+
"id": null,
|
227 |
+
"_type": "Value"
|
228 |
+
},
|
229 |
+
"title": {
|
230 |
+
"dtype": "string",
|
231 |
+
"id": null,
|
232 |
+
"_type": "Value"
|
233 |
+
},
|
234 |
+
"context": {
|
235 |
+
"dtype": "string",
|
236 |
+
"id": null,
|
237 |
+
"_type": "Value"
|
238 |
+
},
|
239 |
+
"question": {
|
240 |
+
"dtype": "string",
|
241 |
+
"id": null,
|
242 |
+
"_type": "Value"
|
243 |
+
},
|
244 |
+
"answers": {
|
245 |
+
"feature": {
|
246 |
+
"text": {
|
247 |
+
"dtype": "string",
|
248 |
+
"id": null,
|
249 |
+
"_type": "Value"
|
250 |
+
},
|
251 |
+
"answer_start": {
|
252 |
+
"dtype": "int32",
|
253 |
+
"id": null,
|
254 |
+
"_type": "Value"
|
255 |
+
}
|
256 |
+
},
|
257 |
+
"length": -1,
|
258 |
+
"id": null,
|
259 |
+
"_type": "Sequence"
|
260 |
+
},
|
261 |
+
"metadata": {
|
262 |
+
"split": {
|
263 |
+
"dtype": "string",
|
264 |
+
"id": null,
|
265 |
+
"_type": "Value"
|
266 |
+
},
|
267 |
+
"round": {
|
268 |
+
"dtype": "int32",
|
269 |
+
"id": null,
|
270 |
+
"_type": "Value"
|
271 |
+
},
|
272 |
+
"subset": {
|
273 |
+
"dtype": "string",
|
274 |
+
"id": null,
|
275 |
+
"_type": "Value"
|
276 |
+
},
|
277 |
+
"model_in_the_loop": {
|
278 |
+
"dtype": "string",
|
279 |
+
"id": null,
|
280 |
+
"_type": "Value"
|
281 |
+
}
|
282 |
+
}
|
283 |
+
},
|
284 |
+
"post_processed": null,
|
285 |
+
"supervised_keys": null,
|
286 |
+
"builder_name": "dynabench_qa",
|
287 |
+
"config_name": "dynabench.qa.r1.dbert",
|
288 |
+
"version": {
|
289 |
+
"version_str": "1.0.0",
|
290 |
+
"description": null,
|
291 |
+
"major": 1,
|
292 |
+
"minor": 0,
|
293 |
+
"patch": 0
|
294 |
+
},
|
295 |
+
"splits": {
|
296 |
+
"train": {
|
297 |
+
"name": "train",
|
298 |
+
"num_bytes": 9475561,
|
299 |
+
"num_examples": 10000,
|
300 |
+
"dataset_name": "dynabench_qa"
|
301 |
+
},
|
302 |
+
"validation": {
|
303 |
+
"name": "validation",
|
304 |
+
"num_bytes": 931196,
|
305 |
+
"num_examples": 1000,
|
306 |
+
"dataset_name": "dynabench_qa"
|
307 |
+
},
|
308 |
+
"test": {
|
309 |
+
"name": "test",
|
310 |
+
"num_bytes": 984458,
|
311 |
+
"num_examples": 1000,
|
312 |
+
"dataset_name": "dynabench_qa"
|
313 |
+
}
|
314 |
+
},
|
315 |
+
"download_checksums": {
|
316 |
+
"https://adversarialqa.github.io/data/aqa_v1.0.zip": {
|
317 |
+
"num_bytes": 9018914,
|
318 |
+
"checksum": "f4f3c23224a5060b28c35e35581bd5cf46256dda3665418fb83d036d0e0c93cf"
|
319 |
+
}
|
320 |
+
},
|
321 |
+
"download_size": 9018914,
|
322 |
+
"post_processing_size": null,
|
323 |
+
"dataset_size": 11391215,
|
324 |
+
"size_in_bytes": 20410129
|
325 |
+
},
|
326 |
+
"dynabench.qa.r1.droberta": {
|
327 |
+
"description": "Dynabench.QA is a Reading Comprehension dataset collected using a human-and-model-in-the-loop. Round 1 is the AdversarialQA dataset from Bartolo et al., 2020, and consists of questions posed by crowdworkers on a set of Wikipedia articles using an adversarial model-in-the-loop.\n We use three different models; BiDAF (Seo et al., 2016), BERT-Large (Devlin et al., 2018), and RoBERTa-Large (Liu et al., 2019) in the annotation loop and construct three datasets; D(BiDAF), D(BERT), and D(RoBERTa), each with 10,000 training examples, 1,000 validation, and 1,000 test examples.\n The adversarial human annotation paradigm ensures that these datasets consist of questions that current state-of-the-art models (at least the ones used as adversaries in the annotation loop) find challenging.\n For more details on the dataset construction process, see https://adversarialqa.github.io.",
|
328 |
+
"citation": "@article{bartolo2020beat,\n author = {Bartolo, Max and Roberts, Alastair and Welbl, Johannes and Riedel, Sebastian and Stenetorp, Pontus},\n title = {Beat the AI: Investigating Adversarial Human Annotation for Reading Comprehension},\n journal = {Transactions of the Association for Computational Linguistics},\n volume = {8},\n number = {},\n pages = {662-678},\n year = {2020},\n doi = {10.1162/tacl_a_00338},\n URL = { https://doi.org/10.1162/tacl_a_00338 },\n eprint = { https://doi.org/10.1162/tacl_a_00338 },\n abstract = { Innovations in annotation methodology have been a catalyst for Reading Comprehension (RC) datasets and models. One recent trend to challenge current RC models is to involve a model in the annotation process: Humans create questions adversarially, such that the model fails to answer them correctly. In this work we investigate this annotation methodology and apply it in three different settings, collecting a total of 36,000 samples with progressively stronger models in the annotation loop. This allows us to explore questions such as the reproducibility of the adversarial effect, transfer from data collected with varying model-in-the-loop strengths, and generalization to data collected without a model. We find that training on adversarially collected samples leads to strong generalization to non-adversarially collected datasets, yet with progressive performance deterioration with increasingly stronger models-in-the-loop. Furthermore, we find that stronger models can still learn from datasets collected with substantially weaker models-in-the-loop. When trained on data collected with a BiDAF model in the loop, RoBERTa achieves 39.9F1 on questions that it cannot answer when trained on SQuAD\u2014only marginally lower than when trained on data collected using RoBERTa itself (41.0F1). }\n }",
|
329 |
+
"homepage": "https://dynabench.org/tasks/2",
|
330 |
+
"license": "",
|
331 |
+
"features": {
|
332 |
+
"id": {
|
333 |
+
"dtype": "string",
|
334 |
+
"id": null,
|
335 |
+
"_type": "Value"
|
336 |
+
},
|
337 |
+
"title": {
|
338 |
+
"dtype": "string",
|
339 |
+
"id": null,
|
340 |
+
"_type": "Value"
|
341 |
+
},
|
342 |
+
"context": {
|
343 |
+
"dtype": "string",
|
344 |
+
"id": null,
|
345 |
+
"_type": "Value"
|
346 |
+
},
|
347 |
+
"question": {
|
348 |
+
"dtype": "string",
|
349 |
+
"id": null,
|
350 |
+
"_type": "Value"
|
351 |
+
},
|
352 |
+
"answers": {
|
353 |
+
"feature": {
|
354 |
+
"text": {
|
355 |
+
"dtype": "string",
|
356 |
+
"id": null,
|
357 |
+
"_type": "Value"
|
358 |
+
},
|
359 |
+
"answer_start": {
|
360 |
+
"dtype": "int32",
|
361 |
+
"id": null,
|
362 |
+
"_type": "Value"
|
363 |
+
}
|
364 |
+
},
|
365 |
+
"length": -1,
|
366 |
+
"id": null,
|
367 |
+
"_type": "Sequence"
|
368 |
+
},
|
369 |
+
"metadata": {
|
370 |
+
"split": {
|
371 |
+
"dtype": "string",
|
372 |
+
"id": null,
|
373 |
+
"_type": "Value"
|
374 |
+
},
|
375 |
+
"round": {
|
376 |
+
"dtype": "int32",
|
377 |
+
"id": null,
|
378 |
+
"_type": "Value"
|
379 |
+
},
|
380 |
+
"subset": {
|
381 |
+
"dtype": "string",
|
382 |
+
"id": null,
|
383 |
+
"_type": "Value"
|
384 |
+
},
|
385 |
+
"model_in_the_loop": {
|
386 |
+
"dtype": "string",
|
387 |
+
"id": null,
|
388 |
+
"_type": "Value"
|
389 |
+
}
|
390 |
+
}
|
391 |
+
},
|
392 |
+
"post_processed": null,
|
393 |
+
"supervised_keys": null,
|
394 |
+
"builder_name": "dynabench_qa",
|
395 |
+
"config_name": "dynabench.qa.r1.droberta",
|
396 |
+
"version": {
|
397 |
+
"version_str": "1.0.0",
|
398 |
+
"description": null,
|
399 |
+
"major": 1,
|
400 |
+
"minor": 0,
|
401 |
+
"patch": 0
|
402 |
+
},
|
403 |
+
"splits": {
|
404 |
+
"train": {
|
405 |
+
"name": "train",
|
406 |
+
"num_bytes": 9430723,
|
407 |
+
"num_examples": 10000,
|
408 |
+
"dataset_name": "dynabench_qa"
|
409 |
+
},
|
410 |
+
"validation": {
|
411 |
+
"name": "validation",
|
412 |
+
"num_bytes": 941069,
|
413 |
+
"num_examples": 1000,
|
414 |
+
"dataset_name": "dynabench_qa"
|
415 |
+
},
|
416 |
+
"test": {
|
417 |
+
"name": "test",
|
418 |
+
"num_bytes": 1021410,
|
419 |
+
"num_examples": 1000,
|
420 |
+
"dataset_name": "dynabench_qa"
|
421 |
+
}
|
422 |
+
},
|
423 |
+
"download_checksums": {
|
424 |
+
"https://adversarialqa.github.io/data/aqa_v1.0.zip": {
|
425 |
+
"num_bytes": 9018914,
|
426 |
+
"checksum": "f4f3c23224a5060b28c35e35581bd5cf46256dda3665418fb83d036d0e0c93cf"
|
427 |
+
}
|
428 |
+
},
|
429 |
+
"download_size": 9018914,
|
430 |
+
"post_processing_size": null,
|
431 |
+
"dataset_size": 11393202,
|
432 |
+
"size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|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
|
3 |
+
#
|
4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
+
# you may not use this file except in compliance with the License.
|
6 |
+
# You may obtain a copy of the License at
|
7 |
+
#
|
8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
+
#
|
10 |
+
# Unless required by applicable law or agreed to in writing, software
|
11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
+
# See the License for the specific language governing permissions and
|
14 |
+
# limitations under the License.
|
15 |
+
|
16 |
+
# Lint as: python3
|
17 |
+
"""Dynabench.QA"""
|
18 |
+
|
19 |
+
from __future__ import absolute_import, division, print_function
|
20 |
+
|
21 |
+
import json
|
22 |
+
import os
|
23 |
+
from collections import OrderedDict
|
24 |
+
|
25 |
+
import datasets
|
26 |
+
|
27 |
+
|
28 |
+
logger = datasets.logging.get_logger(__name__)
|
29 |
+
|
30 |
+
|
31 |
+
_VERSION = datasets.Version("1.0.0")
|
32 |
+
_NUM_ROUNDS = 1
|
33 |
+
|
34 |
+
_DESCRIPTION = """\
|
35 |
+
Dynabench.QA is a Reading Comprehension dataset collected using a human-and-model-in-the-loop.
|
36 |
+
""".strip()
|
37 |
+
|
38 |
+
|
39 |
+
class DynabenchRoundDetails:
|
40 |
+
"""Round details for DynabenchQA datasets."""
|
41 |
+
def __init__(self, citation, description, homepage, data_license, data_url, data_features, data_subset_map=None):
|
42 |
+
self.citation = citation
|
43 |
+
self.description = description
|
44 |
+
self.homepage = homepage
|
45 |
+
self.data_license = data_license
|
46 |
+
self.data_url = data_url
|
47 |
+
self.data_features = data_features
|
48 |
+
self.data_subset_map = data_subset_map
|
49 |
+
|
50 |
+
|
51 |
+
# Provide the details for each round
|
52 |
+
_ROUND_DETAILS = {
|
53 |
+
1: DynabenchRoundDetails(
|
54 |
+
citation="""\
|
55 |
+
@article{bartolo2020beat,
|
56 |
+
author = {Bartolo, Max and Roberts, Alastair and Welbl, Johannes and Riedel, Sebastian and Stenetorp, Pontus},
|
57 |
+
title = {Beat the AI: Investigating Adversarial Human Annotation for Reading Comprehension},
|
58 |
+
journal = {Transactions of the Association for Computational Linguistics},
|
59 |
+
volume = {8},
|
60 |
+
number = {},
|
61 |
+
pages = {662-678},
|
62 |
+
year = {2020},
|
63 |
+
doi = {10.1162/tacl_a_00338},
|
64 |
+
URL = { https://doi.org/10.1162/tacl_a_00338 },
|
65 |
+
eprint = { https://doi.org/10.1162/tacl_a_00338 },
|
66 |
+
abstract = { Innovations in annotation methodology have been a catalyst for Reading Comprehension (RC) datasets and models. One recent trend to challenge current RC models is to involve a model in the annotation process: Humans create questions adversarially, such that the model fails to answer them correctly. In this work we investigate this annotation methodology and apply it in three different settings, collecting a total of 36,000 samples with progressively stronger models in the annotation loop. This allows us to explore questions such as the reproducibility of the adversarial effect, transfer from data collected with varying model-in-the-loop strengths, and generalization to data collected without a model. We find that training on adversarially collected samples leads to strong generalization to non-adversarially collected datasets, yet with progressive performance deterioration with increasingly stronger models-in-the-loop. Furthermore, we find that stronger models can still learn from datasets collected with substantially weaker models-in-the-loop. When trained on data collected with a BiDAF model in the loop, RoBERTa achieves 39.9F1 on questions that it cannot answer when trained on SQuAD—only marginally lower than when trained on data collected using RoBERTa itself (41.0F1). }
|
67 |
+
}
|
68 |
+
""".strip(),
|
69 |
+
description="""\
|
70 |
+
Dynabench.QA is a Reading Comprehension dataset collected using a human-and-model-in-the-loop. Round 1 is the AdversarialQA dataset from Bartolo et al., 2020, and consists of questions posed by crowdworkers on a set of Wikipedia articles using an adversarial model-in-the-loop.
|
71 |
+
We use three different models; BiDAF (Seo et al., 2016), BERT-Large (Devlin et al., 2018), and RoBERTa-Large (Liu et al., 2019) in the annotation loop and construct three datasets; D(BiDAF), D(BERT), and D(RoBERTa), each with 10,000 training examples, 1,000 validation, and 1,000 test examples.
|
72 |
+
The adversarial human annotation paradigm ensures that these datasets consist of questions that current state-of-the-art models (at least the ones used as adversaries in the annotation loop) find challenging.
|
73 |
+
For more details on the dataset construction process, see https://adversarialqa.github.io.
|
74 |
+
""".strip(),
|
75 |
+
homepage="https://dynabench.org/tasks/2",
|
76 |
+
data_license="CC BY-SA 3.0",
|
77 |
+
data_url="https://adversarialqa.github.io/data/aqa_v1.0.zip",
|
78 |
+
data_features=datasets.Features(
|
79 |
+
{
|
80 |
+
"id": datasets.Value("string"),
|
81 |
+
"title": datasets.Value("string"),
|
82 |
+
"context": datasets.Value("string"),
|
83 |
+
"question": datasets.Value("string"),
|
84 |
+
"answers": datasets.features.Sequence(
|
85 |
+
{
|
86 |
+
"text": datasets.Value("string"),
|
87 |
+
"answer_start": datasets.Value("int32"),
|
88 |
+
}
|
89 |
+
),
|
90 |
+
"metadata": {
|
91 |
+
"split": datasets.Value("string"),
|
92 |
+
"round": datasets.Value("int32"),
|
93 |
+
"subset": datasets.Value("string"),
|
94 |
+
"model_in_the_loop": datasets.Value("string"),
|
95 |
+
},
|
96 |
+
}
|
97 |
+
),
|
98 |
+
data_subset_map=OrderedDict({
|
99 |
+
"all": {
|
100 |
+
"dir": "combined",
|
101 |
+
"model": "Combined",
|
102 |
+
},
|
103 |
+
"dbidaf": {
|
104 |
+
"dir": "1_dbidaf",
|
105 |
+
"model": "BiDAF",
|
106 |
+
},
|
107 |
+
"dbert": {
|
108 |
+
"dir": "2_dbert",
|
109 |
+
"model": "BERT-Large",
|
110 |
+
},
|
111 |
+
"droberta": {
|
112 |
+
"dir": "3_droberta",
|
113 |
+
"model": "RoBERTa-Large",
|
114 |
+
},
|
115 |
+
}),
|
116 |
+
)
|
117 |
+
}
|
118 |
+
|
119 |
+
|
120 |
+
class DynabenchQAConfig(datasets.BuilderConfig):
|
121 |
+
"""BuilderConfig for DynabenchQA datasets."""
|
122 |
+
|
123 |
+
def __init__(self, round, subset='all', **kwargs):
|
124 |
+
"""BuilderConfig for Wikipedia.
|
125 |
+
|
126 |
+
Args:
|
127 |
+
round: integer, the dynabench round to load.
|
128 |
+
subset: string, the subset of that round's data to load or 'all'.
|
129 |
+
**kwargs: keyword arguments forwarded to super.
|
130 |
+
"""
|
131 |
+
assert isinstance(round, int), "round ({}) must be set and of type integer".format(round)
|
132 |
+
assert 0 < round <= _NUM_ROUNDS, \
|
133 |
+
"round (received {}) must be between 1 and {}".format(round, _NUM_ROUNDS)
|
134 |
+
super(DynabenchQAConfig, self).__init__(
|
135 |
+
name="dynabench.qa.r{}.{}".format(round, subset),
|
136 |
+
description="Dynabench QA dataset for round {}, showing dataset selection: {}.".format(round, subset),
|
137 |
+
**kwargs,
|
138 |
+
)
|
139 |
+
self.round = round
|
140 |
+
self.subset = subset
|
141 |
+
|
142 |
+
|
143 |
+
class DynabenchQA(datasets.GeneratorBasedBuilder):
|
144 |
+
"""Dynabench.QA"""
|
145 |
+
|
146 |
+
BUILDER_CONFIG_CLASS = DynabenchQAConfig
|
147 |
+
BUILDER_CONFIGS = [
|
148 |
+
DynabenchQAConfig(
|
149 |
+
version=_VERSION,
|
150 |
+
round=round,
|
151 |
+
subset=subset,
|
152 |
+
) # pylint:disable=g-complex-comprehension
|
153 |
+
for round in range(1, _NUM_ROUNDS+1) for subset in _ROUND_DETAILS[round].data_subset_map
|
154 |
+
]
|
155 |
+
|
156 |
+
def _info(self):
|
157 |
+
round_details = _ROUND_DETAILS[self.config.round]
|
158 |
+
return datasets.DatasetInfo(
|
159 |
+
description=round_details.description,
|
160 |
+
features=round_details.data_features,
|
161 |
+
homepage=round_details.homepage,
|
162 |
+
citation=round_details.citation,
|
163 |
+
supervised_keys=None, # No default supervised_keys (as we have to pass both question and context as input).
|
164 |
+
)
|
165 |
+
|
166 |
+
@staticmethod
|
167 |
+
def _get_filepath(dl_dir, round, subset, split):
|
168 |
+
round_details = _ROUND_DETAILS[round]
|
169 |
+
return os.path.join(dl_dir, round_details.data_subset_map[subset]["dir"], split + ".json")
|
170 |
+
|
171 |
+
def _split_generators(self, dl_manager):
|
172 |
+
round_details = _ROUND_DETAILS[self.config.round]
|
173 |
+
dl_dir = dl_manager.download_and_extract(round_details.data_url)
|
174 |
+
|
175 |
+
return [
|
176 |
+
datasets.SplitGenerator(
|
177 |
+
name=datasets.Split.TRAIN,
|
178 |
+
gen_kwargs={
|
179 |
+
"filepath": self._get_filepath(dl_dir, self.config.round, self.config.subset, "train"),
|
180 |
+
"split": "train",
|
181 |
+
"round": self.config.round,
|
182 |
+
"subset": self.config.subset,
|
183 |
+
"model_in_the_loop": round_details.data_subset_map[self.config.subset]["model"],
|
184 |
+
},
|
185 |
+
),
|
186 |
+
datasets.SplitGenerator(
|
187 |
+
name=datasets.Split.VALIDATION,
|
188 |
+
gen_kwargs={
|
189 |
+
"filepath": self._get_filepath(dl_dir, self.config.round, self.config.subset, "dev"),
|
190 |
+
"split": "validation",
|
191 |
+
"round": self.config.round,
|
192 |
+
"subset": self.config.subset,
|
193 |
+
"model_in_the_loop": round_details.data_subset_map[self.config.subset]["model"],
|
194 |
+
},
|
195 |
+
),
|
196 |
+
datasets.SplitGenerator(
|
197 |
+
name=datasets.Split.TEST,
|
198 |
+
gen_kwargs={
|
199 |
+
"filepath": self._get_filepath(dl_dir, self.config.round, self.config.subset, "test"),
|
200 |
+
"split": "test",
|
201 |
+
"round": self.config.round,
|
202 |
+
"subset": self.config.subset,
|
203 |
+
"model_in_the_loop": round_details.data_subset_map[self.config.subset]["model"],
|
204 |
+
},
|
205 |
+
),
|
206 |
+
]
|
207 |
+
|
208 |
+
def _generate_examples(self, filepath, split, round, subset, model_in_the_loop):
|
209 |
+
"""This function returns the examples in the raw (text) form."""
|
210 |
+
logger.info("generating examples from = %s", filepath)
|
211 |
+
with open(filepath, encoding="utf-8") as f:
|
212 |
+
squad = json.load(f)
|
213 |
+
for article in squad["data"]:
|
214 |
+
title = article.get("title", "").strip()
|
215 |
+
for paragraph in article["paragraphs"]:
|
216 |
+
context = paragraph["context"].strip()
|
217 |
+
for qa in paragraph["qas"]:
|
218 |
+
question = qa["question"].strip()
|
219 |
+
id_ = qa["id"]
|
220 |
+
|
221 |
+
answer_starts = [answer["answer_start"] for answer in qa["answers"]]
|
222 |
+
answers = [answer["text"].strip() for answer in qa["answers"]]
|
223 |
+
|
224 |
+
# Features currently used are "context", "question", and "answers".
|
225 |
+
# Others are extracted here for the ease of future expansions.
|
226 |
+
yield id_, {
|
227 |
+
"title": title,
|
228 |
+
"context": context,
|
229 |
+
"question": question,
|
230 |
+
"id": id_,
|
231 |
+
"answers": {
|
232 |
+
"answer_start": answer_starts,
|
233 |
+
"text": answers,
|
234 |
+
},
|
235 |
+
"metadata": {
|
236 |
+
"split": split,
|
237 |
+
"round": round,
|
238 |
+
"subset": subset,
|
239 |
+
"model_in_the_loop": model_in_the_loop
|
240 |
+
},
|
241 |
+
}
|