system HF staff commited on
Commit
835b8af
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
+ {"new_wiki": {"description": "SquadShifts consists of four new test sets for the Stanford Question Answering Dataset (SQuAD) from four different domains: Wikipedia articles, New York \\ \nTimes articles, Reddit comments, and Amazon product reviews. Each dataset was generated using the same data generating pipeline, Amazon Mechanical Turk interface, and data cleaning code as the original SQuAD v1.1 dataset. The \"new-wikipedia\" dataset measures overfitting on the original SQuAD v1.1 dataset. The \"new-york-times\", \"reddit\", and \"amazon\" datasets measure robustness to natural distribution shifts. We encourage SQuAD model developers to also evaluate their methods on these new datasets! ", "citation": "@inproceedings{miller2020effect,\n author = {J. Miller and K. Krauth and B. Recht and L. Schmidt},\n booktitle = {International Conference on Machine Learning (ICML)},\n title = {The Effect of Natural Distribution Shift on Question Answering Models},\n year = {2020},\n}\n", "homepage": "https://modestyachts.github.io/squadshifts-website/index.html", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}, "context": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "answers": {"feature": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "answer_start": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "supervised_keys": null, "builder_name": "squad_shifts", "config_name": "new_wiki", "version": {"version_str": "1.0.0", "description": "", "datasets_version_to_prepare": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 7861360, "num_examples": 7938, "dataset_name": "squad_shifts"}}, "download_checksums": {"https://raw.githubusercontent.com/modestyachts/squadshifts-website/master/datasets/new_wiki_v1.0.json": {"num_bytes": 3607393, "checksum": "1d50a0ca4cdab88d038b52ea8a2d0510af6038d7f41a0a256b9659237769d0ee"}, "https://raw.githubusercontent.com/modestyachts/squadshifts-website/master/datasets/nyt_v1.0.json": {"num_bytes": 4550058, "checksum": "fd55ae252cc735a695fab4473d4cd605b154183ac3b3eb63068f53cfc86f36d6"}, "https://raw.githubusercontent.com/modestyachts/squadshifts-website/master/datasets/reddit_v1.0.json": {"num_bytes": 4170330, "checksum": "b4ac346dbf1816fdec80fdcf91d06a4b754fa51e47960fa8614a94f37ea42a4b"}, "https://raw.githubusercontent.com/modestyachts/squadshifts-website/master/datasets/amazon_reviews_v1.0.json": {"num_bytes": 4177842, "checksum": "9db7bdee84a91f0fb80b9e74f365042fbbb217cb8e0a7e73bb071245472589b6"}}, "download_size": 16505623, "dataset_size": 7861360, "size_in_bytes": 24366983}, "nyt": {"description": "SquadShifts consists of four new test sets for the Stanford Question Answering Dataset (SQuAD) from four different domains: Wikipedia articles, New York \\ \nTimes articles, Reddit comments, and Amazon product reviews. Each dataset was generated using the same data generating pipeline, Amazon Mechanical Turk interface, and data cleaning code as the original SQuAD v1.1 dataset. The \"new-wikipedia\" dataset measures overfitting on the original SQuAD v1.1 dataset. The \"new-york-times\", \"reddit\", and \"amazon\" datasets measure robustness to natural distribution shifts. We encourage SQuAD model developers to also evaluate their methods on these new datasets! ", "citation": "@inproceedings{miller2020effect,\n author = {J. Miller and K. Krauth and B. Recht and L. Schmidt},\n booktitle = {International Conference on Machine Learning (ICML)},\n title = {The Effect of Natural Distribution Shift on Question Answering Models},\n year = {2020},\n}\n", "homepage": "https://modestyachts.github.io/squadshifts-website/index.html", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}, "context": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "answers": {"feature": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "answer_start": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "supervised_keys": null, "builder_name": "squad_shifts", "config_name": "nyt", "version": {"version_str": "1.0.0", "description": "", "datasets_version_to_prepare": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 10787650, "num_examples": 10065, "dataset_name": "squad_shifts"}}, "download_checksums": {"https://raw.githubusercontent.com/modestyachts/squadshifts-website/master/datasets/new_wiki_v1.0.json": {"num_bytes": 3607393, "checksum": "1d50a0ca4cdab88d038b52ea8a2d0510af6038d7f41a0a256b9659237769d0ee"}, "https://raw.githubusercontent.com/modestyachts/squadshifts-website/master/datasets/nyt_v1.0.json": {"num_bytes": 4550058, "checksum": "fd55ae252cc735a695fab4473d4cd605b154183ac3b3eb63068f53cfc86f36d6"}, "https://raw.githubusercontent.com/modestyachts/squadshifts-website/master/datasets/reddit_v1.0.json": {"num_bytes": 4170330, "checksum": "b4ac346dbf1816fdec80fdcf91d06a4b754fa51e47960fa8614a94f37ea42a4b"}, "https://raw.githubusercontent.com/modestyachts/squadshifts-website/master/datasets/amazon_reviews_v1.0.json": {"num_bytes": 4177842, "checksum": "9db7bdee84a91f0fb80b9e74f365042fbbb217cb8e0a7e73bb071245472589b6"}}, "download_size": 16505623, "dataset_size": 10787650, "size_in_bytes": 27293273}, "reddit": {"description": "SquadShifts consists of four new test sets for the Stanford Question Answering Dataset (SQuAD) from four different domains: Wikipedia articles, New York \\ \nTimes articles, Reddit comments, and Amazon product reviews. Each dataset was generated using the same data generating pipeline, Amazon Mechanical Turk interface, and data cleaning code as the original SQuAD v1.1 dataset. The \"new-wikipedia\" dataset measures overfitting on the original SQuAD v1.1 dataset. The \"new-york-times\", \"reddit\", and \"amazon\" datasets measure robustness to natural distribution shifts. We encourage SQuAD model developers to also evaluate their methods on these new datasets! ", "citation": "@inproceedings{miller2020effect,\n author = {J. Miller and K. Krauth and B. Recht and L. Schmidt},\n booktitle = {International Conference on Machine Learning (ICML)},\n title = {The Effect of Natural Distribution Shift on Question Answering Models},\n year = {2020},\n}\n", "homepage": "https://modestyachts.github.io/squadshifts-website/index.html", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}, "context": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "answers": {"feature": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "answer_start": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "supervised_keys": null, "builder_name": "squad_shifts", "config_name": "reddit", "version": {"version_str": "1.0.0", "description": "", "datasets_version_to_prepare": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 9469258, "num_examples": 9803, "dataset_name": "squad_shifts"}}, "download_checksums": {"https://raw.githubusercontent.com/modestyachts/squadshifts-website/master/datasets/new_wiki_v1.0.json": {"num_bytes": 3607393, "checksum": "1d50a0ca4cdab88d038b52ea8a2d0510af6038d7f41a0a256b9659237769d0ee"}, "https://raw.githubusercontent.com/modestyachts/squadshifts-website/master/datasets/nyt_v1.0.json": {"num_bytes": 4550058, "checksum": "fd55ae252cc735a695fab4473d4cd605b154183ac3b3eb63068f53cfc86f36d6"}, "https://raw.githubusercontent.com/modestyachts/squadshifts-website/master/datasets/reddit_v1.0.json": {"num_bytes": 4170330, "checksum": "b4ac346dbf1816fdec80fdcf91d06a4b754fa51e47960fa8614a94f37ea42a4b"}, "https://raw.githubusercontent.com/modestyachts/squadshifts-website/master/datasets/amazon_reviews_v1.0.json": {"num_bytes": 4177842, "checksum": "9db7bdee84a91f0fb80b9e74f365042fbbb217cb8e0a7e73bb071245472589b6"}}, "download_size": 16505623, "dataset_size": 9469258, "size_in_bytes": 25974881}, "amazon": {"description": "SquadShifts consists of four new test sets for the Stanford Question Answering Dataset (SQuAD) from four different domains: Wikipedia articles, New York \\ \nTimes articles, Reddit comments, and Amazon product reviews. Each dataset was generated using the same data generating pipeline, Amazon Mechanical Turk interface, and data cleaning code as the original SQuAD v1.1 dataset. The \"new-wikipedia\" dataset measures overfitting on the original SQuAD v1.1 dataset. The \"new-york-times\", \"reddit\", and \"amazon\" datasets measure robustness to natural distribution shifts. We encourage SQuAD model developers to also evaluate their methods on these new datasets! ", "citation": "@inproceedings{miller2020effect,\n author = {J. Miller and K. Krauth and B. Recht and L. Schmidt},\n booktitle = {International Conference on Machine Learning (ICML)},\n title = {The Effect of Natural Distribution Shift on Question Answering Models},\n year = {2020},\n}\n", "homepage": "https://modestyachts.github.io/squadshifts-website/index.html", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}, "context": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "answers": {"feature": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "answer_start": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "supervised_keys": null, "builder_name": "squad_shifts", "config_name": "amazon", "version": {"version_str": "1.0.0", "description": "", "datasets_version_to_prepare": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 9440353, "num_examples": 9885, "dataset_name": "squad_shifts"}}, "download_checksums": {"https://raw.githubusercontent.com/modestyachts/squadshifts-website/master/datasets/new_wiki_v1.0.json": {"num_bytes": 3607393, "checksum": "1d50a0ca4cdab88d038b52ea8a2d0510af6038d7f41a0a256b9659237769d0ee"}, "https://raw.githubusercontent.com/modestyachts/squadshifts-website/master/datasets/nyt_v1.0.json": {"num_bytes": 4550058, "checksum": "fd55ae252cc735a695fab4473d4cd605b154183ac3b3eb63068f53cfc86f36d6"}, "https://raw.githubusercontent.com/modestyachts/squadshifts-website/master/datasets/reddit_v1.0.json": {"num_bytes": 4170330, "checksum": "b4ac346dbf1816fdec80fdcf91d06a4b754fa51e47960fa8614a94f37ea42a4b"}, "https://raw.githubusercontent.com/modestyachts/squadshifts-website/master/datasets/amazon_reviews_v1.0.json": {"num_bytes": 4177842, "checksum": "9db7bdee84a91f0fb80b9e74f365042fbbb217cb8e0a7e73bb071245472589b6"}}, "download_size": 16505623, "dataset_size": 9440353, "size_in_bytes": 25945976}}
dummy/amazon/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:96ce3f5e6a15091aeaeadbe2a23f59e5d0366ccdc92c9d9a5f033725e861a272
3
+ size 930
dummy/new_wiki/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:910171f69848e74b07c1c10d99f3207b3f260b33689aa6c6469380644be3b2ef
3
+ size 928
dummy/nyt/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5c0b7c381ff7c0f7ba88675cf8d26e0343aaeb97482bc3f83162b8b36b08fbde
3
+ size 918
dummy/reddit/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cdf9a9f31adb94d156385b984d74725c03708b19d8e4bfeaea9f3fa622218789
3
+ size 912
squadshifts.py ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ """SQUAD: The Stanford Question Answering Dataset."""
18
+
19
+ from __future__ import absolute_import, division, print_function
20
+
21
+ import json
22
+ import logging
23
+ import os
24
+
25
+ import datasets
26
+
27
+
28
+ _CITATION = """\
29
+ @inproceedings{miller2020effect,
30
+ author = {J. Miller and K. Krauth and B. Recht and L. Schmidt},
31
+ booktitle = {International Conference on Machine Learning (ICML)},
32
+ title = {The Effect of Natural Distribution Shift on Question Answering Models},
33
+ year = {2020},
34
+ }
35
+ """
36
+
37
+ _DESCRIPTION = r"""\
38
+ SquadShifts consists of four new test sets for the Stanford Question Answering \
39
+ Dataset (SQuAD) from four different domains: Wikipedia articles, New York \
40
+ Times articles, Reddit comments, and Amazon product reviews. Each dataset \
41
+ was generated using the same data generating pipeline, Amazon Mechanical \
42
+ Turk interface, and data cleaning code as the original SQuAD v1.1 dataset. \
43
+ The "new-wikipedia" dataset measures overfitting on the original SQuAD v1.1 \
44
+ dataset. The "new-york-times", "reddit", and "amazon" datasets measure \
45
+ robustness to natural distribution shifts. We encourage SQuAD model developers \
46
+ to also evaluate their methods on these new datasets! \
47
+ """
48
+
49
+
50
+ class SquadShiftsConfig(datasets.BuilderConfig):
51
+ """BuilderConfig for SquadShifts."""
52
+
53
+ def __init__(self, **kwargs):
54
+ """BuilderConfig for SQUAD.
55
+
56
+ Args:
57
+ **kwargs: keyword arguments forwarded to super.
58
+ """
59
+ super(SquadShiftsConfig, self).__init__(**kwargs)
60
+
61
+
62
+ class SquadShifts(datasets.GeneratorBasedBuilder):
63
+ """SquadShifts consists of four new test sets for the SQUAD dataset."""
64
+
65
+ _URL = "https://raw.githubusercontent.com/modestyachts/squadshifts-website/master/datasets"
66
+ _NEW_WIKI_FILE = "new_wiki_v1.0.json"
67
+ _NYT_FILE = "nyt_v1.0.json"
68
+ _REDDIT_FILE = "reddit_v1.0.json"
69
+ _AMAZON_FILE = "amazon_reviews_v1.0.json"
70
+
71
+ BUILDER_CONFIGS = [
72
+ SquadShiftsConfig(
73
+ name="new_wiki",
74
+ version=datasets.Version("1.0.0", ""),
75
+ description="SQuADShifts New Wikipedia article dataset",
76
+ ),
77
+ SquadShiftsConfig(
78
+ name="nyt",
79
+ version=datasets.Version("1.0.0", ""),
80
+ description="SQuADShifts New York Times article dataset.",
81
+ ),
82
+ SquadShiftsConfig(
83
+ name="reddit",
84
+ version=datasets.Version("1.0.0", ""),
85
+ description="SQuADShifts Reddit comment dataset.",
86
+ ),
87
+ SquadShiftsConfig(
88
+ name="amazon",
89
+ version=datasets.Version("1.0.0", ""),
90
+ description="SQuADShifts Amazon product review dataset.",
91
+ ),
92
+ ]
93
+
94
+ def _info(self):
95
+ return datasets.DatasetInfo(
96
+ description=_DESCRIPTION,
97
+ features=datasets.Features(
98
+ {
99
+ "id": datasets.Value("string"),
100
+ "title": datasets.Value("string"),
101
+ "context": datasets.Value("string"),
102
+ "question": datasets.Value("string"),
103
+ "answers": datasets.features.Sequence(
104
+ {
105
+ "text": datasets.Value("string"),
106
+ "answer_start": datasets.Value("int32"),
107
+ }
108
+ ),
109
+ }
110
+ ),
111
+ # No default supervised_keys (as we have to pass both question
112
+ # and context as input).
113
+ supervised_keys=None,
114
+ homepage="https://modestyachts.github.io/squadshifts-website/index.html",
115
+ citation=_CITATION,
116
+ )
117
+
118
+ def _split_generators(self, dl_manager):
119
+ urls_to_download = {
120
+ "new_wiki": os.path.join(self._URL, self._NEW_WIKI_FILE),
121
+ "nyt": os.path.join(self._URL, self._NYT_FILE),
122
+ "reddit": os.path.join(self._URL, self._REDDIT_FILE),
123
+ "amazon": os.path.join(self._URL, self._AMAZON_FILE),
124
+ }
125
+ downloaded_files = dl_manager.download_and_extract(urls_to_download)
126
+
127
+ if self.config.name == "new_wiki" or self.config.name == "default":
128
+ return [
129
+ datasets.SplitGenerator(
130
+ name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["new_wiki"]}
131
+ ),
132
+ ]
133
+ elif self.config.name == "nyt":
134
+ return [
135
+ datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["nyt"]}),
136
+ ]
137
+ elif self.config.name == "reddit":
138
+ return [
139
+ datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["reddit"]}),
140
+ ]
141
+ elif self.config.name == "amazon":
142
+ return [
143
+ datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["amazon"]}),
144
+ ]
145
+ else:
146
+ raise ValueError("SQuADShifts dataset name {} not found!".format(self.config.name))
147
+
148
+ def _generate_examples(self, filepath):
149
+ """This function returns the examples in the raw (text) form."""
150
+ logging.info("generating examples from = %s", filepath)
151
+ with open(filepath, encoding="utf-8") as f:
152
+ squad = json.load(f)
153
+ for article in squad["data"]:
154
+ title = article.get("title", "").strip()
155
+ for paragraph in article["paragraphs"]:
156
+ context = paragraph["context"].strip()
157
+ for qa in paragraph["qas"]:
158
+ question = qa["question"].strip()
159
+ id_ = qa["id"]
160
+
161
+ answer_starts = [answer["answer_start"] for answer in qa["answers"]]
162
+ answers = [answer["text"].strip() for answer in qa["answers"]]
163
+
164
+ # Features currently used are "context", "question", and "answers".
165
+ # Others are extracted here for the ease of future expansions.
166
+ yield id_, {
167
+ "title": title,
168
+ "context": context,
169
+ "question": question,
170
+ "id": id_,
171
+ "answers": {
172
+ "answer_start": answer_starts,
173
+ "text": answers,
174
+ },
175
+ }