update
Browse files- the-vault-function.py +19 -8
the-vault-function.py
CHANGED
|
@@ -123,13 +123,16 @@ class TheVaultFunction(datasets.GeneratorBasedBuilder):
|
|
| 123 |
if "all" in split_set:
|
| 124 |
split_set = _SPLIT_CONFIGS[1:]
|
| 125 |
|
|
|
|
| 126 |
if "train" in split_set:
|
| 127 |
split_set.remove('train')
|
| 128 |
split_set.extend(["train/small", "train/medium"])
|
|
|
|
| 129 |
|
| 130 |
if "all" in languages:
|
| 131 |
languages = _LANG_CONFIGS[1:]
|
| 132 |
|
|
|
|
| 133 |
for split in split_set:
|
| 134 |
split_files = []
|
| 135 |
for language in languages:
|
|
@@ -141,14 +144,22 @@ class TheVaultFunction(datasets.GeneratorBasedBuilder):
|
|
| 141 |
files = dl_manager.download(data_files)
|
| 142 |
split_files.extend(files)
|
| 143 |
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
return generators
|
| 153 |
|
| 154 |
def _generate_examples(self, files):
|
|
|
|
| 123 |
if "all" in split_set:
|
| 124 |
split_set = _SPLIT_CONFIGS[1:]
|
| 125 |
|
| 126 |
+
load_full_train = False
|
| 127 |
if "train" in split_set:
|
| 128 |
split_set.remove('train')
|
| 129 |
split_set.extend(["train/small", "train/medium"])
|
| 130 |
+
load_full_train = True
|
| 131 |
|
| 132 |
if "all" in languages:
|
| 133 |
languages = _LANG_CONFIGS[1:]
|
| 134 |
|
| 135 |
+
train_split_files = []
|
| 136 |
for split in split_set:
|
| 137 |
split_files = []
|
| 138 |
for language in languages:
|
|
|
|
| 144 |
files = dl_manager.download(data_files)
|
| 145 |
split_files.extend(files)
|
| 146 |
|
| 147 |
+
if load_full_train and "train" in split:
|
| 148 |
+
train_split_files.extend(split_files)
|
| 149 |
+
else:
|
| 150 |
+
generators.append(
|
| 151 |
+
datasets.SplitGenerator(
|
| 152 |
+
name=split.replace("/", "_"),
|
| 153 |
+
gen_kwargs={
|
| 154 |
+
"files": split_files,
|
| 155 |
+
},
|
| 156 |
+
),
|
| 157 |
+
)
|
| 158 |
+
|
| 159 |
+
if load_full_train and train_split_files:
|
| 160 |
+
generators = [datasets.SplitGenerator(name="train", gen_kwargs={"files": train_split_files})] + generators
|
| 161 |
+
|
| 162 |
+
|
| 163 |
return generators
|
| 164 |
|
| 165 |
def _generate_examples(self, files):
|