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

Update files from the datasets library (from 1.0.2)

Browse files

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

.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
+ {"age_classification": {"description": "MATINF is the first jointly labeled large-scale dataset for classification, question answering and summarization.\nMATINF contains 1.07 million question-answer pairs with human-labeled categories and user-generated question \ndescriptions. Based on such rich information, MATINF is applicable for three major NLP tasks, including classification, \nquestion answering, and summarization. We benchmark existing methods and a novel multi-task baseline over MATINF to \ninspire further research. Our comprehensive comparison and experiments over MATINF and other datasets demonstrate the \nmerits held by MATINF.\n", "citation": "@inproceedings{xu-etal-2020-matinf,\n title = \"{MATINF}: A Jointly Labeled Large-Scale Dataset for Classification, Question Answering and Summarization\",\n author = \"Xu, Canwen and\n Pei, Jiaxin and\n Wu, Hongtao and\n Liu, Yiyu and\n Li, Chenliang\",\n booktitle = \"Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics\",\n month = jul,\n year = \"2020\",\n address = \"Online\",\n publisher = \"Association for Computational Linguistics\",\n url = \"https://www.aclweb.org/anthology/2020.acl-main.330\",\n pages = \"3586--3596\",\n}\n\n", "homepage": "https://github.com/WHUIR/MATINF", "license": "", "features": {"question": {"dtype": "string", "id": null, "_type": "Value"}, "description": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 3, "names": ["0-1\u5c81", "1-2\u5c81", "2-3\u5c81"], "names_file": null, "id": null, "_type": "ClassLabel"}, "id": {"dtype": "int32", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "matinf", "config_name": "age_classification", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 33901977, "num_examples": 134852, "dataset_name": "matinf"}, "test": {"name": "test", "num_bytes": 9616194, "num_examples": 38318, "dataset_name": "matinf"}, "validation": {"name": "validation", "num_bytes": 4869685, "num_examples": 19323, "dataset_name": "matinf"}}, "download_checksums": {}, "download_size": 0, "post_processing_size": null, "dataset_size": 48387856, "size_in_bytes": 48387856}, "topic_classification": {"description": "MATINF is the first jointly labeled large-scale dataset for classification, question answering and summarization.\nMATINF contains 1.07 million question-answer pairs with human-labeled categories and user-generated question \ndescriptions. Based on such rich information, MATINF is applicable for three major NLP tasks, including classification, \nquestion answering, and summarization. We benchmark existing methods and a novel multi-task baseline over MATINF to \ninspire further research. Our comprehensive comparison and experiments over MATINF and other datasets demonstrate the \nmerits held by MATINF.\n", "citation": "@inproceedings{xu-etal-2020-matinf,\n title = \"{MATINF}: A Jointly Labeled Large-Scale Dataset for Classification, Question Answering and Summarization\",\n author = \"Xu, Canwen and\n Pei, Jiaxin and\n Wu, Hongtao and\n Liu, Yiyu and\n Li, Chenliang\",\n booktitle = \"Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics\",\n month = jul,\n year = \"2020\",\n address = \"Online\",\n publisher = \"Association for Computational Linguistics\",\n url = \"https://www.aclweb.org/anthology/2020.acl-main.330\",\n pages = \"3586--3596\",\n}\n\n", "homepage": "https://github.com/WHUIR/MATINF", "license": "", "features": {"question": {"dtype": "string", "id": null, "_type": "Value"}, "description": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 18, "names": ["\u4ea7\u8925\u671f\u4fdd\u5065", "\u513f\u7ae5\u8fc7\u654f", "\u52a8\u4f5c\u53d1\u80b2", "\u5a74\u5e7c\u4fdd\u5065", "\u5a74\u5e7c\u5fc3\u7406", "\u5a74\u5e7c\u65e9\u6559", "\u5a74\u5e7c\u671f\u5582\u517b", "\u5a74\u5e7c\u8425\u517b", "\u5b55\u671f\u4fdd\u5065", "\u5bb6\u5ead\u6559\u80b2", "\u5e7c\u513f\u56ed", "\u672a\u51c6\u7236\u6bcd", "\u6d41\u4ea7\u548c\u4e0d\u5b55", "\u75ab\u82d7\u63a5\u79cd", "\u76ae\u80a4\u62a4\u7406", "\u5b9d\u5b9d\u4e0a\u706b", "\u8179\u6cfb", "\u5a74\u5e7c\u5e38\u89c1\u75c5"], "names_file": null, "id": null, "_type": "ClassLabel"}, "id": {"dtype": "int32", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "matinf", "config_name": "topic_classification", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 153326538, "num_examples": 613036, "dataset_name": "matinf"}, "test": {"name": "test", "num_bytes": 43877443, "num_examples": 175363, "dataset_name": "matinf"}, "validation": {"name": "validation", "num_bytes": 21834951, "num_examples": 87519, "dataset_name": "matinf"}}, "download_checksums": {}, "download_size": 0, "post_processing_size": null, "dataset_size": 219038932, "size_in_bytes": 219038932}, "summarization": {"description": "MATINF is the first jointly labeled large-scale dataset for classification, question answering and summarization.\nMATINF contains 1.07 million question-answer pairs with human-labeled categories and user-generated question \ndescriptions. Based on such rich information, MATINF is applicable for three major NLP tasks, including classification, \nquestion answering, and summarization. We benchmark existing methods and a novel multi-task baseline over MATINF to \ninspire further research. Our comprehensive comparison and experiments over MATINF and other datasets demonstrate the \nmerits held by MATINF.\n", "citation": "@inproceedings{xu-etal-2020-matinf,\n title = \"{MATINF}: A Jointly Labeled Large-Scale Dataset for Classification, Question Answering and Summarization\",\n author = \"Xu, Canwen and\n Pei, Jiaxin and\n Wu, Hongtao and\n Liu, Yiyu and\n Li, Chenliang\",\n booktitle = \"Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics\",\n month = jul,\n year = \"2020\",\n address = \"Online\",\n publisher = \"Association for Computational Linguistics\",\n url = \"https://www.aclweb.org/anthology/2020.acl-main.330\",\n pages = \"3586--3596\",\n}\n\n", "homepage": "https://github.com/WHUIR/MATINF", "license": "", "features": {"description": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "id": {"dtype": "int32", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "matinf", "config_name": "summarization", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 181245403, "num_examples": 747888, "dataset_name": "matinf"}, "test": {"name": "test", "num_bytes": 51784189, "num_examples": 213681, "dataset_name": "matinf"}, "validation": {"name": "validation", "num_bytes": 25849900, "num_examples": 106842, "dataset_name": "matinf"}}, "download_checksums": {}, "download_size": 0, "post_processing_size": null, "dataset_size": 258879492, "size_in_bytes": 258879492}, "qa": {"description": "MATINF is the first jointly labeled large-scale dataset for classification, question answering and summarization.\nMATINF contains 1.07 million question-answer pairs with human-labeled categories and user-generated question \ndescriptions. Based on such rich information, MATINF is applicable for three major NLP tasks, including classification, \nquestion answering, and summarization. We benchmark existing methods and a novel multi-task baseline over MATINF to \ninspire further research. Our comprehensive comparison and experiments over MATINF and other datasets demonstrate the \nmerits held by MATINF.\n", "citation": "@inproceedings{xu-etal-2020-matinf,\n title = \"{MATINF}: A Jointly Labeled Large-Scale Dataset for Classification, Question Answering and Summarization\",\n author = \"Xu, Canwen and\n Pei, Jiaxin and\n Wu, Hongtao and\n Liu, Yiyu and\n Li, Chenliang\",\n booktitle = \"Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics\",\n month = jul,\n year = \"2020\",\n address = \"Online\",\n publisher = \"Association for Computational Linguistics\",\n url = \"https://www.aclweb.org/anthology/2020.acl-main.330\",\n pages = \"3586--3596\",\n}\n\n", "homepage": "https://github.com/WHUIR/MATINF", "license": "", "features": {"question": {"dtype": "string", "id": null, "_type": "Value"}, "answer": {"dtype": "string", "id": null, "_type": "Value"}, "id": {"dtype": "int32", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "matinf", "config_name": "qa", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 188047511, "num_examples": 747888, "dataset_name": "matinf"}, "test": {"name": "test", "num_bytes": 53708532, "num_examples": 213681, "dataset_name": "matinf"}, "validation": {"name": "validation", "num_bytes": 26931809, "num_examples": 106842, "dataset_name": "matinf"}}, "download_checksums": {}, "download_size": 0, "post_processing_size": null, "dataset_size": 268687852, "size_in_bytes": 268687852}}
dummy/age_classification/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3fa3c4b0a93e7baa6d6db03cbe0fe36896c9012fd32c3f84dff5ecbe733abe3d
3
+ size 6107
dummy/qa/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3fa3c4b0a93e7baa6d6db03cbe0fe36896c9012fd32c3f84dff5ecbe733abe3d
3
+ size 6107
dummy/summarization/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3fa3c4b0a93e7baa6d6db03cbe0fe36896c9012fd32c3f84dff5ecbe733abe3d
3
+ size 6107
dummy/topic_classification/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3fa3c4b0a93e7baa6d6db03cbe0fe36896c9012fd32c3f84dff5ecbe733abe3d
3
+ size 6107
matinf.py ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import absolute_import, division, print_function
2
+
3
+ import csv
4
+ import os
5
+
6
+ import six
7
+
8
+ import datasets
9
+
10
+
11
+ _CITATION = """\
12
+ @inproceedings{xu-etal-2020-matinf,
13
+ title = "{MATINF}: A Jointly Labeled Large-Scale Dataset for Classification, Question Answering and Summarization",
14
+ author = "Xu, Canwen and
15
+ Pei, Jiaxin and
16
+ Wu, Hongtao and
17
+ Liu, Yiyu and
18
+ Li, Chenliang",
19
+ booktitle = "Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics",
20
+ month = jul,
21
+ year = "2020",
22
+ address = "Online",
23
+ publisher = "Association for Computational Linguistics",
24
+ url = "https://www.aclweb.org/anthology/2020.acl-main.330",
25
+ pages = "3586--3596",
26
+ }
27
+
28
+ """
29
+
30
+ _DESCRIPTION = """\
31
+ MATINF is the first jointly labeled large-scale dataset for classification, question answering and summarization.
32
+ MATINF contains 1.07 million question-answer pairs with human-labeled categories and user-generated question
33
+ descriptions. Based on such rich information, MATINF is applicable for three major NLP tasks, including classification,
34
+ question answering, and summarization. We benchmark existing methods and a novel multi-task baseline over MATINF to
35
+ inspire further research. Our comprehensive comparison and experiments over MATINF and other datasets demonstrate the
36
+ merits held by MATINF.
37
+ """
38
+
39
+
40
+ class MatinfConfig(datasets.BuilderConfig):
41
+ """BuilderConfig for MATINF."""
42
+
43
+ def __init__(
44
+ self,
45
+ text_features,
46
+ label_column,
47
+ label_classes=None,
48
+ **kwargs,
49
+ ):
50
+ """BuilderConfig for MATINF.
51
+
52
+ Args:
53
+ text_features: `dict[string, string]`, map from the name of the feature
54
+ dict for each text field to the name of the column in the tsv file
55
+ label_column: `string`, name of the column in the tsv file corresponding
56
+ to the label
57
+ label_classes: `list[string]`, the list of classes if the label is
58
+ categorical. If not provided, then the label will be of type
59
+ `datasets.Value('float32')`.
60
+ **kwargs: keyword arguments forwarded to super.
61
+ """
62
+ super(MatinfConfig, self).__init__(version=datasets.Version("1.0.0"), **kwargs)
63
+ self.text_features = text_features
64
+ self.label_column = label_column
65
+ self.label_classes = label_classes
66
+
67
+
68
+ class Matinf(datasets.GeneratorBasedBuilder):
69
+ VERSION = datasets.Version("1.0.0")
70
+
71
+ BUILDER_CONFIGS = [
72
+ MatinfConfig(
73
+ name="age_classification",
74
+ text_features=["question", "description"],
75
+ label_column="class",
76
+ label_classes=["0-1岁", "1-2岁", "2-3岁"],
77
+ ),
78
+ MatinfConfig(
79
+ name="topic_classification",
80
+ text_features=["question", "description"],
81
+ label_column="class",
82
+ label_classes=[
83
+ "产褥期保健",
84
+ "儿童过敏",
85
+ "动作发育",
86
+ "婴幼保健",
87
+ "婴幼心理",
88
+ "婴幼早教",
89
+ "婴幼期喂养",
90
+ "婴幼营养",
91
+ "孕期保健",
92
+ "家庭教育",
93
+ "幼儿园",
94
+ "未准父母",
95
+ "流产和不孕",
96
+ "疫苗接种",
97
+ "皮肤护理",
98
+ "宝宝上火",
99
+ "腹泻",
100
+ "婴幼常见病",
101
+ ],
102
+ ),
103
+ MatinfConfig(
104
+ name="summarization",
105
+ text_features=["description", "question"],
106
+ label_column=None,
107
+ ),
108
+ MatinfConfig(
109
+ name="qa",
110
+ text_features=["question", "answer"],
111
+ label_column=None,
112
+ ),
113
+ ]
114
+
115
+ @property
116
+ def manual_download_instructions(self):
117
+ return (
118
+ "To use MATINF you have to download it manually. Please fill this google form ("
119
+ "https://forms.gle/nkH4LVE4iNQeDzsc9). You will receive a download link and a password once you "
120
+ "complete the form. Please extract all files in one folder and load the dataset with: "
121
+ "`datasets.load_dataset('matinf', data_dir='path/to/folder/folder_name')`"
122
+ )
123
+
124
+ def _info(self):
125
+ features = {text_feature: datasets.Value("string") for text_feature in self.config.text_features}
126
+ if self.config.label_classes:
127
+ features["label"] = datasets.features.ClassLabel(names=self.config.label_classes)
128
+ features["id"] = datasets.Value("int32")
129
+ return datasets.DatasetInfo(
130
+ description=_DESCRIPTION,
131
+ features=datasets.Features(features),
132
+ homepage="https://github.com/WHUIR/MATINF",
133
+ citation=_CITATION,
134
+ )
135
+
136
+ def _split_generators(self, dl_manager):
137
+ """Returns SplitGenerators."""
138
+ data_dir = os.path.abspath(os.path.expanduser(dl_manager.manual_dir))
139
+
140
+ if not os.path.exists(data_dir):
141
+ raise FileNotFoundError(
142
+ "{} does not exist. Make sure you insert a manual dir via `datasets.load_dataset('matinf', data_dir=...)` that includes files unzipped from the MATINF zip. Manual download instructions: {}".format(
143
+ data_dir, self.manual_download_instructions
144
+ )
145
+ )
146
+ return [
147
+ datasets.SplitGenerator(
148
+ name=datasets.Split.TRAIN,
149
+ gen_kwargs={"filepath": os.path.join(data_dir, "train.csv")},
150
+ ),
151
+ datasets.SplitGenerator(
152
+ name=datasets.Split.TEST,
153
+ gen_kwargs={"filepath": os.path.join(data_dir, "test.csv")},
154
+ ),
155
+ datasets.SplitGenerator(
156
+ name=datasets.Split.VALIDATION,
157
+ gen_kwargs={"filepath": os.path.join(data_dir, "dev.csv")},
158
+ ),
159
+ ]
160
+
161
+ def _generate_examples(self, filepath):
162
+ """Yields examples."""
163
+ label_classes = self.config.label_classes
164
+
165
+ with open(filepath, encoding="utf8") as f:
166
+ reader = csv.DictReader(f)
167
+
168
+ for n, row in enumerate(reader):
169
+ example = {feat: row[feat] for feat in self.config.text_features}
170
+ example["id"] = row["id"]
171
+
172
+ if self.config.label_column:
173
+ label = row[self.config.label_column]
174
+ if label_classes and label not in label_classes:
175
+ continue # Split age/topic classification
176
+ example["label"] = label
177
+
178
+ # Filter out corrupted rows.
179
+ for value in six.itervalues(example):
180
+ if value is None:
181
+ break
182
+ else:
183
+ yield example["id"], example