Use dl_manager
Browse files- tasky_or_not.py +11 -4
tasky_or_not.py
CHANGED
|
@@ -34,6 +34,12 @@ the validation set of certain held-out datasets from P3.
|
|
| 34 |
|
| 35 |
class TaskyOrNot(datasets.GeneratorBasedBuilder):
|
| 36 |
"""Dataset of tasky and non-tasky text data."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
BUILDER_CONFIGS = [
|
| 39 |
datasets.BuilderConfig(
|
|
@@ -64,19 +70,20 @@ class TaskyOrNot(datasets.GeneratorBasedBuilder):
|
|
| 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": "
|
| 72 |
-
"non_tasky_file": "
|
| 73 |
},
|
| 74 |
),
|
| 75 |
datasets.SplitGenerator(
|
| 76 |
name=datasets.Split.VALIDATION,
|
| 77 |
gen_kwargs={
|
| 78 |
-
"tasky_file": "
|
| 79 |
-
"non_tasky_file": "
|
| 80 |
},
|
| 81 |
),
|
| 82 |
]
|
|
|
|
| 34 |
|
| 35 |
class TaskyOrNot(datasets.GeneratorBasedBuilder):
|
| 36 |
"""Dataset of tasky and non-tasky text data."""
|
| 37 |
+
_DATA_URLS = {
|
| 38 |
+
"p3_train": "p3_examples_train.json",
|
| 39 |
+
"p3_dev": "p3_examples_dev.json",
|
| 40 |
+
"c4_train": "c4_examples_train.json",
|
| 41 |
+
"c4_dev": "c4_examples_dev.json",
|
| 42 |
+
}
|
| 43 |
|
| 44 |
BUILDER_CONFIGS = [
|
| 45 |
datasets.BuilderConfig(
|
|
|
|
| 70 |
)
|
| 71 |
|
| 72 |
def _split_generators(self, dl_manager):
|
| 73 |
+
files = dl_manager.download(self._DATA_URLS)
|
| 74 |
return [
|
| 75 |
datasets.SplitGenerator(
|
| 76 |
name=datasets.Split.TRAIN,
|
| 77 |
gen_kwargs={
|
| 78 |
+
"tasky_file": files["p3_train"],
|
| 79 |
+
"non_tasky_file": files["c4_train"],
|
| 80 |
},
|
| 81 |
),
|
| 82 |
datasets.SplitGenerator(
|
| 83 |
name=datasets.Split.VALIDATION,
|
| 84 |
gen_kwargs={
|
| 85 |
+
"tasky_file": files["p3_dev"],
|
| 86 |
+
"non_tasky_file": files["c4_dev"],
|
| 87 |
},
|
| 88 |
),
|
| 89 |
]
|