Datasets:
Tasks:
Question Answering
Modalities:
Text
Formats:
parquet
Sub-tasks:
extractive-qa
Languages:
English
Size:
100K - 1M
ArXiv:
License:
Commit ·
a6708a2
1
Parent(s): e117573
Update parquet files
Browse filesFiles changed (14)
- README.mdDeleted-350
- dataset_infos.jsonDeleted-1
- mrqa.pyDeleted-196
- plain_text/mrqa-test.parquetAdded+3
- plain_text/mrqa-train-00000-of-00009.parquetAdded+3
- plain_text/mrqa-train-00001-of-00009.parquetAdded+3
- plain_text/mrqa-train-00002-of-00009.parquetAdded+3
- plain_text/mrqa-train-00003-of-00009.parquetAdded+3
- plain_text/mrqa-train-00004-of-00009.parquetAdded+3
- plain_text/mrqa-train-00005-of-00009.parquetAdded+3
- plain_text/mrqa-train-00006-of-00009.parquetAdded+3
- plain_text/mrqa-train-00007-of-00009.parquetAdded+3
- plain_text/mrqa-train-00008-of-00009.parquetAdded+3
- plain_text/mrqa-validation.parquetAdded+3
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350---annotations_creators:- foundlanguage_creators:- foundlanguage:- enlicense:- unknownmultilinguality:- monolingualsize_categories:- 100K<n<1Msource_datasets:- extended|drop- extended|hotpot_qa- extended|natural_questions- extended|race- extended|search_qa- extended|squad- extended|trivia_qatask_categories:- question-answeringtask_ids:- extractive-qapaperswithcode_id: mrqa-2019pretty_name: MRQA 2019dataset_info: features: - name: subset dtype: string - name: context dtype: string - name: context_tokens sequence: - name: tokens dtype: string - name: offsets dtype: int32 - name: qid dtype: string - name: question dtype: string - name: question_tokens sequence: - name: tokens dtype: string - name: offsets dtype: int32 - name: detected_answers sequence: - name: text dtype: string - name: char_spans sequence: - name: start dtype: int32 - name: end dtype: int32 - name: token_spans sequence: - name: start dtype: int32 - name: end dtype: int32 - name: answers sequence: string config_name: plain_text splits: - name: train num_bytes: 4090681873 num_examples: 516819 - name: test num_bytes: 57712177 num_examples: 9633 - name: validation num_bytes: 484107026 num_examples: 58221 download_size: 1479518355 dataset_size: 4632501076---
# Dataset Card for MRQA 2019
## Table of Contents- [Dataset Description](#dataset-description) - [Dataset Summary](#dataset-summary) - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards) - [Languages](#languages)- [Dataset Structure](#dataset-structure) - [Data Instances](#data-instances) - [Data Fields](#data-fields) - [Data Splits](#data-splits)- [Dataset Creation](#dataset-creation) - [Curation Rationale](#curation-rationale) - [Source Data](#source-data) - [Annotations](#annotations) - [Personal and Sensitive Information](#personal-and-sensitive-information)- [Considerations for Using the Data](#considerations-for-using-the-data) - [Social Impact of Dataset](#social-impact-of-dataset) - [Discussion of Biases](#discussion-of-biases) - [Other Known Limitations](#other-known-limitations)- [Additional Information](#additional-information) - [Dataset Curators](#dataset-curators) - [Licensing Information](#licensing-information) - [Citation Information](#citation-information) - [Contributions](#contributions)
## Dataset Description
- **Homepage:** [MRQA 2019 Shared Task](https://mrqa.github.io/2019/shared.html)- **Repository:** [MRQA 2019 Github repository](https://github.com/mrqa/MRQA-Shared-Task-2019)- **Paper:** [MRQA 2019 Shared Task: Evaluating Generalization in Reading Comprehension](https://arxiv.org/abs/1910.09753)- **Leaderboard:** [Shared task](https://mrqa.github.io/2019/shared.html)- **Point of Contact:** [mrforqa@gmail.com](mrforqa@gmail.com)
### Dataset Summary
The MRQA 2019 Shared Task focuses on generalization in question answering. An effective question answering system should do more than merely interpolate from the training set to answer test examples drawn from the same distribution: it should also be able to extrapolate to out-of-distribution examples — a significantly harder challenge.
The dataset is a collection of 18 existing QA dataset (carefully selected subset of them) and converted to the same format (SQuAD format). Among these 18 datasets, six datasets were made available for training, six datasets were made available for development, and the final six for testing. The dataset is released as part of the MRQA 2019 Shared Task.
### Supported Tasks and Leaderboards
From the official repository:
*The format of the task is extractive question answering. Given a question and context passage, systems must find the word or phrase in the document that best answers the question. While this format is somewhat restrictive, it allows us to leverage many existing datasets, and its simplicity helps us focus on out-of-domain generalization, instead of other important but orthogonal challenges.*
*We have adapted several existing datasets from their original formats and settings to conform to our unified extractive setting. Most notably:*- *We provide only a single, length-limited context.*- *There are no unanswerable or non-span answer questions.*- *All questions have at least one accepted answer that is found exactly in the context.*
*A span is judged to be an exact match if it matches the answer string after performing normalization consistent with the SQuAD dataset. Specifically:*- *The text is uncased.*- *All punctuation is stripped.*- *All articles `{a, an, the}` are removed.*- *All consecutive whitespace markers are compressed to just a single normal space `' '`.*
Answers are evaluated using exact match and token-level F1 metrics. One can refer to the [mrqa_official_eval.py](https://github.com/mrqa/MRQA-Shared-Task-2019/blob/master/mrqa_official_eval.py) for evaluation.
### Languages
The text in the dataset is in English. The associated BCP-47 code is `en`.
## Dataset Structure
### Data Instances
An examples looks like this:```{ 'qid': 'f43c83e38d1e424ea00f8ad3c77ec999', 'subset': 'SQuAD'
'context': 'CBS broadcast Super Bowl 50 in the U.S., and charged an average of $5 million for a 30-second commercial during the game. The Super Bowl 50 halftime show was headlined by the British rock group Coldplay with special guest performers Beyoncé and Bruno Mars, who headlined the Super Bowl XLVII and Super Bowl XLVIII halftime shows, respectively. It was the third-most watched U.S. broadcast ever.', 'context_tokens': { 'offsets': [0, 4, 14, 20, 25, 28, 31, 35, 39, 41, 45, 53, 56, 64, 67, 68, 70, 78, 82, 84, 94, 105, 112, 116, 120, 122, 126, 132, 137, 140, 149, 154, 158, 168, 171, 175, 183, 188, 194, 203, 208, 216, 222, 233, 241, 245, 251, 255, 257, 261, 271, 275, 281, 286, 292, 296, 302, 307, 314, 323, 328, 330, 342, 344, 347, 351, 355, 360, 361, 366, 374, 379, 389, 393], 'tokens': ['CBS', 'broadcast', 'Super', 'Bowl', '50', 'in', 'the', 'U.S.', ',', 'and', 'charged', 'an', 'average', 'of', '$', '5', 'million', 'for', 'a', '30-second', 'commercial', 'during', 'the', 'game', '.', 'The', 'Super', 'Bowl', '50', 'halftime', 'show', 'was', 'headlined', 'by', 'the', 'British', 'rock', 'group', 'Coldplay', 'with', 'special', 'guest', 'performers', 'Beyoncé', 'and', 'Bruno', 'Mars', ',', 'who', 'headlined', 'the', 'Super', 'Bowl', 'XLVII', 'and', 'Super', 'Bowl', 'XLVIII', 'halftime', 'shows', ',', 'respectively', '.', 'It', 'was', 'the', 'third', '-', 'most', 'watched', 'U.S.', 'broadcast', 'ever', '.'] },
'question': "Who was the main performer at this year's halftime show?", 'question_tokens': { 'offsets': [0, 4, 8, 12, 17, 27, 30, 35, 39, 42, 51, 55], 'tokens': ['Who', 'was', 'the', 'main', 'performer', 'at', 'this', 'year', "'s", 'halftime', 'show', '?'] },
'detected_answers': { 'char_spans': [ { 'end': [201], 'start': [194] }, { 'end': [201], 'start': [194] }, { 'end': [201], 'start': [194] } ], 'text': ['Coldplay', 'Coldplay', 'Coldplay'], 'token_spans': [ { 'end': [38], 'start': [38] }, { 'end': [38], 'start': [38] }, { 'end': [38], 'start': [38] } ] },
'answers': ['Coldplay', 'Coldplay', 'Coldplay'],}```
### Data Fields
- `subset`: which of the dataset does this examples come from?- `context`: This is the raw text of the supporting passage. Three special token types have been inserted: `[TLE]` precedes document titles, `[DOC]` denotes document breaks, and `[PAR]` denotes paragraph breaks. The maximum length of the context is 800 tokens.- `context_tokens`: A tokenized version of the supporting passage, using spaCy. Each token is a tuple of the token string and token character offset. The maximum number of tokens is 800. - `tokens`: list of tokens. - `offets`: list of offsets.- `qas`: A list of questions for the given context.- `qid`: A unique identifier for the question. The `qid` is unique across all datasets.- `question`: The raw text of the question.- `question_tokens`: A tokenized version of the question. The tokenizer and token format is the same as for the context. - `tokens`: list of tokens. - `offets`: list of offsets.- `detected_answers`: A list of answer spans for the given question that index into the context. For some datasets these spans have been automatically detected using searching heuristics. The same answer may appear multiple times in the text --- each of these occurrences is recorded. For example, if `42` is the answer, the context `"The answer is 42. 42 is the answer."`, has two occurrences marked. - `text`: The raw text of the detected answer. - `char_spans`: Inclusive (start, end) character spans (indexing into the raw context). - `start`: start (single element) - `end`: end (single element) - `token_spans`: Inclusive (start, end) token spans (indexing into the tokenized context). - `start`: start (single element) - `end`: end (single element)
### Data Splits
**Training data**| Dataset | Number of Examples || :-----: | :------: || [SQuAD](https://arxiv.org/abs/1606.05250) | 86,588 || [NewsQA](https://arxiv.org/abs/1611.09830) | 74,160 || [TriviaQA](https://arxiv.org/abs/1705.03551)| 61,688 || [SearchQA](https://arxiv.org/abs/1704.05179)| 117,384 || [HotpotQA](https://arxiv.org/abs/1809.09600)| 72,928 || [NaturalQuestions](https://ai.google/research/pubs/pub47761)| 104,071 |
**Development data**
This in-domain data may be used for helping develop models.
| Dataset | Examples || :-----: | :------: || [SQuAD](https://arxiv.org/abs/1606.05250) | 10,507 || [NewsQA](https://arxiv.org/abs/1611.09830) | 4,212 || [TriviaQA](https://arxiv.org/abs/1705.03551)| 7,785|| [SearchQA](https://arxiv.org/abs/1704.05179)| 16,980 || [HotpotQA](https://arxiv.org/abs/1809.09600)| 5,904 || [NaturalQuestions](https://ai.google/research/pubs/pub47761)| 12,836 |
**Test data**
The final testing data only contain out-of-domain data.
| Dataset | Examples || :-----: | :------: || [BioASQ](http://bioasq.org/) | 1,504 || [DROP](https://arxiv.org/abs/1903.00161) | 1,503 || [DuoRC](https://arxiv.org/abs/1804.07927)| 1,501 || [RACE](https://arxiv.org/abs/1704.04683) | 674 || [RelationExtraction](https://arxiv.org/abs/1706.04115) | 2,948|| [TextbookQA](http://ai2-website.s3.amazonaws.com/publications/CVPR17_TQA.pdf)| 1,503 |
From the official repository:
***Note:** As previously mentioned, the out-of-domain dataset have been modified from their original settings to fit the unified MRQA Shared Task paradigm. At a high level, the following two major modifications have been made:*
*1. All QA-context pairs are extractive. That is, the answer is selected from the context and not via, e.g., multiple-choice.**2. All contexts are capped at a maximum of `800` tokens. As a result, for longer contexts like Wikipedia articles, we only consider examples where the answer appears in the first `800` tokens.*
*As a result, some splits are harder than the original datasets (e.g., removal of multiple-choice in RACE), while some are easier (e.g., restricted context length in NaturalQuestions --- we use the short answer selection). Thus one should expect different performance ranges if comparing to previous work on these datasets.*
## Dataset Creation
### Curation Rationale
From the official repository:
*Both train and test datasets have the same format described above, but may differ in some of the following ways:*- *Passage distribution: Test examples may involve passages from different sources (e.g., science, news, novels, medical abstracts, etc) with pronounced syntactic and lexical differences.*- *Question distribution: Test examples may emphasize different styles of questions (e.g., entity-centric, relational, other tasks reformulated as QA, etc) which may come from different sources (e.g., crowdworkers, domain experts, exam writers, etc.)*- *Joint distribution: Test examples may vary according to the relationship of the question to the passage (e.g., collected independent vs. dependent of evidence, multi-hop, etc)*
### Source Data
[More Information Needed]
#### Initial Data Collection and Normalization
[More Information Needed]
#### Who are the source language producers?
[More Information Needed]
### Annotations
[More Information Needed]
#### Annotation process
[More Information Needed]
#### Who are the annotators?
[More Information Needed]
### Personal and Sensitive Information
[More Information Needed]
## Considerations for Using the Data
### Social Impact of Dataset
[More Information Needed]
### Discussion of Biases
[More Information Needed]
### Other Known Limitations
[More Information Needed]
## Additional Information
### Dataset Curators
[More Information Needed]
### Licensing Information
Unknown
### Citation Information
```@inproceedings{fisch2019mrqa, title={{MRQA} 2019 Shared Task: Evaluating Generalization in Reading Comprehension}, author={Adam Fisch and Alon Talmor and Robin Jia and Minjoon Seo and Eunsol Choi and Danqi Chen}, booktitle={Proceedings of 2nd Machine Reading for Reading Comprehension (MRQA) Workshop at EMNLP}, year={2019},}```
### Contributions
Thanks to [@jimmycode](https://github.com/jimmycode), [@VictorSanh](https://github.com/VictorSanh) for adding this dataset.1{"plain_text": {"description": "The MRQA 2019 Shared Task focuses on generalization in question answering.\nAn effective question answering system should do more than merely\ninterpolate from the training set to answer test examples drawn\nfrom the same distribution: it should also be able to extrapolate\nto out-of-distribution examples \u2014 a significantly harder challenge.\n\nThe dataset is a collection of 18 existing QA dataset (carefully selected\nsubset of them) and converted to the same format (SQuAD format). Among\nthese 18 datasets, six datasets were made available for training,\nsix datasets were made available for development, and the final six\nfor testing. The dataset is released as part of the MRQA 2019 Shared Task.\n", "citation": "@inproceedings{fisch2019mrqa,\n title={{MRQA} 2019 Shared Task: Evaluating Generalization in Reading Comprehension},\n author={Adam Fisch and Alon Talmor and Robin Jia and Minjoon Seo and Eunsol Choi and Danqi Chen},\n booktitle={Proceedings of 2nd Machine Reading for Reading Comprehension (MRQA) Workshop at EMNLP},\n year={2019},\n}\n", "homepage": "https://mrqa.github.io/2019/shared.html", "license": "Unknwon", "features": {"subset": {"dtype": "string", "id": null, "_type": "Value"}, "context": {"dtype": "string", "id": null, "_type": "Value"}, "context_tokens": {"feature": {"tokens": {"dtype": "string", "id": null, "_type": "Value"}, "offsets": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}, "qid": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "question_tokens": {"feature": {"tokens": {"dtype": "string", "id": null, "_type": "Value"}, "offsets": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}, "detected_answers": {"feature": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "char_spans": {"feature": {"start": {"dtype": "int32", "id": null, "_type": "Value"}, "end": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}, "token_spans": {"feature": {"start": {"dtype": "int32", "id": null, "_type": "Value"}, "end": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "length": -1, "id": null, "_type": "Sequence"}, "answers": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "mrqa", "config_name": "plain_text", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 4090681873, "num_examples": 516819, "dataset_name": "mrqa"}, "test": {"name": "test", "num_bytes": 57712177, "num_examples": 9633, "dataset_name": "mrqa"}, "validation": {"name": "validation", "num_bytes": 484107026, "num_examples": 58221, "dataset_name": "mrqa"}}, "download_checksums": {"https://s3.us-east-2.amazonaws.com/mrqa/release/v2/train/SQuAD.jsonl.gz": {"num_bytes": 27621835, "checksum": "b094703b9c6f740cc2dfd70b3201b833553fcec0c8a522f22c2c6ff82ce2cc78"}, "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/train/NewsQA.jsonl.gz": {"num_bytes": 56451248, "checksum": "f1ccbf2d259ce1094aacde21a53592894248e5778814205dac94f0b086dbe968"}, "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/train/TriviaQA-web.jsonl.gz": {"num_bytes": 356784923, "checksum": "61fad6884370408282ad3ed0b5f25a9e932d9a724b6929ea03ea5344ff0cd3f7"}, "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/train/SearchQA.jsonl.gz": {"num_bytes": 641332495, "checksum": "32cda932667b7b65ab3079a8271d4e5726b4b989d0b862b25c77eb03a661b609"}, "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/train/HotpotQA.jsonl.gz": {"num_bytes": 107394872, "checksum": "3a94712c073dc9f29d88ac149faa01ef9c7c089f97ee25d9cbac39387550825d"}, "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/train/NaturalQuestionsShort.jsonl.gz": {"num_bytes": 116612493, "checksum": "6cdac324664b94b60be3203a077bf361d0bfa68a17af9b71def1186a6958a68c"}, "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/dev/SQuAD.jsonl.gz": {"num_bytes": 3474262, "checksum": "5afa4b088adf297fc29374ddf2d44d974b8837380e2554e62edf258fee5c32ee"}, "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/dev/NewsQA.jsonl.gz": {"num_bytes": 3142984, "checksum": "66bfb10cab2029bbc7d1afaece20c35fac341b1c179d15b70fde22a207f096ae"}, "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/dev/TriviaQA-web.jsonl.gz": {"num_bytes": 44971198, "checksum": "faf8add436de5a5fa81071a4e7190850d7e9a20acc811439e8a127ba8ec25640"}, "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/dev/SearchQA.jsonl.gz": {"num_bytes": 92526612, "checksum": "c84d2cc02cac5aa9d576ce1cd22900e9d75fe8a37bc795901c36cae6ef9e5ff0"}, "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/dev/HotpotQA.jsonl.gz": {"num_bytes": 10029807, "checksum": "43bb9291525d8b59229ba327b67cca42f0a9c23798c455f6fbe813e9979cca84"}, "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/dev/NaturalQuestionsShort.jsonl.gz": {"num_bytes": 10424248, "checksum": "2ba8b2181b520f81b49d62c0e4a23819f33d5dec0e8cf4a623edcda0feb73530"}, "http://participants-area.bioasq.org/MRQA2019/": {"num_bytes": 2666134, "checksum": "d8f237baea33bd0f4a664ef37ccd893cc682fd9458383dc1d1b8eb4685bb9efc"}, "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/dev/DROP.jsonl.gz": {"num_bytes": 592127, "checksum": "3f7b6b8131cd523d4451e98cf24adc53a92519763597261d28ae83f3920849ab"}, "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/dev/DuoRC.ParaphraseRC.jsonl.gz": {"num_bytes": 1197881, "checksum": "aeb8b9a31044be2ba3d62a456d61b2d447ff76dabe6fa77260b6efed0fb4c010"}, "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/dev/RACE.jsonl.gz": {"num_bytes": 1563018, "checksum": "c620ca043c78504ea02d1cef494207c6c76a5e5dedd7976f5fed5eb9724864b8"}, "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/dev/RelationExtraction.jsonl.gz": {"num_bytes": 850817, "checksum": "845668398356208246605fa1f363de63b45848c946d56514edcc8d00d12530ea"}, "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/dev/TextbookQA.jsonl.gz": {"num_bytes": 1881401, "checksum": "1e861f197e739ead1947c60fa0917a02205dd48a559502194d7085ccd8608b64"}}, "download_size": 1479518355, "post_processing_size": null, "dataset_size": 4632501076, "size_in_bytes": 6112019431}}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196# coding=utf-8# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License."""MRQA 2019 Shared task dataset."""
import json
import datasets
_CITATION = """\@inproceedings{fisch2019mrqa, title={{MRQA} 2019 Shared Task: Evaluating Generalization in Reading Comprehension}, author={Adam Fisch and Alon Talmor and Robin Jia and Minjoon Seo and Eunsol Choi and Danqi Chen}, booktitle={Proceedings of 2nd Machine Reading for Reading Comprehension (MRQA) Workshop at EMNLP}, year={2019},}"""
_DESCRIPTION = """\The MRQA 2019 Shared Task focuses on generalization in question answering.An effective question answering system should do more than merelyinterpolate from the training set to answer test examples drawnfrom the same distribution: it should also be able to extrapolateto out-of-distribution examples — a significantly harder challenge.
The dataset is a collection of 18 existing QA dataset (carefully selectedsubset of them) and converted to the same format (SQuAD format). Amongthese 18 datasets, six datasets were made available for training,six datasets were made available for development, and the final sixfor testing. The dataset is released as part of the MRQA 2019 Shared Task."""
_HOMEPAGE = "https://mrqa.github.io/2019/shared.html"
_LICENSE = "Unknwon"
_URLs = { # Train sub-datasets "train+SQuAD": "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/train/SQuAD.jsonl.gz", "train+NewsQA": "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/train/NewsQA.jsonl.gz", "train+TriviaQA": "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/train/TriviaQA-web.jsonl.gz", "train+SearchQA": "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/train/SearchQA.jsonl.gz", "train+HotpotQA": "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/train/HotpotQA.jsonl.gz", "train+NaturalQuestions": "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/train/NaturalQuestionsShort.jsonl.gz", # Validation sub-datasets "validation+SQuAD": "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/dev/SQuAD.jsonl.gz", "validation+NewsQA": "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/dev/NewsQA.jsonl.gz", "validation+TriviaQA": "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/dev/TriviaQA-web.jsonl.gz", "validation+SearchQA": "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/dev/SearchQA.jsonl.gz", "validation+HotpotQA": "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/dev/HotpotQA.jsonl.gz", "validation+NaturalQuestions": "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/dev/NaturalQuestionsShort.jsonl.gz", # Test sub-datasets "test+BioASQ": "http://participants-area.bioasq.org/MRQA2019/", # BioASQ.jsonl.gz "test+DROP": "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/dev/DROP.jsonl.gz", "test+DuoRC": "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/dev/DuoRC.ParaphraseRC.jsonl.gz", "test+RACE": "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/dev/RACE.jsonl.gz", "test+RelationExtraction": "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/dev/RelationExtraction.jsonl.gz", "test+TextbookQA": "https://s3.us-east-2.amazonaws.com/mrqa/release/v2/dev/TextbookQA.jsonl.gz",}
class Mrqa(datasets.GeneratorBasedBuilder): """MRQA 2019 Shared task dataset."""
VERSION = datasets.Version("1.1.0")
BUILDER_CONFIGS = [ datasets.BuilderConfig(name="plain_text", description="Plain text", version=VERSION), ]
def _info(self): return datasets.DatasetInfo( description=_DESCRIPTION, # Format is derived from https://github.com/mrqa/MRQA-Shared-Task-2019#mrqa-format features=datasets.Features( { "subset": datasets.Value("string"), "context": datasets.Value("string"), "context_tokens": datasets.Sequence( { "tokens": datasets.Value("string"), "offsets": datasets.Value("int32"), } ), "qid": datasets.Value("string"), "question": datasets.Value("string"), "question_tokens": datasets.Sequence( { "tokens": datasets.Value("string"), "offsets": datasets.Value("int32"), } ), "detected_answers": datasets.Sequence( { "text": datasets.Value("string"), "char_spans": datasets.Sequence( { "start": datasets.Value("int32"), "end": datasets.Value("int32"), } ), "token_spans": datasets.Sequence( { "start": datasets.Value("int32"), "end": datasets.Value("int32"), } ), } ), "answers": datasets.Sequence(datasets.Value("string")), } ), supervised_keys=None, homepage=_HOMEPAGE, license=_LICENSE, citation=_CITATION, )
def _split_generators(self, dl_manager): """Returns SplitGenerators.""" data_dir = dl_manager.download_and_extract(_URLs)
return [ datasets.SplitGenerator( name=datasets.Split.TRAIN, gen_kwargs={ "filepaths_dict": data_dir, "split": "train", }, ), datasets.SplitGenerator( name=datasets.Split.TEST, gen_kwargs={ "filepaths_dict": data_dir, "split": "test", }, ), datasets.SplitGenerator( name=datasets.Split.VALIDATION, gen_kwargs={ "filepaths_dict": data_dir, "split": "validation", }, ), ]
def _generate_examples(self, filepaths_dict, split): """Yields examples.""" for source, filepath in filepaths_dict.items(): if split not in source: continue with open(filepath, encoding="utf-8") as f: header = next(f) subset = json.loads(header)["header"]["dataset"]
for row in f: paragraph = json.loads(row) context = paragraph["context"].strip() context_tokens = [{"tokens": t[0], "offsets": t[1]} for t in paragraph["context_tokens"]] for qa in paragraph["qas"]: qid = qa["qid"] question = qa["question"].strip() question_tokens = [{"tokens": t[0], "offsets": t[1]} for t in qa["question_tokens"]] detected_answers = [] for detect_ans in qa["detected_answers"]: detected_answers.append( { "text": detect_ans["text"].strip(), "char_spans": [{"start": t[0], "end": t[1]} for t in detect_ans["char_spans"]], "token_spans": [{"start": t[0], "end": t[1]} for t in detect_ans["token_spans"]], } ) answers = qa["answers"] yield f"{source}_{qid}", { "subset": subset, "context": context, "context_tokens": context_tokens, "qid": qid, "question": question, "question_tokens": question_tokens, "detected_answers": detected_answers, "answers": answers, }123version https://git-lfs.github.com/spec/v1oid sha256:be1697aab16c376b78f9d3b0d02330cbc2da6451357dca37e58200afcff71837size 15483097123version https://git-lfs.github.com/spec/v1oid sha256:28d6d0bf627ed5eaba5204faf0615f55d225f0b60245e7525441f3cd7083fe2bsize 115781028123version https://git-lfs.github.com/spec/v1oid sha256:4420fa6562cd57c5cd7fc0ca36246bfb480472de0f8d534b8f2a9bbaab84c59asize 106226427123version https://git-lfs.github.com/spec/v1oid sha256:bf3518e80b0ff9f5ba3155b747e47d21c3201c70090528294f7af8b2784d5724size 202356638123version https://git-lfs.github.com/spec/v1oid sha256:78c49ffcb7cc7be757b121b7599f1af124ea24068b16d0df72f3930171d28e14size 205250930123version https://git-lfs.github.com/spec/v1oid sha256:95a92bbdc8ca3bfbd701bc643c7954974c5d069d207ea30334196645f99a6f2bsize 201615529123version https://git-lfs.github.com/spec/v1oid sha256:39968e54c41e2b047e4a9993be8ae9d1e3c466f5b24966cd4ff0f0c32c5f4d08size 201844010123version https://git-lfs.github.com/spec/v1oid sha256:1c4752955c7a43f0867025f0d5d95380b2cbfb8a05bc0e900849447f7088ee9esize 201938055123version https://git-lfs.github.com/spec/v1oid sha256:a24dfa05d9f0ed8630356595f00b31efdfeea2e43cf8b91d45a3f73980ba6161size 218428819123version https://git-lfs.github.com/spec/v1oid sha256:50d788b3ca661a9142368d3f63d625c537ff70d4b37f8b0a0ab1446766fd9323size 30638073123version https://git-lfs.github.com/spec/v1oid sha256:ee89ed57e2257f6d46a21d1e71cc4caa5a6bc25d91691e2c870810b8a71bd5b3size 177544050README.mdDeleted-350
dataset_infos.jsonDeleted-1
mrqa.pyDeleted-196
plain_text/mrqa-test.parquetAdded+3
plain_text/mrqa-train-00000-of-00009.parquetAdded+3
plain_text/mrqa-train-00001-of-00009.parquetAdded+3
plain_text/mrqa-train-00002-of-00009.parquetAdded+3
plain_text/mrqa-train-00003-of-00009.parquetAdded+3
plain_text/mrqa-train-00004-of-00009.parquetAdded+3
plain_text/mrqa-train-00005-of-00009.parquetAdded+3
plain_text/mrqa-train-00006-of-00009.parquetAdded+3
plain_text/mrqa-train-00007-of-00009.parquetAdded+3
plain_text/mrqa-train-00008-of-00009.parquetAdded+3
plain_text/mrqa-validation.parquetAdded+3