Optimize downloading
#9
by
albertvillanova
HF staff
- opened
P3.py
CHANGED
@@ -151,15 +151,14 @@ class P3(datasets.GeneratorBasedBuilder):
|
|
151 |
|
152 |
def _split_generators(self, dl_manager):
|
153 |
split_generators = []
|
154 |
-
data_dir = dl_manager.
|
155 |
-
task_name = self.config.name
|
156 |
if "train" in self.config.splits:
|
157 |
split_name = "train"
|
158 |
split_generators.append(
|
159 |
datasets.SplitGenerator(
|
160 |
name=datasets.Split.TRAIN,
|
161 |
gen_kwargs={
|
162 |
-
"tfrecord": data_dir[
|
163 |
}
|
164 |
)
|
165 |
)
|
@@ -169,7 +168,7 @@ class P3(datasets.GeneratorBasedBuilder):
|
|
169 |
datasets.SplitGenerator(
|
170 |
name=datasets.Split.VALIDATION,
|
171 |
gen_kwargs={
|
172 |
-
"tfrecord": data_dir[
|
173 |
}
|
174 |
)
|
175 |
)
|
@@ -179,7 +178,7 @@ class P3(datasets.GeneratorBasedBuilder):
|
|
179 |
datasets.SplitGenerator(
|
180 |
name=datasets.Split.TEST,
|
181 |
gen_kwargs={
|
182 |
-
"tfrecord": data_dir[
|
183 |
}
|
184 |
)
|
185 |
)
|
@@ -190,7 +189,7 @@ class P3(datasets.GeneratorBasedBuilder):
|
|
190 |
datasets.SplitGenerator(
|
191 |
name=datasets.Split(special_split_name),
|
192 |
gen_kwargs={
|
193 |
-
"tfrecord": data_dir[
|
194 |
}
|
195 |
)
|
196 |
)
|
|
|
151 |
|
152 |
def _split_generators(self, dl_manager):
|
153 |
split_generators = []
|
154 |
+
data_dir = dl_manager.download(_URLs[self.config.name])
|
|
|
155 |
if "train" in self.config.splits:
|
156 |
split_name = "train"
|
157 |
split_generators.append(
|
158 |
datasets.SplitGenerator(
|
159 |
name=datasets.Split.TRAIN,
|
160 |
gen_kwargs={
|
161 |
+
"tfrecord": data_dir[split_name][0],
|
162 |
}
|
163 |
)
|
164 |
)
|
|
|
168 |
datasets.SplitGenerator(
|
169 |
name=datasets.Split.VALIDATION,
|
170 |
gen_kwargs={
|
171 |
+
"tfrecord": data_dir[split_name][0],
|
172 |
}
|
173 |
)
|
174 |
)
|
|
|
178 |
datasets.SplitGenerator(
|
179 |
name=datasets.Split.TEST,
|
180 |
gen_kwargs={
|
181 |
+
"tfrecord": data_dir[split_name][0],
|
182 |
}
|
183 |
)
|
184 |
)
|
|
|
189 |
datasets.SplitGenerator(
|
190 |
name=datasets.Split(special_split_name),
|
191 |
gen_kwargs={
|
192 |
+
"tfrecord": data_dir[special_split_name][0],
|
193 |
}
|
194 |
)
|
195 |
)
|