Datasets:
Tasks:
Question Answering
Modalities:
Text
Formats:
parquet
Sub-tasks:
extractive-qa
Languages:
English
Size:
100K - 1M
ArXiv:
License:
Convert dataset to Parquet (#6)
Browse files- Convert dataset to Parquet (df02e042b8345d44acdba68b3b268ecf497a9723)
- Delete loading script (241b331d6cea3479dcb46677f87cb3f3fd82008c)
Files changed (13)
- README.md+18-8
- mrqa.pyDeleted-196
- plain_text/test-00000-of-00001.parquetAdded+3
- plain_text/train-00000-of-00009.parquetAdded+3
- plain_text/train-00001-of-00009.parquetAdded+3
- plain_text/train-00002-of-00009.parquetAdded+3
- plain_text/train-00003-of-00009.parquetAdded+3
- plain_text/train-00004-of-00009.parquetAdded+3
- plain_text/train-00005-of-00009.parquetAdded+3
- plain_text/train-00006-of-00009.parquetAdded+3
- plain_text/train-00007-of-00009.parquetAdded+3
- plain_text/train-00008-of-00009.parquetAdded+3
- plain_text/validation-00000-of-00001.parquetAdded+3
25 unmodified lines26272829303133 unmodified lines6566676869707172737475767778798081828325 unmodified linespaperswithcode_id: mrqa-2019pretty_name: MRQA 2019dataset_info:features:- name: subsetdtype: string33 unmodified linesdtype: int32- name: answerssequence: stringconfig_name: plain_textsplits:- name: trainnum_bytes: 4090681873num_examples: 516819- name: testnum_bytes: 57712177num_examples: 9633- name: validationnum_bytes: 484107026num_examples: 58221download_size: 1479518355dataset_size: 4632501076---# Dataset Card for MRQA 201925 unmodified lines2627282930313233 unmodified lines6667686970717273747576777879808182838485868788899091929325 unmodified linespaperswithcode_id: mrqa-2019pretty_name: MRQA 2019dataset_info:config_name: plain_textfeatures:- name: subsetdtype: string33 unmodified linesdtype: int32- name: answerssequence: stringsplits:- name: trainnum_bytes: 4090677713num_examples: 516819- name: validationnum_bytes: 484106546num_examples: 58221- name: testnum_bytes: 57712097num_examples: 9633download_size: 1679161250dataset_size: 4632496356configs:- config_name: plain_textdata_files:- split: trainpath: plain_text/train-*- split: validationpath: plain_text/validation-*- split: testpath: plain_text/test-*default: true---# Dataset Card for MRQA 2019
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:f99b099a4701074612b2b98bb3c937b4e09cc72411d9a8915c6ec51186bbb5a2size 15483098123version https://git-lfs.github.com/spec/v1oid sha256:a7f3bdb15ac4179e7194c5f36e7b90754b2888361c7d5f5024f42bf920e7d76bsize 40937968123version https://git-lfs.github.com/spec/v1oid sha256:ee901275a64a557398407475cc3c9f3c7ad27075939359b8dc649d1800bb63adsize 83288515123version https://git-lfs.github.com/spec/v1oid sha256:153cc1d83cb80b2fec592d2a06bcfd2d37778d0d9e33ecca82eebe0f0dff9012size 168678531123version https://git-lfs.github.com/spec/v1oid sha256:b07c5521698aeaa7620c4595bbfb4dd0c2712d9af4604e4c5a24db055e2efff7size 330623073123version https://git-lfs.github.com/spec/v1oid sha256:d22376ff3475fc42ae3873ef0576a0aa67712c9ca4ceeb1fc7b9e3f07314e504size 313450289123version https://git-lfs.github.com/spec/v1oid sha256:9639612c7bb352b0544376f039810cfb048be63f620f8035f96d65e4fb8516c0size 295803474123version https://git-lfs.github.com/spec/v1oid sha256:de662f1c252d1ce32f075de2ce4c3803e4595a0f9e95d9c38183f1ffc22ae3edsize 96192618123version https://git-lfs.github.com/spec/v1oid sha256:457c4aa13081b48baf58794bbdbbb89463018713498608ab086c2d5427c2798fsize 80208968123version https://git-lfs.github.com/spec/v1oid sha256:064252dd7d9f8c2b83dae571bc608249f45822e649aaef102ad9566e46616a1dsize 76950665123version https://git-lfs.github.com/spec/v1oid sha256:0ebb638a2a152391211fc0b5ea13b635aa694ea8cdbf48999090ede84ab3f85dsize 177544051README.md+18-8
mrqa.pyDeleted-196
plain_text/test-00000-of-00001.parquetAdded+3
plain_text/train-00000-of-00009.parquetAdded+3
plain_text/train-00001-of-00009.parquetAdded+3
plain_text/train-00002-of-00009.parquetAdded+3
plain_text/train-00003-of-00009.parquetAdded+3
plain_text/train-00004-of-00009.parquetAdded+3
plain_text/train-00005-of-00009.parquetAdded+3
plain_text/train-00006-of-00009.parquetAdded+3
plain_text/train-00007-of-00009.parquetAdded+3
plain_text/train-00008-of-00009.parquetAdded+3
plain_text/validation-00000-of-00001.parquetAdded+3