rizquuula commited on
Commit
281786b
1 Parent(s): 5cee903

original copy from `commonsense_qa`

Browse files
Files changed (4) hide show
  1. README.md +222 -1
  2. commonsense_qa.py +102 -0
  3. dataset_infos.json +1 -0
  4. gitattributes.txt +27 -0
README.md CHANGED
@@ -1,3 +1,224 @@
1
  ---
2
- license: mit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ annotations_creators:
3
+ - crowdsourced
4
+ language_creators:
5
+ - crowdsourced
6
+ language:
7
+ - en
8
+ license:
9
+ - mit
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
+ dataset_info:
23
+ features:
24
+ - name: id
25
+ dtype: string
26
+ - name: question
27
+ dtype: string
28
+ - name: question_concept
29
+ dtype: string
30
+ - name: choices
31
+ sequence:
32
+ - name: label
33
+ dtype: string
34
+ - name: text
35
+ dtype: string
36
+ - name: answerKey
37
+ dtype: string
38
+ splits:
39
+ - name: train
40
+ num_bytes: 2209044
41
+ num_examples: 9741
42
+ - name: validation
43
+ num_bytes: 274033
44
+ num_examples: 1221
45
+ - name: test
46
+ num_bytes: 258017
47
+ num_examples: 1140
48
+ download_size: 4680691
49
+ dataset_size: 2741094
50
  ---
