Convert dataset to Parquet

#1
by jannalu - opened
README.md CHANGED
@@ -1,3 +1,65 @@
1
  ---
2
  license: other
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: other
3
+ dataset_info:
4
+ - config_name: mutual
5
+ features:
6
+ - name: answers
7
+ dtype: string
8
+ - name: options
9
+ sequence: string
10
+ - name: article
11
+ dtype: string
12
+ - name: id
13
+ dtype: string
14
+ splits:
15
+ - name: train
16
+ num_bytes: 5141602
17
+ num_examples: 7088
18
+ - name: test
19
+ num_bytes: 634396
20
+ num_examples: 886
21
+ - name: validation
22
+ num_bytes: 624271
23
+ num_examples: 886
24
+ download_size: 2773976
25
+ dataset_size: 6400269
26
+ - config_name: mutual_plus
27
+ features:
28
+ - name: answers
29
+ dtype: string
30
+ - name: options
31
+ sequence: string
32
+ - name: article
33
+ dtype: string
34
+ - name: id
35
+ dtype: string
36
+ splits:
37
+ - name: train
38
+ num_bytes: 4921179
39
+ num_examples: 7088
40
+ - name: test
41
+ num_bytes: 606620
42
+ num_examples: 886
43
+ - name: validation
44
+ num_bytes: 597340
45
+ num_examples: 886
46
+ download_size: 2494831
47
+ dataset_size: 6125139
48
+ configs:
49
+ - config_name: mutual
50
+ data_files:
51
+ - split: train
52
+ path: mutual/train-*
53
+ - split: test
54
+ path: mutual/test-*
55
+ - split: validation
56
+ path: mutual/validation-*
57
+ - config_name: mutual_plus
58
+ data_files:
59
+ - split: train
60
+ path: mutual_plus/train-*
61
+ - split: test
62
+ path: mutual_plus/test-*
63
+ - split: validation
64
+ path: mutual_plus/validation-*
65
+ ---
mutual.py DELETED
@@ -1,135 +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
- _LICENSE = "No license found"
42
-
43
- _URLS = "https://github.com/Nealcly/MuTual/archive/master.zip"
44
-
45
-
46
- class Mutual(datasets.GeneratorBasedBuilder):
47
- """MuTual: A Dataset for Multi-Turn Dialogue Reasoning"""
48
-
49
- VERSION = datasets.Version("0.0.1")
50
-
51
- BUILDER_CONFIGS = [
52
- datasets.BuilderConfig(
53
- name="mutual", version=VERSION, description="The MuTual dataset."
54
- ),
55
- datasets.BuilderConfig(
56
- name="mutual_plus",
57
- version=VERSION,
58
- description="MuTualPlus is a more difficult MuTual that replaces positive responses with a safe responses.",
59
- ),
60
- ]
61
-
62
- def _info(self):
63
- features = datasets.Features(
64
- {
65
- "answers": datasets.Value("string"),
66
- "options": datasets.features.Sequence(datasets.Value("string")),
67
- "article": datasets.Value("string"),
68
- "id": datasets.Value("string"),
69
- }
70
- )
71
- return datasets.DatasetInfo(
72
- description=f"{_DESCRIPTION}\n{self.config.description}",
73
- features=features,
74
- homepage=_HOMEPAGE,
75
- license=_LICENSE,
76
- citation=_CITATION,
77
- )
78
-
79
- def _split_generators(self, dl_manager):
80
- urls = _URLS
81
- data_dir = dl_manager.download_and_extract(urls)
82
- return [
83
- datasets.SplitGenerator(
84
- name=datasets.Split.TRAIN,
85
- # These kwargs will be passed to _generate_examples
86
- gen_kwargs={
87
- "basepath": os.path.join(
88
- data_dir, "MuTual-master", "data", self.config.name, "train"
89
- ),
90
- "split": "train",
91
- },
92
- ),
93
- datasets.SplitGenerator(
94
- name=datasets.Split.TEST,
95
- # These kwargs will be passed to _generate_examples
96
- gen_kwargs={
97
- "basepath": os.path.join(
98
- data_dir, "MuTual-master", "data", self.config.name, "test"
99
- ),
100
- "split": "test",
101
- },
102
- ),
103
- datasets.SplitGenerator(
104
- name=datasets.Split.VALIDATION,
105
- # These kwargs will be passed to _generate_examples
106
- gen_kwargs={
107
- "basepath": os.path.join(
108
- data_dir, "MuTual-master", "data", self.config.name, "dev"
109
- ),
110
- "split": "dev",
111
- },
112
- ),
113
- ]
114
-
115
- # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
116
- def _generate_examples(self, basepath, split):
117
- # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
118
- # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
119
- key = 0
120
- for file in sorted(Path(basepath).iterdir()):
121
- if file.suffix != ".txt":
122
- continue
123
- with open(file, "r", encoding="utf-8") as f:
124
- data_str = f.read()
125
- # Ignore the occasional empty file.
126
- if not data_str:
127
- continue
128
- data = json.loads(data_str)
129
- yield key, {
130
- "answers": data["answers"],
131
- "options": data["options"],
132
- "article": data["article"],
133
- "id": data["id"],
134
- }
135
- key += 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
mutual/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:69b995177e8a86995736cebc039068274e538888a90be0101920aa109124c3c7
3
+ size 279074
mutual/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:65bfe0becb68e05180d20f771871ec768c3b65df64e3e0754545dbdd9f415dfd
3
+ size 2219883
mutual/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2913532aa05d2bd9126e531a2bcd9c0d1e648a26d84c795b7de7d295d881d9c4
3
+ size 275019
mutual_plus/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3c24b651f05a99b31bb0c02a55d3e079fbe099c180e496957cb2e64468c9befd
3
+ size 250923
mutual_plus/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6681ef6210d42aa66b00013a2fc513f46fac2398fc889856028ecabc3eeebf18
3
+ size 1996713
mutual_plus/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a2ce81e5d52eb4e774e57dd852ca1ea5a4fed23e661073dd9f0019577a3a223c
3
+ size 247195