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

Update files from the datasets library (from 1.0.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.0.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
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"raw_jeopardy": {"description": "\n# pylint: disable=line-too-long\nWe publicly release a new large-scale dataset, called SearchQA, for machine comprehension, or question-answering. Unlike recently released datasets, such as DeepMind \nCNN/DailyMail and SQuAD, the proposed SearchQA was constructed to reflect a full pipeline of general question-answering. That is, we start not from an existing article \nand generate a question-answer pair, but start from an existing question-answer pair, crawled from J! Archive, and augment it with text snippets retrieved by Google. \nFollowing this approach, we built SearchQA, which consists of more than 140k question-answer pairs with each pair having 49.6 snippets on average. Each question-answer-context\n tuple of the SearchQA comes with additional meta-data such as the snippet's URL, which we believe will be valuable resources for future research. We conduct human evaluation \n as well as test two baseline methods, one simple word selection and the other deep learning based, on the SearchQA. We show that there is a meaningful gap between the human \n and machine performances. This suggests that the proposed dataset could well serve as a benchmark for question-answering.\n\n", "citation": "\n @article{DBLP:journals/corr/DunnSHGCC17,\n author = {Matthew Dunn and\n Levent Sagun and\n Mike Higgins and\n V. Ugur G{\"{u}}ney and\n Volkan Cirik and\n Kyunghyun Cho},\n title = {SearchQA: {A} New Q{\\&}A Dataset Augmented with Context from a\n Search Engine},\n journal = {CoRR},\n volume = {abs/1704.05179},\n year = {2017},\n url = {http://arxiv.org/abs/1704.05179},\n archivePrefix = {arXiv},\n eprint = {1704.05179},\n timestamp = {Mon, 13 Aug 2018 16:47:09 +0200},\n biburl = {https://dblp.org/rec/journals/corr/DunnSHGCC17.bib},\n bibsource = {dblp computer science bibliography, https://dblp.org}\n }\n\n", "homepage": "https://github.com/nyu-dl/dl4ir-searchQA", "license": "", "features": {"category": {"dtype": "string", "id": null, "_type": "Value"}, "air_date": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "value": {"dtype": "string", "id": null, "_type": "Value"}, "answer": {"dtype": "string", "id": null, "_type": "Value"}, "round": {"dtype": "string", "id": null, "_type": "Value"}, "show_number": {"dtype": "int32", "id": null, "_type": "Value"}, "search_results": {"feature": {"urls": {"dtype": "string", "id": null, "_type": "Value"}, "snippets": {"dtype": "string", "id": null, "_type": "Value"}, "titles": {"dtype": "string", "id": null, "_type": "Value"}, "related_links": {"dtype": "string", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "supervised_keys": null, "builder_name": "search_qa", "config_name": "raw_jeopardy", "version": {"version_str": "1.0.0", "description": "", "datasets_version_to_prepare": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 7770972348, "num_examples": 216757, "dataset_name": "search_qa"}}, "download_checksums": {"https://drive.google.com/uc?export=download&id=1U7WdBpd9kJ85S7BbBhWUSiy9NnXrKdO6": {"num_bytes": 3314386157, "checksum": "daaf1ddbb0c34c49832f6c8c26c9d59222085d45c7740425ccad9e38a9232cb4"}}, "download_size": 3314386157, "dataset_size": 7770972348, "size_in_bytes": 11085358505}, "train_test_val": {"description": "\n# pylint: disable=line-too-long\nWe publicly release a new large-scale dataset, called SearchQA, for machine comprehension, or question-answering. Unlike recently released datasets, such as DeepMind \nCNN/DailyMail and SQuAD, the proposed SearchQA was constructed to reflect a full pipeline of general question-answering. That is, we start not from an existing article \nand generate a question-answer pair, but start from an existing question-answer pair, crawled from J! Archive, and augment it with text snippets retrieved by Google. \nFollowing this approach, we built SearchQA, which consists of more than 140k question-answer pairs with each pair having 49.6 snippets on average. Each question-answer-context\n tuple of the SearchQA comes with additional meta-data such as the snippet's URL, which we believe will be valuable resources for future research. We conduct human evaluation \n as well as test two baseline methods, one simple word selection and the other deep learning based, on the SearchQA. We show that there is a meaningful gap between the human \n and machine performances. This suggests that the proposed dataset could well serve as a benchmark for question-answering.\n\n", "citation": "\n @article{DBLP:journals/corr/DunnSHGCC17,\n author = {Matthew Dunn and\n Levent Sagun and\n Mike Higgins and\n V. Ugur G{\"{u}}ney and\n Volkan Cirik and\n Kyunghyun Cho},\n title = {SearchQA: {A} New Q{\\&}A Dataset Augmented with Context from a\n Search Engine},\n journal = {CoRR},\n volume = {abs/1704.05179},\n year = {2017},\n url = {http://arxiv.org/abs/1704.05179},\n archivePrefix = {arXiv},\n eprint = {1704.05179},\n timestamp = {Mon, 13 Aug 2018 16:47:09 +0200},\n biburl = {https://dblp.org/rec/journals/corr/DunnSHGCC17.bib},\n bibsource = {dblp computer science bibliography, https://dblp.org}\n }\n\n", "homepage": "https://github.com/nyu-dl/dl4ir-searchQA", "license": "", "features": {"category": {"dtype": "string", "id": null, "_type": "Value"}, "air_date": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "value": {"dtype": "string", "id": null, "_type": "Value"}, "answer": {"dtype": "string", "id": null, "_type": "Value"}, "round": {"dtype": "string", "id": null, "_type": "Value"}, "show_number": {"dtype": "int32", "id": null, "_type": "Value"}, "search_results": {"feature": {"urls": {"dtype": "string", "id": null, "_type": "Value"}, "snippets": {"dtype": "string", "id": null, "_type": "Value"}, "titles": {"dtype": "string", "id": null, "_type": "Value"}, "related_links": {"dtype": "string", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "supervised_keys": null, "builder_name": "search_qa", "config_name": "train_test_val", "version": {"version_str": "1.0.0", "description": "", "datasets_version_to_prepare": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 5303005740, "num_examples": 151295, "dataset_name": "search_qa"}, "test": {"name": "test", "num_bytes": 1466749978, "num_examples": 43228, "dataset_name": "search_qa"}, "validation": {"name": "validation", "num_bytes": 740962715, "num_examples": 21613, "dataset_name": "search_qa"}}, "download_checksums": {"https://drive.google.com/uc?export=download&id=1aHPVfC5TrlnUjehtagVZoDfq4VccgaNT": {"num_bytes": 3148550732, "checksum": "1f547df8b00e919ba692ca8c133462d358a89ee6b15a8c65c40efe006ed6c4eb"}}, "download_size": 3148550732, "dataset_size": 7510718433, "size_in_bytes": 10659269165}}
dummy/raw_jeopardy/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d64bfb623c7393d509f8e83ebcbc12bc28b1d7684cc22c74ee6dcc47bdd838a3
3
+ size 21595
dummy/train_test_val/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:00f07138b140d8bcbced894ac18789ca4602672b8d21644b334cef21b7cb9958
3
+ size 8758
search_qa.py ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2020 The TensorFlow Datasets Authors and 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
+
16
+ # Lint as: python3
17
+ """SEMPRE dataset."""
18
+
19
+ from __future__ import absolute_import, division, print_function
20
+
21
+ import json
22
+ import os
23
+
24
+ import datasets
25
+
26
+
27
+ _CITATION = r"""
28
+ @article{DBLP:journals/corr/DunnSHGCC17,
29
+ author = {Matthew Dunn and
30
+ Levent Sagun and
31
+ Mike Higgins and
32
+ V. Ugur G{\"{u}}ney and
33
+ Volkan Cirik and
34
+ Kyunghyun Cho},
35
+ title = {SearchQA: {A} New Q{\&}A Dataset Augmented with Context from a
36
+ Search Engine},
37
+ journal = {CoRR},
38
+ volume = {abs/1704.05179},
39
+ year = {2017},
40
+ url = {http://arxiv.org/abs/1704.05179},
41
+ archivePrefix = {arXiv},
42
+ eprint = {1704.05179},
43
+ timestamp = {Mon, 13 Aug 2018 16:47:09 +0200},
44
+ biburl = {https://dblp.org/rec/journals/corr/DunnSHGCC17.bib},
45
+ bibsource = {dblp computer science bibliography, https://dblp.org}
46
+ }
47
+
48
+ """
49
+ # pylint: disable=line-too-long
50
+ _DESCRIPTION = """
51
+ We publicly release a new large-scale dataset, called SearchQA, for machine comprehension, or question-answering. Unlike recently released datasets, such as DeepMind
52
+ CNN/DailyMail and SQuAD, the proposed SearchQA was constructed to reflect a full pipeline of general question-answering. That is, we start not from an existing article
53
+ and generate a question-answer pair, but start from an existing question-answer pair, crawled from J! Archive, and augment it with text snippets retrieved by Google.
54
+ Following this approach, we built SearchQA, which consists of more than 140k question-answer pairs with each pair having 49.6 snippets on average. Each question-answer-context
55
+ tuple of the SearchQA comes with additional meta-data such as the snippet's URL, which we believe will be valuable resources for future research. We conduct human evaluation
56
+ as well as test two baseline methods, one simple word selection and the other deep learning based, on the SearchQA. We show that there is a meaningful gap between the human
57
+ and machine performances. This suggests that the proposed dataset could well serve as a benchmark for question-answering.
58
+ """
59
+
60
+ _DL_URLS = {
61
+ "raw_jeopardy": "https://drive.google.com/uc?export=download&id=1U7WdBpd9kJ85S7BbBhWUSiy9NnXrKdO6",
62
+ "train_test_val": "https://drive.google.com/uc?export=download&id=1aHPVfC5TrlnUjehtagVZoDfq4VccgaNT",
63
+ }
64
+ # pylint: enable=line-too-long
65
+
66
+
67
+ class SearchQaConfig(datasets.BuilderConfig):
68
+ """BuilderConfig for SearchQA."""
69
+
70
+ def __init__(self, data_url, **kwargs):
71
+ """BuilderConfig for SearchQA
72
+
73
+ Args:
74
+ **kwargs: keyword arguments forwarded to super.
75
+ """
76
+ super(SearchQaConfig, self).__init__(version=datasets.Version("1.0.0", ""), **kwargs)
77
+ self.data_url = data_url
78
+
79
+
80
+ class SearchQa(datasets.GeneratorBasedBuilder):
81
+ """Search QA Dataset."""
82
+
83
+ BUILDER_CONFIGS = [SearchQaConfig(name=name, description="", data_url=_DL_URLS[name]) for name in _DL_URLS.keys()]
84
+
85
+ def _info(self):
86
+ return datasets.DatasetInfo(
87
+ description=_DESCRIPTION + "\n" + self.config.description,
88
+ features=datasets.Features(
89
+ {
90
+ "category": datasets.Value("string"),
91
+ "air_date": datasets.Value("string"),
92
+ "question": datasets.Value("string"),
93
+ "value": datasets.Value("string"),
94
+ "answer": datasets.Value("string"),
95
+ "round": datasets.Value("string"),
96
+ "show_number": datasets.Value("int32"),
97
+ "search_results": datasets.features.Sequence(
98
+ {
99
+ "urls": datasets.Value("string"),
100
+ "snippets": datasets.Value("string"),
101
+ "titles": datasets.Value("string"),
102
+ "related_links": datasets.Value("string"),
103
+ }
104
+ )
105
+ # These are the features of your dataset like images, labels ...
106
+ }
107
+ ),
108
+ homepage="https://github.com/nyu-dl/dl4ir-searchQA",
109
+ citation=_CITATION,
110
+ )
111
+
112
+ def _split_generators(self, dl_manager):
113
+ """Returns SplitGenerators."""
114
+ # TODO(jeopardy): Downloads the data and defines the splits
115
+ # dl_manager is a datasets.download.DownloadManager that can be used to
116
+ # download and extract URLs
117
+
118
+ if self.config.name == "raw_jeopardy":
119
+ filepath = dl_manager.download_and_extract(_DL_URLS["raw_jeopardy"])
120
+ sub_folders = sorted(os.listdir(os.path.join(filepath, "jeopardy")))
121
+ all_files = []
122
+ for zip_folder in sub_folders:
123
+ if "lock" in zip_folder:
124
+ continue
125
+ zip_folder_path = os.path.join(filepath, "jeopardy", zip_folder)
126
+ file_path = dl_manager.extract(zip_folder_path)
127
+ zip_folder = zip_folder.split(".")[0]
128
+ if os.path.isdir(os.path.join(file_path, zip_folder)):
129
+ file_path = os.path.join(file_path, zip_folder)
130
+
131
+ else:
132
+ # in some cases the subfolder name contains sapces as 050000 - 059999 and 050000-059999
133
+ parts = zip_folder.split("-")
134
+ zip_folder = parts[0] + " - " + parts[1]
135
+ if os.path.isdir(os.path.join(file_path, zip_folder)):
136
+ file_path = os.path.join(file_path, zip_folder)
137
+
138
+ files = sorted(os.listdir(file_path))
139
+
140
+ files_paths = [os.path.join(file_path, file) for file in files if "__MACOSX" not in file]
141
+ all_files.extend(files_paths)
142
+
143
+ return [
144
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepaths": all_files}),
145
+ ]
146
+ elif self.config.name == "train_test_val":
147
+ filepath = dl_manager.download_and_extract(_DL_URLS["train_test_val"])
148
+ train_path = dl_manager.extract(os.path.join(filepath, "data_json", "train.zip"))
149
+ test_path = dl_manager.extract(os.path.join(filepath, "data_json", "test.zip"))
150
+ val_path = dl_manager.extract(os.path.join(filepath, "data_json", "val.zip"))
151
+
152
+ train_files = [os.path.join(train_path, file) for file in sorted(os.listdir(train_path))]
153
+ test_files = [os.path.join(test_path, file) for file in sorted(os.listdir(test_path))]
154
+ val_files = [os.path.join(val_path, file) for file in sorted(os.listdir(val_path))]
155
+ return [
156
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepaths": train_files}),
157
+ datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepaths": test_files}),
158
+ datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepaths": val_files}),
159
+ ]
160
+
161
+ def _generate_examples(self, filepaths):
162
+ """Yields examples."""
163
+ # TODO(searchQa): Yields (key, example) tuples from the dataset
164
+ for i, filepath in enumerate(filepaths):
165
+ with open(filepath, encoding="utf-8") as f:
166
+
167
+ data = json.load(f)
168
+ category = data["category"]
169
+ air_date = data["air_date"]
170
+ question = data["question"]
171
+ value = data["value"]
172
+ answer = data["answer"]
173
+ round_ = data["round"]
174
+ show_number = int(data["show_number"])
175
+ search_results = data["search_results"]
176
+ urls = [result["url"] for result in search_results]
177
+ snippets = [result["snippet"] for result in search_results]
178
+ titles = [result["title"] for result in search_results]
179
+ related_links = [
180
+ result["related_links"] if result["related_links"] else "" for result in search_results
181
+ ]
182
+ yield i, {
183
+ "category": category,
184
+ "air_date": air_date,
185
+ "question": question,
186
+ "value": value,
187
+ "answer": answer,
188
+ "round": round_,
189
+ "category": category,
190
+ "show_number": show_number,
191
+ "search_results": {
192
+ "urls": urls,
193
+ "snippets": snippets,
194
+ "titles": titles,
195
+ "related_links": related_links,
196
+ },
197
+ }