Datasets:
tau
/

Modalities:
Text
Formats:
parquet
Languages:
English
ArXiv:
Libraries:
Datasets
pandas
License:
albertvillanova HF staff commited on
Commit
d902145
1 Parent(s): 698ee26

Add missing features to commonsense_qa dataset (#4280)

Browse files

* Fix homepage URL

* Clean code

* Add missing features

* Update metadata

* Fix dataset card tags

* Update dummy data

* Fix style

Commit from https://github.com/huggingface/datasets/commit/bc55315c2ab708cbe295e990160cd2bb7eefaccc

README.md CHANGED
@@ -1,13 +1,30 @@
1
  ---
 
 
 
 
2
  languages:
3
  - en
4
- paperswithcode_id: commonsenseqa
 
 
 
5
  pretty_name: CommonsenseQA
 
 
 
 
 
 
 
 
 
6
  ---
7
 
8
  # Dataset Card for "commonsense_qa"
9
 
10
  ## Table of Contents
 
11
  - [Dataset Description](#dataset-description)
12
  - [Dataset Summary](#dataset-summary)
13
  - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
@@ -33,9 +50,9 @@ pretty_name: CommonsenseQA
33
 
34
  ## Dataset Description
35
 
36
- - **Homepage:** [https://www.tau-nlp.org/commonsenseqa](https://www.tau-nlp.org/commonsenseqa)
37
- - **Repository:** [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
38
- - **Paper:** [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
39
  - **Point of Contact:** [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
40
  - **Size of downloaded dataset files:** 4.46 MB
41
  - **Size of the generated dataset:** 2.08 MB
@@ -44,9 +61,9 @@ pretty_name: CommonsenseQA
44
  ### Dataset Summary
45
 
46
  CommonsenseQA is a new multiple-choice question answering dataset that requires different types of commonsense knowledge
47
- to predict the correct answers . It contains 12,102 questions with one correct answer and four distractor answers.
48
- The dataset is provided in two major training/validation/testing set splits: "Random split" which is the main evaluation
49
- split, and "Question token split", see paper for details.
50
 
51
  ### Supported Tasks and Leaderboards
52
 
@@ -54,7 +71,7 @@ CommonsenseQA is a new multiple-choice question answering dataset that requires
54
 
55
  ### Languages
56
 
57
- [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
58
 
59
  ## Dataset Structure
60
 
@@ -66,16 +83,14 @@ CommonsenseQA is a new multiple-choice question answering dataset that requires
66
  - **Size of the generated dataset:** 2.08 MB
67
  - **Total amount of disk used:** 6.54 MB
68
 
69
- An example of 'train' looks as follows.
70
  ```
71
- {
72
- "answerKey": "B",
73
- "choices": {
74
- "label": ["A", "B", "C", "D", "E"],
75
- "text": ["mildred's coffee shop", "mexico", "diner", "kitchen", "canteen"]
76
- },
77
- "question": "In what Spanish speaking North American country can you get a great cup of coffee?"
78
- }
79
  ```
80
 
81
  ### Data Fields
@@ -83,17 +98,19 @@ An example of 'train' looks as follows.
83
  The data fields are the same among all splits.
84
 
85
  #### default
86
- - `answerKey`: a `string` feature.
87
  - `question`: a `string` feature.
 
88
  - `choices`: a dictionary feature containing:
89
  - `label`: a `string` feature.
90
  - `text`: a `string` feature.
 
91
 
92
  ### Data Splits
93
 
94
- | name |train|validation|test|
95
- |-------|----:|---------:|---:|
96
- |default| 9741| 1221|1140|
97
 
98
  ## Dataset Creation
99
 
@@ -147,20 +164,31 @@ The data fields are the same among all splits.
147
 
148
  ### Licensing Information
149
 
150
- [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
151
 
152
  ### Citation Information
153
 
154
  ```
155
- @InProceedings{commonsense_QA,
156
- title={COMMONSENSEQA: A Question Answering Challenge Targeting Commonsense Knowledge},
157
- author={Alon, Talmor and Jonathan, Herzig and Nicholas, Lourie and Jonathan ,Berant},
158
- journal={arXiv preprint arXiv:1811.00937v2},
159
- year={2019}
160
-
 
 
 
 
 
 
 
 
 
 
 
 
161
  ```
162
 
163
-
164
  ### Contributions
165
 
166
  Thanks to [@thomwolf](https://github.com/thomwolf), [@lewtun](https://github.com/lewtun), [@albertvillanova](https://github.com/albertvillanova), [@patrickvonplaten](https://github.com/patrickvonplaten) for adding this dataset.
 
1
  ---
2
+ annotations_creators:
3
+ - crowdsourced
4
+ language_creators:
5
+ - crowdsourced
6
  languages:
7
  - en
8
+ licenses:
9
+ - unknown
10
+ multilinguality:
11
+ - monolingual
12
  pretty_name: CommonsenseQA
13
+ size_categories:
14
+ - 1K<n<10K
15
+ source_datasets:
16
+ - original
17
+ task_categories:
18
+ - question-answering
19
+ task_ids:
20
+ - open-domain-qa
21
+ paperswithcode_id: commonsenseqa
22
  ---
23
 
24
  # Dataset Card for "commonsense_qa"
25
 
26
  ## Table of Contents
27
+ - [Table of Contents](#table-of-contents)
28
  - [Dataset Description](#dataset-description)
29
  - [Dataset Summary](#dataset-summary)
30
  - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
 
50
 
51
  ## Dataset Description
52
 
53
+ - **Homepage:** https://www.tau-nlp.org/commonsenseqa
54
+ - **Repository:** https://github.com/jonathanherzig/commonsenseqa
55
+ - **Paper:** https://arxiv.org/abs/1811.00937
56
  - **Point of Contact:** [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
57
  - **Size of downloaded dataset files:** 4.46 MB
58
  - **Size of the generated dataset:** 2.08 MB
 
61
  ### Dataset Summary
62
 
63
  CommonsenseQA is a new multiple-choice question answering dataset that requires different types of commonsense knowledge
64
+ to predict the correct answers . It contains 12,102 questions with one correct answer and four distractor answers.
65
+ The dataset is provided in two major training/validation/testing set splits: "Random split" which is the main evaluation
66
+ split, and "Question token split", see paper for details.
67
 
68
  ### Supported Tasks and Leaderboards
69
 
 
71
 
72
  ### Languages
73
 
74
+ The dataset is in English (`en`).
75
 
76
  ## Dataset Structure
77
 
 
83
  - **Size of the generated dataset:** 2.08 MB
84
  - **Total amount of disk used:** 6.54 MB
85
 
86
+ An example of 'train' looks as follows:
87
  ```
88
+ {'id': '075e483d21c29a511267ef62bedc0461',
89
+ 'question': 'The sanctions against the school were a punishing blow, and they seemed to what the efforts the school had made to change?',
90
+ 'question_concept': 'punishing',
91
+ 'choices': {'label': ['A', 'B', 'C', 'D', 'E'],
92
+ 'text': ['ignore', 'enforce', 'authoritarian', 'yell at', 'avoid']},
93
+ 'answerKey': 'A'}
 
 
94
  ```
95
 
96
  ### Data Fields
 
98
  The data fields are the same among all splits.
99
 
100
  #### default
101
+ - `id` (`str`): Unique ID.
102
  - `question`: a `string` feature.
103
+ - `question_concept` (`str`): ConceptNet concept associated to the question.
104
  - `choices`: a dictionary feature containing:
105
  - `label`: a `string` feature.
106
  - `text`: a `string` feature.
107
+ - `answerKey`: a `string` feature.
108
 
109
  ### Data Splits
110
 
111
+ | name | train | validation | test |
112
+ |---------|------:|-----------:|-----:|
113
+ | default | 9741 | 1221 | 1140 |
114
 
115
  ## Dataset Creation
116
 
 
164
 
165
  ### Licensing Information
166
 
167
+ Unknown.
168
 
169
  ### Citation Information
170
 
171
  ```
172
+ @inproceedings{talmor-etal-2019-commonsenseqa,
173
+ title = "{C}ommonsense{QA}: A Question Answering Challenge Targeting Commonsense Knowledge",
174
+ author = "Talmor, Alon and
175
+ Herzig, Jonathan and
176
+ Lourie, Nicholas and
177
+ Berant, Jonathan",
178
+ booktitle = "Proceedings of the 2019 Conference of the North {A}merican Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers)",
179
+ month = jun,
180
+ year = "2019",
181
+ address = "Minneapolis, Minnesota",
182
+ publisher = "Association for Computational Linguistics",
183
+ url = "https://aclanthology.org/N19-1421",
184
+ doi = "10.18653/v1/N19-1421",
185
+ pages = "4149--4158",
186
+ archivePrefix = "arXiv",
187
+ eprint = "1811.00937",
188
+ primaryClass = "cs",
189
+ }
190
  ```
191
 
 
192
  ### Contributions
193
 
194
  Thanks to [@thomwolf](https://github.com/thomwolf), [@lewtun](https://github.com/lewtun), [@albertvillanova](https://github.com/albertvillanova), [@patrickvonplaten](https://github.com/patrickvonplaten) for adding this dataset.
commonsense_qa.py CHANGED
@@ -1,4 +1,4 @@
1
- """TODO(commonsense_qa): Add a description here."""
2
 
3
 
4
  import json
@@ -6,111 +6,97 @@ import json
6
  import datasets
7
 
8
 
9
- # TODO(commonsense_qa): BibTeX citation
10
- _CITATION = """\
11
- @InProceedings{commonsense_QA,
12
- title={COMMONSENSEQA: A Question Answering Challenge Targeting Commonsense Knowledge},
13
- author={Alon, Talmor and Jonathan, Herzig and Nicholas, Lourie and Jonathan ,Berant},
14
- journal={arXiv preprint arXiv:1811.00937v2},
15
- year={2019}
16
-
17
- """
18
 
19
- # TODO(commonsense_qa):
20
  _DESCRIPTION = """\
21
  CommonsenseQA is a new multiple-choice question answering dataset that requires different types of commonsense knowledge
22
- to predict the correct answers . It contains 12,102 questions with one correct answer and four distractor answers.
23
- The dataset is provided in two major training/validation/testing set splits: "Random split" which is the main evaluation
24
- split, and "Question token split", see paper for details.
25
  """
26
 
27
- _URL = "https://s3.amazonaws.com/commensenseqa/"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  _URLS = {
29
- "train": _URL + "train_rand_split.jsonl",
30
- "dev": _URL + "dev_rand_split.jsonl",
31
- "test": _URL + "test_rand_split_no_answers.jsonl",
32
  }
33
 
34
 
35
  class CommonsenseQa(datasets.GeneratorBasedBuilder):
36
- """TODO(commonsense_qa): Short description of my dataset."""
37
 
38
- # TODO(commonsense_qa): Set up version.
39
- VERSION = datasets.Version("0.1.0")
40
 
41
  def _info(self):
42
- # These are the features of your dataset like images, labels ...
43
  features = datasets.Features(
44
  {
45
- "answerKey": datasets.Value("string"),
46
  "question": datasets.Value("string"),
 
47
  "choices": datasets.features.Sequence(
48
  {
49
  "label": datasets.Value("string"),
50
  "text": datasets.Value("string"),
51
  }
52
  ),
 
53
  }
54
  )
55
  return datasets.DatasetInfo(
56
- # This is the description that will appear on the datasets page.
57
  description=_DESCRIPTION,
58
- # datasets.features.FeatureConnectors
59
  features=features,
60
- # If there's a common (input, target) tuple from the features,
61
- # specify them here. They'll be used if as_supervised=True in
62
- # builder.as_dataset.
63
- supervised_keys=None,
64
- # Homepage of the dataset for documentation
65
- homepage="https://www.tau-datasets.org/commonsenseqa",
66
  citation=_CITATION,
67
  )
68
 
69
  def _split_generators(self, dl_manager):
70
  """Returns SplitGenerators."""
71
-
72
- download_urls = _URLS
73
-
74
- downloaded_files = dl_manager.download_and_extract(download_urls)
75
-
76
  return [
77
  datasets.SplitGenerator(
78
- name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"], "split": "train"}
79
- ),
80
- datasets.SplitGenerator(
81
- name=datasets.Split.VALIDATION,
82
  gen_kwargs={
83
- "filepath": downloaded_files["dev"],
84
- "split": "dev",
85
  },
86
- ),
87
- datasets.SplitGenerator(
88
- name=datasets.Split.TEST,
89
- gen_kwargs={
90
- "filepath": downloaded_files["test"],
91
- "split": "test",
92
- },
93
- ),
94
  ]
95
 
96
- def _generate_examples(self, filepath, split):
97
  """Yields examples."""
98
- # TODO(commonsense_qa): Yields (key, example) tuples from the dataset
99
  with open(filepath, encoding="utf-8") as f:
100
- for id_, row in enumerate(f):
101
  data = json.loads(row)
102
- question = data["question"]
103
- choices = question["choices"]
104
  labels = [label["label"] for label in choices]
105
  texts = [text["text"] for text in choices]
106
- stem = question["stem"]
107
- if split == "test":
108
- answerkey = ""
109
- else:
110
- answerkey = data["answerKey"]
111
-
112
- yield id_, {
113
- "answerKey": answerkey,
114
- "question": stem,
115
  "choices": {"label": labels, "text": texts},
 
116
  }
 
1
+ """CommonsenseQA dataset."""
2
 
3
 
4
  import json
 
6
  import datasets
7
 
8
 
9
+ _HOMEPAGE = "https://www.tau-nlp.org/commonsenseqa"
 
 
 
 
 
 
 
 
10
 
 
11
  _DESCRIPTION = """\
12
  CommonsenseQA is a new multiple-choice question answering dataset that requires different types of commonsense knowledge
13
+ to predict the correct answers . It contains 12,102 questions with one correct answer and four distractor answers.
14
+ The dataset is provided in two major training/validation/testing set splits: "Random split" which is the main evaluation
15
+ split, and "Question token split", see paper for details.
16
  """
17
 
18
+ _CITATION = """\
19
+ @inproceedings{talmor-etal-2019-commonsenseqa,
20
+ title = "{C}ommonsense{QA}: A Question Answering Challenge Targeting Commonsense Knowledge",
21
+ author = "Talmor, Alon and
22
+ Herzig, Jonathan and
23
+ Lourie, Nicholas and
24
+ Berant, Jonathan",
25
+ booktitle = "Proceedings of the 2019 Conference of the North {A}merican Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers)",
26
+ month = jun,
27
+ year = "2019",
28
+ address = "Minneapolis, Minnesota",
29
+ publisher = "Association for Computational Linguistics",
30
+ url = "https://aclanthology.org/N19-1421",
31
+ doi = "10.18653/v1/N19-1421",
32
+ pages = "4149--4158",
33
+ archivePrefix = "arXiv",
34
+ eprint = "1811.00937",
35
+ primaryClass = "cs",
36
+ }
37
+ """
38
+
39
+ _URL = "https://s3.amazonaws.com/commensenseqa"
40
  _URLS = {
41
+ "train": f"{_URL}/train_rand_split.jsonl",
42
+ "validation": f"{_URL}/dev_rand_split.jsonl",
43
+ "test": f"{_URL}/test_rand_split_no_answers.jsonl",
44
  }
45
 
46
 
47
  class CommonsenseQa(datasets.GeneratorBasedBuilder):
48
+ """CommonsenseQA dataset."""
49
 
50
+ VERSION = datasets.Version("1.0.0")
 
51
 
52
  def _info(self):
 
53
  features = datasets.Features(
54
  {
55
+ "id": datasets.Value("string"),
56
  "question": datasets.Value("string"),
57
+ "question_concept": datasets.Value("string"),
58
  "choices": datasets.features.Sequence(
59
  {
60
  "label": datasets.Value("string"),
61
  "text": datasets.Value("string"),
62
  }
63
  ),
64
+ "answerKey": datasets.Value("string"),
65
  }
66
  )
67
  return datasets.DatasetInfo(
 
68
  description=_DESCRIPTION,
 
69
  features=features,
70
+ homepage=_HOMEPAGE,
 
 
 
 
 
71
  citation=_CITATION,
72
  )
73
 
74
  def _split_generators(self, dl_manager):
75
  """Returns SplitGenerators."""
76
+ filepaths = dl_manager.download_and_extract(_URLS)
77
+ splits = [datasets.Split.TRAIN, datasets.Split.VALIDATION, datasets.Split.TEST]
 
 
 
78
  return [
79
  datasets.SplitGenerator(
80
+ name=split,
 
 
 
81
  gen_kwargs={
82
+ "filepath": filepaths[split],
 
83
  },
84
+ )
85
+ for split in splits
 
 
 
 
 
 
86
  ]
87
 
88
+ def _generate_examples(self, filepath):
89
  """Yields examples."""
 
90
  with open(filepath, encoding="utf-8") as f:
91
+ for uid, row in enumerate(f):
92
  data = json.loads(row)
93
+ choices = data["question"]["choices"]
 
94
  labels = [label["label"] for label in choices]
95
  texts = [text["text"] for text in choices]
96
+ yield uid, {
97
+ "id": data["id"],
98
+ "question": data["question"]["stem"],
99
+ "question_concept": data["question"]["question_concept"],
 
 
 
 
 
100
  "choices": {"label": labels, "text": texts},
101
+ "answerKey": data.get("answerKey", ""),
102
  }
dataset_infos.json CHANGED
@@ -1 +1 @@
1
- {"default": {"description": "CommonsenseQA is a new multiple-choice question answering dataset that requires different types of commonsense knowledge\n to predict the correct answers . It contains 12,102 questions with one correct answer and four distractor answers.\n The dataset is provided in two major training/validation/testing set splits: \"Random split\" which is the main evaluation\n split, and \"Question token split\", see paper for details.\n", "citation": "@InProceedings{commonsense_QA,\ntitle={COMMONSENSEQA: A Question Answering Challenge Targeting Commonsense Knowledge},\nauthor={Alon, Talmor and Jonathan, Herzig and Nicholas, Lourie and Jonathan ,Berant},\njournal={arXiv preprint arXiv:1811.00937v2},\nyear={2019}\n\n", "homepage": "https://www.tau-nlp.org/commonsenseqa", "license": "", "features": {"answerKey": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "choices": {"feature": {"label": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "supervised_keys": null, "builder_name": "commonsense_qa", "config_name": "default", "version": {"version_str": "0.1.0", "description": null, "datasets_version_to_prepare": null, "major": 0, "minor": 1, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 205066, "num_examples": 1140, "dataset_name": "commonsense_qa"}, "train": {"name": "train", "num_bytes": 1755851, "num_examples": 9741, "dataset_name": "commonsense_qa"}, "validation": {"name": "validation", "num_bytes": 217503, "num_examples": 1221, "dataset_name": "commonsense_qa"}}, "download_checksums": {"https://s3.amazonaws.com/commensenseqa/train_rand_split.jsonl": {"num_bytes": 3785890, "checksum": "58ffa3c8472410e24b8c43f423d89c8a003d8284698a6ed7874355dedd09a2fb"}, "https://s3.amazonaws.com/commensenseqa/test_rand_split_no_answers.jsonl": {"num_bytes": 423148, "checksum": "b426896d71a9cd064cf01cfaf6e920817c51701ef66028883ac1af2e73ad5f29"}, "https://s3.amazonaws.com/commensenseqa/dev_rand_split.jsonl": {"num_bytes": 471653, "checksum": "3210497fdaae614ac085d9eb873dd7f4d49b6f965a93adadc803e1229fd8a02a"}}, "download_size": 4680691, "dataset_size": 2178420, "size_in_bytes": 6859111}}
 
1
+ {"default": {"description": "CommonsenseQA is a new multiple-choice question answering dataset that requires different types of commonsense knowledge\nto predict the correct answers . It contains 12,102 questions with one correct answer and four distractor answers.\nThe dataset is provided in two major training/validation/testing set splits: \"Random split\" which is the main evaluation\nsplit, and \"Question token split\", see paper for details.\n", "citation": "@inproceedings{talmor-etal-2019-commonsenseqa,\n title = \"{C}ommonsense{QA}: A Question Answering Challenge Targeting Commonsense Knowledge\",\n author = \"Talmor, Alon and\n Herzig, Jonathan and\n Lourie, Nicholas and\n Berant, Jonathan\",\n booktitle = \"Proceedings of the 2019 Conference of the North {A}merican Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers)\",\n month = jun,\n year = \"2019\",\n address = \"Minneapolis, Minnesota\",\n publisher = \"Association for Computational Linguistics\",\n url = \"https://aclanthology.org/N19-1421\",\n doi = \"10.18653/v1/N19-1421\",\n pages = \"4149--4158\",\n archivePrefix = \"arXiv\",\n eprint = \"1811.00937\",\n primaryClass = \"cs\",\n}\n", "homepage": "https://www.tau-nlp.org/commonsenseqa", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "question_concept": {"dtype": "string", "id": null, "_type": "Value"}, "choices": {"feature": {"label": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"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": "commonsense_qa", "config_name": "default", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 2209044, "num_examples": 9741, "dataset_name": "commonsense_qa"}, "validation": {"name": "validation", "num_bytes": 274033, "num_examples": 1221, "dataset_name": "commonsense_qa"}, "test": {"name": "test", "num_bytes": 258017, "num_examples": 1140, "dataset_name": "commonsense_qa"}}, "download_checksums": {"https://s3.amazonaws.com/commensenseqa/train_rand_split.jsonl": {"num_bytes": 3785890, "checksum": "58ffa3c8472410e24b8c43f423d89c8a003d8284698a6ed7874355dedd09a2fb"}, "https://s3.amazonaws.com/commensenseqa/dev_rand_split.jsonl": {"num_bytes": 471653, "checksum": "3210497fdaae614ac085d9eb873dd7f4d49b6f965a93adadc803e1229fd8a02a"}, "https://s3.amazonaws.com/commensenseqa/test_rand_split_no_answers.jsonl": {"num_bytes": 423148, "checksum": "b426896d71a9cd064cf01cfaf6e920817c51701ef66028883ac1af2e73ad5f29"}}, "download_size": 4680691, "post_processing_size": null, "dataset_size": 2741094, "size_in_bytes": 7421785}}
dummy/{0.1.0 → 1.0.0}/dummy_data.zip RENAMED
File without changes