manandey commited on
Commit
4ebd011
1 Parent(s): 72ca7de

Fix bug in choices labels in openbookqa dataset (#4259)

Browse files

* Fix Bug in openbookqa dataset

* fix style

Commit from https://github.com/huggingface/datasets/commit/737a8b16764d5be9ca24f89313429ed2d1f90102

Files changed (2) hide show
  1. dataset_infos.json +1 -1
  2. openbookqa.py +13 -4
dataset_infos.json CHANGED
@@ -1 +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}}
 
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"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "openbookqa", "config_name": "main", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 896034, "num_examples": 4957, "dataset_name": "openbookqa"}, "test": {"name": "test", "num_bytes": 91850, "num_examples": 500, "dataset_name": "openbookqa"}, "validation": {"name": "validation", "num_bytes": 95519, "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, "post_processing_size": null, "dataset_size": 1083403, "size_in_bytes": 2529501}, "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"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "openbookqa", "config_name": "additional", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 896034, "num_examples": 4957, "dataset_name": "openbookqa"}, "test": {"name": "test", "num_bytes": 91850, "num_examples": 500, "dataset_name": "openbookqa"}, "validation": {"name": "validation", "num_bytes": 95519, "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, "post_processing_size": null, "dataset_size": 1083403, "size_in_bytes": 2529501}}
openbookqa.py CHANGED
@@ -42,7 +42,9 @@ class OpenbookqaConfig(datasets.BuilderConfig):
42
 
43
  """
44
 
45
- super(OpenbookqaConfig, self).__init__(version=datasets.Version("1.0.0", ""), **kwargs)
 
 
46
 
47
  self.data_dir = data_dir
48
 
@@ -92,7 +94,10 @@ class Openbookqa(datasets.GeneratorBasedBuilder):
92
  "id": datasets.Value("string"),
93
  "question_stem": datasets.Value("string"),
94
  "choices": datasets.features.Sequence(
95
- {"text": datasets.Value("string"), "label": datasets.Value("string")}
 
 
 
96
  ),
97
  "answerKey": datasets.Value("string"),
98
  }
@@ -157,8 +162,12 @@ class Openbookqa(datasets.GeneratorBasedBuilder):
157
  "id": data["id"],
158
  "question_stem": data["question"]["stem"],
159
  "choices": {
160
- "text": [choice["text"] for choice in data["question"]["choices"]],
161
- "label": [choice["text"] for choice in data["question"]["choices"]],
 
 
 
 
162
  },
163
  "answerKey": data["answerKey"],
164
  }
 
42
 
43
  """
44
 
45
+ super(OpenbookqaConfig, self).__init__(
46
+ version=datasets.Version("1.0.0", ""), **kwargs
47
+ )
48
 
49
  self.data_dir = data_dir
50
 
 
94
  "id": datasets.Value("string"),
95
  "question_stem": datasets.Value("string"),
96
  "choices": datasets.features.Sequence(
97
+ {
98
+ "text": datasets.Value("string"),
99
+ "label": datasets.Value("string"),
100
+ }
101
  ),
102
  "answerKey": datasets.Value("string"),
103
  }
 
162
  "id": data["id"],
163
  "question_stem": data["question"]["stem"],
164
  "choices": {
165
+ "text": [
166
+ choice["text"] for choice in data["question"]["choices"]
167
+ ],
168
+ "label": [
169
+ choice["label"] for choice in data["question"]["choices"]
170
+ ],
171
  },
172
  "answerKey": data["answerKey"],
173
  }