Convert dataset to Parquet

#2
by SaylorTwift HF Staff - opened
README.md ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ dataset_info:
3
+ - config_name: mutual
4
+ features:
5
+ - name: answers
6
+ dtype: string
7
+ - name: options
8
+ sequence: string
9
+ - name: article
10
+ dtype: string
11
+ - name: id
12
+ dtype: string
13
+ splits:
14
+ - name: train
15
+ num_bytes: 5141602
16
+ num_examples: 7088
17
+ - name: test
18
+ num_bytes: 634396
19
+ num_examples: 886
20
+ - name: validation
21
+ num_bytes: 624271
22
+ num_examples: 886
23
+ download_size: 2773429
24
+ dataset_size: 6400269
25
+ - config_name: mutual_plus
26
+ features:
27
+ - name: answers
28
+ dtype: string
29
+ - name: options
30
+ sequence: string
31
+ - name: article
32
+ dtype: string
33
+ - name: id
34
+ dtype: string
35
+ splits:
36
+ - name: train
37
+ num_bytes: 4921179
38
+ num_examples: 7088
39
+ - name: test
40
+ num_bytes: 606620
41
+ num_examples: 886
42
+ - name: validation
43
+ num_bytes: 597340
44
+ num_examples: 886
45
+ download_size: 2494284
46
+ dataset_size: 6125139
47
+ configs:
48
+ - config_name: mutual
49
+ data_files:
50
+ - split: train
51
+ path: mutual/train-*
52
+ - split: test
53
+ path: mutual/test-*
54
+ - split: validation
55
+ path: mutual/validation-*
56
+ - config_name: mutual_plus
57
+ data_files:
58
+ - split: train
59
+ path: mutual_plus/train-*
60
+ - split: test
61
+ path: mutual_plus/test-*
62
+ - split: validation
63
+ path: mutual_plus/validation-*
64
+ ---
mutual/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3e9df8ed7fcee76bae1a2fcc971b80d1bae3f6ef2441807962139eb4ec8c2f65
3
+ size 279020
mutual/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bd91a9a18599d21439b5f047af37823c0427b2f3dcabc8f342117cbf9043baec
3
+ size 2219444
mutual/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b8f3032bfaf233a7e8e82e6fd857ead227fbbf1100b317f9bb27b07ab3970446
3
+ size 274965
mutual_harness.py DELETED
@@ -1,136 +0,0 @@
1
- # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- """MuTual dataset."""
15
-
16
-
17
- import json
18
- import os
19
- from pathlib import Path
20
-
21
- import datasets
22
-
23
-
24
- _CITATION = """\
25
- @inproceedings{mutual,
26
- title = "MuTual: A Dataset for Multi-Turn Dialogue Reasoning",
27
- author = "Cui, Leyang and Wu, Yu and Liu, Shujie and Zhang, Yue and Zhou, Ming" ,
28
- booktitle = "Proceedings of the 58th Conference of the Association for Computational Linguistics",
29
- year = "2020",
30
- publisher = "Association for Computational Linguistics",
31
- }
32
- """
33
-
34
- _DESCRIPTION = """\
35
- MuTual is a retrieval-based dataset for multi-turn dialogue reasoning, which is
36
- modified from Chinese high school English listening comprehension test data.
37
- """
38
-
39
- _HOMEPAGE = "https://github.com/Nealcly/MuTual"
40
-
41
- # TODO: Add the licence for the dataset here if you can find it
42
- _LICENSE = ""
43
-
44
- _URLS = "https://github.com/Nealcly/MuTual/archive/master.zip"
45
-
46
-
47
- class Mutual(datasets.GeneratorBasedBuilder):
48
- """MuTual: A Dataset for Multi-Turn Dialogue Reasoning"""
49
-
50
- VERSION = datasets.Version("0.0.1")
51
-
52
- BUILDER_CONFIGS = [
53
- datasets.BuilderConfig(
54
- name="mutual", version=VERSION, description="The MuTual dataset."
55
- ),
56
- datasets.BuilderConfig(
57
- name="mutual_plus",
58
- version=VERSION,
59
- description="MuTualPlus is a more difficult MuTual that replaces positive responses with a safe responses.",
60
- ),
61
- ]
62
-
63
- def _info(self):
64
- features = datasets.Features(
65
- {
66
- "answers": datasets.Value("string"),
67
- "options": datasets.features.Sequence(datasets.Value("string")),
68
- "article": datasets.Value("string"),
69
- "id": datasets.Value("string"),
70
- }
71
- )
72
- return datasets.DatasetInfo(
73
- description=f"{_DESCRIPTION}\n{self.config.description}",
74
- features=features,
75
- homepage=_HOMEPAGE,
76
- license=_LICENSE,
77
- citation=_CITATION,
78
- )
79
-
80
- def _split_generators(self, dl_manager):
81
- urls = _URLS
82
- data_dir = dl_manager.download_and_extract(urls)
83
- return [
84
- datasets.SplitGenerator(
85
- name=datasets.Split.TRAIN,
86
- # These kwargs will be passed to _generate_examples
87
- gen_kwargs={
88
- "basepath": os.path.join(
89
- data_dir, "MuTual-master", "data", self.config.name, "train"
90
- ),
91
- "split": "train",
92
- },
93
- ),
94
- datasets.SplitGenerator(
95
- name=datasets.Split.TEST,
96
- # These kwargs will be passed to _generate_examples
97
- gen_kwargs={
98
- "basepath": os.path.join(
99
- data_dir, "MuTual-master", "data", self.config.name, "test"
100
- ),
101
- "split": "test",
102
- },
103
- ),
104
- datasets.SplitGenerator(
105
- name=datasets.Split.VALIDATION,
106
- # These kwargs will be passed to _generate_examples
107
- gen_kwargs={
108
- "basepath": os.path.join(
109
- data_dir, "MuTual-master", "data", self.config.name, "dev"
110
- ),
111
- "split": "dev",
112
- },
113
- ),
114
- ]
115
-
116
- # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
117
- def _generate_examples(self, basepath, split):
118
- # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
119
- # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
120
- key = 0
121
- for file in sorted(Path(basepath).iterdir()):
122
- if file.suffix != ".txt":
123
- continue
124
- with open(file, "r", encoding="utf-8") as f:
125
- data_str = f.read()
126
- # Ignore the occasional empty file.
127
- if not data_str:
128
- continue
129
- data = json.loads(data_str)
130
- yield key, {
131
- "answers": data["answers"],
132
- "options": data["options"],
133
- "article": data["article"],
134
- "id": data["id"],
135
- }
136
- key += 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
mutual_plus/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c0d651f1e2e5d9fd0cdfdb633d41554ad7ac079e2ab600475fa19121de601571
3
+ size 250869
mutual_plus/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f774019c13444d5e0ff749f3aaafd5066cd949e4776cfb1b0fc7a00c60a09fb8
3
+ size 1996274
mutual_plus/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:acf89882354ed17291318c8e7950e0048ad7a71755242fa2c6c285aac7a47719
3
+ size 247141