51
+
52
+ # Dataset Card for "commonsense_qa"
53
+
54
+ ## Table of Contents
55
+ - [Table of Contents](#table-of-contents)
56
+ - [Dataset Description](#dataset-description)
57
+ - [Dataset Summary](#dataset-summary)
58
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
59
+ - [Languages](#languages)
60
+ - [Dataset Structure](#dataset-structure)
61
+ - [Data Instances](#data-instances)
62
+ - [Data Fields](#data-fields)
63
+ - [Data Splits](#data-splits)
64
+ - [Dataset Creation](#dataset-creation)
65
+ - [Curation Rationale](#curation-rationale)
66
+ - [Source Data](#source-data)
67
+ - [Annotations](#annotations)
68
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
69
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
70
+ - [Social Impact of Dataset](#social-impact-of-dataset)
71
+ - [Discussion of Biases](#discussion-of-biases)
72
+ - [Other Known Limitations](#other-known-limitations)
73
+ - [Additional Information](#additional-information)
74
+ - [Dataset Curators](#dataset-curators)
75
+ - [Licensing Information](#licensing-information)
76
+ - [Citation Information](#citation-information)
77
+ - [Contributions](#contributions)
78
+
79
+ ## Dataset Description
80
+
81
+ - **Homepage:** https://www.tau-nlp.org/commonsenseqa
82
+ - **Repository:** https://github.com/jonathanherzig/commonsenseqa
83
+ - **Paper:** https://arxiv.org/abs/1811.00937
84
+ - **Point of Contact:** [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
85
+ - **Size of downloaded dataset files:** 4.68 MB
86
+ - **Size of the generated dataset:** 2.18 MB
87
+ - **Total amount of disk used:** 6.86 MB
88
+
89
+ ### Dataset Summary
90
+
91
+ CommonsenseQA is a new multiple-choice question answering dataset that requires different types of commonsense knowledge
92
+ to predict the correct answers . It contains 12,102 questions with one correct answer and four distractor answers.
93
+ The dataset is provided in two major training/validation/testing set splits: "Random split" which is the main evaluation
94
+ split, and "Question token split", see paper for details.
95
+
96
+ ### Supported Tasks and Leaderboards
97
+
98
+ [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
99
+
100
+ ### Languages
101
+
102
+ The dataset is in English (`en`).
103
+
104
+ ## Dataset Structure
105
+
106
+ ### Data Instances
107
+
108
+ #### default
109
+
110
+ - **Size of downloaded dataset files:** 4.68 MB
111
+ - **Size of the generated dataset:** 2.18 MB
112
+ - **Total amount of disk used:** 6.86 MB
113
+
114
+ An example of 'train' looks as follows:
115
+ ```
116
+ {'id': '075e483d21c29a511267ef62bedc0461',
117
+ 'question': 'The sanctions against the school were a punishing blow, and they seemed to what the efforts the school had made to change?',
118
+ 'question_concept': 'punishing',
119
+ 'choices': {'label': ['A', 'B', 'C', 'D', 'E'],
120
+ 'text': ['ignore', 'enforce', 'authoritarian', 'yell at', 'avoid']},
121
+ 'answerKey': 'A'}
122
+ ```
123
+
124
+ ### Data Fields
125
+
126
+ The data fields are the same among all splits.
127
+
128
+ #### default
129
+ - `id` (`str`): Unique ID.
130
+ - `question`: a `string` feature.
131
+ - `question_concept` (`str`): ConceptNet concept associated to the question.
132
+ - `choices`: a dictionary feature containing:
133
+ - `label`: a `string` feature.
134
+ - `text`: a `string` feature.
135
+ - `answerKey`: a `string` feature.
136
+
137
+ ### Data Splits
138
+
139
+ | name | train | validation | test |
140
+ |---------|------:|-----------:|-----:|
141
+ | default | 9741 | 1221 | 1140 |
142
+
143
+ ## Dataset Creation
144
+
145
+ ### Curation Rationale
146
+
147
+ [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
148
+
149
+ ### Source Data
150
+
151
+ #### Initial Data Collection and Normalization
152
+
153
+ [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
154
+
155
+ #### Who are the source language producers?
156
+
157
+ [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
158
+
159
+ ### Annotations
160
+
161
+ #### Annotation process
162
+
163
+ [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
164
+
165
+ #### Who are the annotators?
166
+
167
+ [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
168
+
169
+ ### Personal and Sensitive Information
170
+
171
+ [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
172
+
173
+ ## Considerations for Using the Data
174
+
175
+ ### Social Impact of Dataset
176
+
177
+ [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
178
+
179
+ ### Discussion of Biases
180
+
181
+ [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
182
+
183
+ ### Other Known Limitations
184
+
185
+ [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
186
+
187
+ ## Additional Information
188
+
189
+ ### Dataset Curators
190
+
191
+ [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
192
+
193
+ ### Licensing Information
194
+
195
+ The dataset is licensed under the MIT License.
196
+
197
+ See: https://github.com/jonathanherzig/commonsenseqa/issues/5
198
+
199
+ ### Citation Information
200
+
201
+ ```
202
+ @inproceedings{talmor-etal-2019-commonsenseqa,
203
+ title = "{C}ommonsense{QA}: A Question Answering Challenge Targeting Commonsense Knowledge",
204
+ author = "Talmor, Alon and
205
+ Herzig, Jonathan and
206
+ Lourie, Nicholas and
207
+ Berant, Jonathan",
208
+ 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)",
209
+ month = jun,
210
+ year = "2019",
211
+ address = "Minneapolis, Minnesota",
212
+ publisher = "Association for Computational Linguistics",
213
+ url = "https://aclanthology.org/N19-1421",
214
+ doi = "10.18653/v1/N19-1421",
215
+ pages = "4149--4158",
216
+ archivePrefix = "arXiv",
217
+ eprint = "1811.00937",
218
+ primaryClass = "cs",
219
+ }
220
+ ```
221
+
222
+ ### Contributions
223
+
224
+ 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 ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """CommonsenseQA dataset."""
2
+
3
+
4
+ import json
5
+
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 ADDED
@@ -0,0 +1 @@
 
 
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}}
gitattributes.txt ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bin.* filter=lfs diff=lfs merge=lfs -text
5
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.model filter=lfs diff=lfs merge=lfs -text
12
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
13
+ *.onnx filter=lfs diff=lfs merge=lfs -text
14
+ *.ot filter=lfs diff=lfs merge=lfs -text
15
+ *.parquet filter=lfs diff=lfs merge=lfs -text
16
+ *.pb filter=lfs diff=lfs merge=lfs -text
17
+ *.pt filter=lfs diff=lfs merge=lfs -text
18
+ *.pth filter=lfs diff=lfs merge=lfs -text
19
+ *.rar filter=lfs diff=lfs merge=lfs -text
20
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
21
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
22
+ *.tflite filter=lfs diff=lfs merge=lfs -text
23
+ *.tgz filter=lfs diff=lfs merge=lfs -text
24
+ *.xz filter=lfs diff=lfs merge=lfs -text
25
+ *.zip filter=lfs diff=lfs merge=lfs -text
26
+ *.zstandard filter=lfs diff=lfs merge=lfs -text
27
+ *tfevents* filter=lfs diff=lfs merge=lfs -text