system HF staff commited on
Commit
e3d13e5
0 Parent(s):

Update files from the datasets library (from 1.2.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.2.0

.gitattributes 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
README.md ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - crowdsourced
4
+ language_creators:
5
+ - crowdsourced
6
+ languages:
7
+ - en
8
+ licenses:
9
+ - unknown
10
+ multilinguality:
11
+ - monolingual
12
+ size_categories:
13
+ - 10K<n<100K
14
+ source_datasets:
15
+ - original
16
+ task_categories:
17
+ - question-answering
18
+ task_ids:
19
+ - question-answering-other-multihop-tabular-text-qa
20
+ ---
21
+
22
+ # Dataset Card Creation Guide
23
+
24
+ ## Table of Contents
25
+ - [Dataset Description](#dataset-description)
26
+ - [Dataset Summary](#dataset-summary)
27
+ - [Supported Tasks](#supported-tasks-and-leaderboards)
28
+ - [Languages](#languages)
29
+ - [Dataset Structure](#dataset-structure)
30
+ - [Data Instances](#data-instances)
31
+ - [Data Fields](#data-instances)
32
+ - [Data Splits](#data-instances)
33
+ - [Dataset Creation](#dataset-creation)
34
+ - [Curation Rationale](#curation-rationale)
35
+ - [Source Data](#source-data)
36
+ - [Annotations](#annotations)
37
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
38
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
39
+ - [Social Impact of Dataset](#social-impact-of-dataset)
40
+ - [Discussion of Biases](#discussion-of-biases)
41
+ - [Other Known Limitations](#other-known-limitations)
42
+ - [Additional Information](#additional-information)
43
+ - [Dataset Curators](#dataset-curators)
44
+ - [Licensing Information](#licensing-information)
45
+ - [Citation Information](#citation-information)
46
+
47
+ ## Dataset Description
48
+
49
+ - **Homepage:** -
50
+ - **Repository:** [GitHub](https://github.com/wenhuchen/HybridQA)
51
+ - **Paper:** [HybridQA: A Dataset of Multi-Hop Question Answering over Tabular and Textual Data](https://arxiv.org/abs/1909.05358)
52
+ - **Leaderboard:** [HybridQA Competition](https://competitions.codalab.org/competitions/24420)
53
+ - **Point of Contact:** [Wenhu Chen]([email protected])
54
+
55
+
56
+ ### Dataset Summary
57
+
58
+ Existing question answering datasets focus on dealing with homogeneous information, based either only on text or
59
+ KB/Table information alone. However, as human knowledge is distributed over heterogeneous forms,
60
+ using homogeneous information alone might lead to severe coverage problems.
61
+ To fill in the gap, we present HybridQA, a new large-scale question-answering dataset that
62
+ requires reasoning on heterogeneous information. Each question is aligned with a Wikipedia table
63
+ and multiple free-form corpora linked with the entities in the table. The questions are designed
64
+ to aggregate both tabular information and text information, i.e.,
65
+ lack of either form would render the question unanswerable.
66
+
67
+ ### Supported Tasks and Leaderboards
68
+
69
+ [More Information Needed]
70
+
71
+ ### Languages
72
+
73
+ The dataset is in English language.
74
+
75
+ ## Dataset Structure
76
+
77
+ ### Data Instances
78
+
79
+ A typical example looks like this
80
+
81
+ ```
82
+ {
83
+ "question_id": "00009b9649d0dd0a",
84
+ "question": "Who were the builders of the mosque in Herat with fire temples ?",
85
+ "table_id": "List_of_mosques_in_Afghanistan_0",
86
+ "answer_text": "Ghurids",
87
+ "question_postag": "WP VBD DT NNS IN DT NN IN NNP IN NN NNS .",
88
+ "table": {
89
+ "url": "https://en.wikipedia.org/wiki/List_of_mosques_in_Afghanistan",
90
+ "title": "List of mosques in Afghanistan",
91
+ "header": [
92
+ "Name",
93
+ "Province",
94
+ "City",
95
+ "Year",
96
+ "Remarks"
97
+ ],
98
+ "data": [
99
+ {
100
+ "value": "Kabul",
101
+ "urls": [
102
+ {
103
+ "summary": "Kabul ( Persian : کابل , romanized : Kābol , Pashto : کابل , romanized : Kābəl ) is the capital and largest city of Afghanistan...",
104
+ "url": "/wiki/Kabul"
105
+ }
106
+ ]
107
+ }
108
+ ]
109
+ },
110
+ "section_title": "",
111
+ "section_text": "",
112
+ "uid": "List_of_mosques_in_Afghanistan_0",
113
+ "intro": "The following is an incomplete list of large mosques in Afghanistan:"
114
+ }
115
+ ```
116
+
117
+ ### Data Fields
118
+
119
+ [More Information Needed]
120
+
121
+ ### Data Splits
122
+
123
+ The dataset is split into `train`, `dev` and `test` splits.
124
+
125
+ | | Tain | Valid | Test |
126
+ | --------------- | ------ | ----- | ----- |
127
+ | N. Instances | 62682 | 3466 | 3463 |
128
+
129
+
130
+ ## Dataset Creation
131
+
132
+ ### Curation Rationale
133
+
134
+ [More Information Needed]
135
+
136
+ ### Source Data
137
+
138
+ [More Information Needed]
139
+
140
+ #### Initial Data Collection and Normalization
141
+
142
+ [More Information Needed]
143
+
144
+ #### Who are the source language producers?
145
+
146
+ [More Information Needed]
147
+
148
+ ### Annotations
149
+
150
+ [More Information Needed]
151
+
152
+ #### Annotation process
153
+
154
+ [More Information Needed]
155
+
156
+ #### Who are the annotators?
157
+
158
+ [More Information Needed]
159
+
160
+ ### Personal and Sensitive Information
161
+
162
+ [More Information Needed]
163
+
164
+ ## Considerations for Using the Data
165
+
166
+ ### Social Impact of Dataset
167
+
168
+ [More Information Needed]
169
+
170
+ ### Discussion of Biases
171
+
172
+ [More Information Needed]
173
+
174
+ ### Other Known Limitations
175
+
176
+ [More Information Needed]
177
+
178
+ ## Additional Information
179
+
180
+ ### Dataset Curators
181
+
182
+ [More Information Needed]
183
+
184
+ ### Licensing Information
185
+
186
+ [More Information Needed]
187
+
188
+ ### Citation Information
189
+
190
+ [More Information Needed]
191
+ ```
192
+ @article{chen2020hybridqa,
193
+ title={HybridQA: A Dataset of Multi-Hop Question Answering over Tabular and Textual Data},
194
+ author={Chen, Wenhu and Zha, Hanwen and Chen, Zhiyu and Xiong, Wenhan and Wang, Hong and Wang, William},
195
+ journal={Findings of EMNLP 2020},
196
+ year={2020}
197
+ }
198
+ ```
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"hybrid_qa": {"description": "Existing question answering datasets focus on dealing with homogeneous information, based either only on text or KB/Table information alone. However, as human knowledge is distributed over heterogeneous forms, using homogeneous information alone might lead to severe coverage problems. To fill in the gap, we present HybridQA, a new large-scale question-answering dataset that requires reasoning on heterogeneous information. Each question is aligned with a Wikipedia table and multiple free-form corpora linked with the entities in the table. The questions are designed to aggregate both tabular information and text information, i.e., lack of either form would render the question unanswerable.\n", "citation": "@article{chen2020hybridqa,\n title={HybridQA: A Dataset of Multi-Hop Question Answering over Tabular and Textual Data},\n author={Chen, Wenhu and Zha, Hanwen and Chen, Zhiyu and Xiong, Wenhan and Wang, Hong and Wang, William},\n journal={Findings of EMNLP 2020},\n year={2020}\n}\n", "homepage": "https://github.com/wenhuchen/HybridQA", "license": "", "features": {"question_id": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "table_id": {"dtype": "string", "id": null, "_type": "Value"}, "answer_text": {"dtype": "string", "id": null, "_type": "Value"}, "question_postag": {"dtype": "string", "id": null, "_type": "Value"}, "table": {"url": {"dtype": "string", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}, "header": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "data": [{"value": {"dtype": "string", "id": null, "_type": "Value"}, "urls": [{"url": {"dtype": "string", "id": null, "_type": "Value"}, "summary": {"dtype": "string", "id": null, "_type": "Value"}}]}], "section_title": {"dtype": "string", "id": null, "_type": "Value"}, "section_text": {"dtype": "string", "id": null, "_type": "Value"}, "uid": {"dtype": "string", "id": null, "_type": "Value"}, "intro": {"dtype": "string", "id": null, "_type": "Value"}}}, "post_processed": null, "supervised_keys": null, "builder_name": "hybrid_qa", "config_name": "hybrid_qa", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 2745712769, "num_examples": 62682, "dataset_name": "hybrid_qa"}, "validation": {"name": "validation", "num_bytes": 153512016, "num_examples": 3466, "dataset_name": "hybrid_qa"}, "test": {"name": "test", "num_bytes": 148795919, "num_examples": 3463, "dataset_name": "hybrid_qa"}}, "download_checksums": {"https://github.com/wenhuchen/WikiTables-WithLinks/archive/f4ed68e54e25c495f63d309de0b89c0f97b3c508.zip": {"num_bytes": 193533209, "checksum": "8f8f708f485e38a6114cf7d246e6ac00eb6f7705a9e5b740ab2ef499b864da43"}, "https://raw.githubusercontent.com/wenhuchen/HybridQA/master/released_data/train.json": {"num_bytes": 21638585, "checksum": "b33aa73638959a2383e1e1638fd6abe87818b7379c7a42eac1621475d2d959e2"}, "https://raw.githubusercontent.com/wenhuchen/HybridQA/master/released_data/dev.json": {"num_bytes": 1193503, "checksum": "424272b233735a70ed8ef5af4a615373d114f472168c686c4370d54c92d58ac1"}, "https://raw.githubusercontent.com/wenhuchen/HybridQA/master/released_data/test.json": {"num_bytes": 1071558, "checksum": "41845fec9cba21979e663a96626c2880adbf2d26b5667ea7d0bf61fab0cdc356"}}, "download_size": 217436855, "post_processing_size": null, "dataset_size": 3048020704, "size_in_bytes": 3265457559}}
dummy/hybrid_qa/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:93e1ee4d803dbbf2c9302915d50b8fe1b691f7b4fce3727bcc1c270342abfcc8
3
+ size 44090
hybrid_qa.py ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2020 The HuggingFace Datasets Authors.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ """HybridQA: A Dataset of Multi-Hop Question Answering over Tabular and Textual Data"""
16
+
17
+ from __future__ import absolute_import, division, print_function
18
+
19
+ import json
20
+ import os
21
+
22
+ import datasets
23
+
24
+
25
+ _CITATION = """\
26
+ @article{chen2020hybridqa,
27
+ title={HybridQA: A Dataset of Multi-Hop Question Answering over Tabular and Textual Data},
28
+ author={Chen, Wenhu and Zha, Hanwen and Chen, Zhiyu and Xiong, Wenhan and Wang, Hong and Wang, William},
29
+ journal={Findings of EMNLP 2020},
30
+ year={2020}
31
+ }
32
+ """
33
+
34
+ _DESCRIPTION = """\
35
+ Existing question answering datasets focus on dealing with homogeneous information, based either only on text or \
36
+ KB/Table information alone. However, as human knowledge is distributed over heterogeneous forms, \
37
+ using homogeneous information alone might lead to severe coverage problems. \
38
+ To fill in the gap, we present HybridQA, a new large-scale question-answering dataset that \
39
+ requires reasoning on heterogeneous information. Each question is aligned with a Wikipedia table \
40
+ and multiple free-form corpora linked with the entities in the table. The questions are designed \
41
+ to aggregate both tabular information and text information, i.e., \
42
+ lack of either form would render the question unanswerable.
43
+ """
44
+
45
+ _HOMEPAGE = "https://github.com/wenhuchen/HybridQA"
46
+
47
+ _WIKI_TABLES_GIT_ARCHIVE_URL = (
48
+ "https://github.com/wenhuchen/WikiTables-WithLinks/archive/f4ed68e54e25c495f63d309de0b89c0f97b3c508.zip"
49
+ )
50
+
51
+ _QA_DATA_BASE_URL = "https://raw.githubusercontent.com/wenhuchen/HybridQA/master/released_data"
52
+ _URLS = {
53
+ "train": f"{_QA_DATA_BASE_URL}/train.json",
54
+ "dev": f"{_QA_DATA_BASE_URL}/dev.json",
55
+ "test": f"{_QA_DATA_BASE_URL}/test.json",
56
+ }
57
+
58
+
59
+ class HybridQa(datasets.GeneratorBasedBuilder):
60
+ """HybridQA: A Dataset of Multi-Hop Question Answering over Tabular and Textual Data"""
61
+
62
+ VERSION = datasets.Version("1.0.0")
63
+ BUILDER_CONFIGS = [
64
+ datasets.BuilderConfig(
65
+ name="hybrid_qa",
66
+ version=datasets.Version("1.0.0"),
67
+ ),
68
+ ]
69
+
70
+ def _info(self):
71
+ features = {
72
+ "question_id": datasets.Value("string"),
73
+ "question": datasets.Value("string"),
74
+ "table_id": datasets.Value("string"),
75
+ "answer_text": datasets.Value("string"),
76
+ "question_postag": datasets.Value("string"),
77
+ "table": {
78
+ "url": datasets.Value("string"),
79
+ "title": datasets.Value("string"),
80
+ "header": datasets.Sequence(datasets.Value("string")),
81
+ "data": [
82
+ {
83
+ "value": datasets.Value("string"),
84
+ "urls": [{"url": datasets.Value("string"), "summary": datasets.Value("string")}],
85
+ }
86
+ ],
87
+ "section_title": datasets.Value("string"),
88
+ "section_text": datasets.Value("string"),
89
+ "uid": datasets.Value("string"),
90
+ "intro": datasets.Value("string"),
91
+ },
92
+ }
93
+ return datasets.DatasetInfo(
94
+ description=_DESCRIPTION,
95
+ features=datasets.Features(features),
96
+ supervised_keys=None,
97
+ homepage=_HOMEPAGE,
98
+ citation=_CITATION,
99
+ )
100
+
101
+ def _split_generators(self, dl_manager):
102
+ extracted_path = dl_manager.download_and_extract(_WIKI_TABLES_GIT_ARCHIVE_URL)
103
+ downloaded_files = dl_manager.download(_URLS)
104
+
105
+ repo_path = os.path.join(extracted_path, "WikiTables-WithLinks-f4ed68e54e25c495f63d309de0b89c0f97b3c508")
106
+ tables_path = os.path.join(repo_path, "tables_tok")
107
+ requests_path = os.path.join(repo_path, "request_tok")
108
+
109
+ return [
110
+ datasets.SplitGenerator(
111
+ name=datasets.Split.TRAIN,
112
+ gen_kwargs={
113
+ "qa_filepath": downloaded_files["train"],
114
+ "tables_path": tables_path,
115
+ "requests_path": requests_path,
116
+ },
117
+ ),
118
+ datasets.SplitGenerator(
119
+ name=datasets.Split.VALIDATION,
120
+ gen_kwargs={
121
+ "qa_filepath": downloaded_files["dev"],
122
+ "tables_path": tables_path,
123
+ "requests_path": requests_path,
124
+ },
125
+ ),
126
+ datasets.SplitGenerator(
127
+ name=datasets.Split.TEST,
128
+ gen_kwargs={
129
+ "qa_filepath": downloaded_files["test"],
130
+ "tables_path": tables_path,
131
+ "requests_path": requests_path,
132
+ },
133
+ ),
134
+ ]
135
+
136
+ def _generate_examples(self, qa_filepath, tables_path, requests_path):
137
+ with open(qa_filepath, encoding="utf-8") as f:
138
+ examples = json.load(f)
139
+
140
+ for example in examples:
141
+ table_id = example["table_id"]
142
+ table_file_path = os.path.join(tables_path, f"{table_id}.json")
143
+ url_data_path = os.path.join(requests_path, f"{table_id}.json")
144
+
145
+ with open(table_file_path, encoding="utf-8") as f:
146
+ table = json.load(f)
147
+ with open(url_data_path, encoding="utf-8") as f:
148
+ url_data = json.load(f)
149
+
150
+ table["header"] = [header[0] for header in table["header"]]
151
+
152
+ # here each row is a list with two elemets, the row value and list of urls for that row
153
+ # convert it to list of dict with keys value and urls
154
+ rows = []
155
+ for row in table["data"]:
156
+ for col in row:
157
+ new_row = {"value": col[0]}
158
+ urls = col[1]
159
+ new_row["urls"] = [{"url": url, "summary": url_data[url]} for url in urls]
160
+ rows.append(new_row)
161
+ table["data"] = rows
162
+
163
+ example["answer_text"] = example.pop("answer-text") if "answer-text" in example else ""
164
+ example["table"] = table
165
+
166
+ yield example["question_id"], example