craffel HF staff commited on
Commit
773b156
0 Parent(s):

Add first version of dataset

Browse files
.gitattributes ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ c4_examples_train.json filter=lfs diff=lfs merge=lfs -text
2
+ c4_examples_dev.json filter=lfs diff=lfs merge=lfs -text
3
+ p3_examples_dev.json filter=lfs diff=lfs merge=lfs -text
4
+ p3_examples_train.json filter=lfs diff=lfs merge=lfs -text
c4_examples_dev.json ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7f9e7d87d6a3a03ad1d40c8a92125a808953493706706becde2a5505c2ce5b66
3
+ size 21965013
c4_examples_train.json ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df0e27d724d669ed5bd4d32173582f41c7eec12e4114a2d10d4c07a3d5ff9da6
3
+ size 116580135
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
1
+ {"10xp3_10xc4": {"description": "This dataset is a collection of prompted examples from P3 and examples from C4.\nThe C4 examples are labeled \"not-task-like\" and the P3 examples are\n\"task-like\". Examples were sampled from C4 so that the distribution of example\nlengths is similar for C4 and P3 examples. Some datasets from P3 were ignored\nbecause their examples were too long. Some datasets from P3 are held out for\nvalidation. Non-tasky validation data was gathered from C4 without\nintentionally matching the length distribution. Tasky data was gathered from\nthe validation set of certain held-out datasets from P3.\n", "citation": "", "homepage": "https://github.com/craffel/tasky-data", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "dataset": {"dtype": "string", "id": null, "_type": "Value"}, "prompt": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 2, "names": ["not tasky", "tasky"], "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "tasky_or_not", "config_name": "10xp3_10xc4", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 130575217, "num_examples": 192079, "dataset_name": "tasky_or_not"}, "validation": {"name": "validation", "num_bytes": 58296399, "num_examples": 81040, "dataset_name": "tasky_or_not"}}, "download_checksums": {}, "download_size": 0, "post_processing_size": null, "dataset_size": 188871616, "size_in_bytes": 188871616}}
p3_examples_dev.json ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6d44e575478e6123d8bbbd63b8fda37ff27aead0b7c72b7dfa34118765296c20
3
+ size 33627840
p3_examples_train.json ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:81be9059a26301588aaafbdcdd6d9413e1029a5c30fff317293f94d89b152fcc
3
+ size 11140739
tasky_or_not.py ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2020 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
+ """Dataset of task-like and hopefully-not-task-like examples."""
18
+
19
+
20
+ import json
21
+ import datasets
22
+
23
+ _DESCRIPTION = """\
24
+ This dataset is a collection of prompted examples from P3 and examples from C4.
25
+ The C4 examples are labeled "not-task-like" and the P3 examples are
26
+ "task-like". Examples were sampled from C4 so that the distribution of example
27
+ lengths is similar for C4 and P3 examples. Some datasets from P3 were ignored
28
+ because their examples were too long. Some datasets from P3 are held out for
29
+ validation. Non-tasky validation data was gathered from C4 without
30
+ intentionally matching the length distribution. Tasky data was gathered from
31
+ the validation set of certain held-out datasets from P3.
32
+ """
33
+
34
+
35
+ class TaskyOrNot(datasets.GeneratorBasedBuilder):
36
+ """Dataset of tasky and non-tasky text data."""
37
+
38
+ BUILDER_CONFIGS = [
39
+ datasets.BuilderConfig(
40
+ name="10xp3_10xc4",
41
+ version=datasets.Version("1.0.0", ""),
42
+ description=(
43
+ "10 tasky examples per prompt/dataset combination; "
44
+ "10 non-tasky examples per tasky example"),
45
+ )
46
+ ]
47
+
48
+ def _info(self):
49
+ return datasets.DatasetInfo(
50
+ description=_DESCRIPTION,
51
+ features=datasets.Features(
52
+ {
53
+ "text": datasets.Value("string"),
54
+ "dataset": datasets.Value("string"),
55
+ "prompt": datasets.Value("string"),
56
+ "label": datasets.features.ClassLabel(
57
+ names=["not tasky", "tasky"]
58
+ ),
59
+ }
60
+ ),
61
+ supervised_keys=None,
62
+ homepage="https://github.com/craffel/tasky-data",
63
+ citation="",
64
+ )
65
+
66
+ def _split_generators(self, dl_manager):
67
+ return [
68
+ datasets.SplitGenerator(
69
+ name=datasets.Split.TRAIN,
70
+ gen_kwargs={
71
+ "tasky_file": "p3_examples_train.json",
72
+ "non_tasky_file": "c4_examples_train.json",
73
+ },
74
+ ),
75
+ datasets.SplitGenerator(
76
+ name=datasets.Split.VALIDATION,
77
+ gen_kwargs={
78
+ "tasky_file": "p3_examples_dev.json",
79
+ "non_tasky_file": "c4_examples_dev.json",
80
+ },
81
+ ),
82
+ ]
83
+
84
+ def _generate_examples(self, tasky_file, non_tasky_file):
85
+ with open(tasky_file) as f:
86
+ tasky_examples = json.load(f)
87
+ idx = 0
88
+ for dataset, prompts in tasky_examples.items():
89
+ for prompt, examples in prompts.items():
90
+ for text in examples:
91
+ yield idx, {
92
+ "text": text,
93
+ "dataset": dataset,
94
+ "prompt": prompt,
95
+ "label": 1,
96
+ }
97
+ idx += 1
98
+
99
+ with open(non_tasky_file) as f:
100
+ non_tasky_examples = json.load(f)
101
+ for text in non_tasky_examples:
102
+ yield idx, {
103
+ "text": text, "dataset": "c4", "prompt": "N/A", "label": 0
104
+ }
105
+ idx += 1