Datasets:

Tasks:
Other
Modalities:
Text
Formats:
parquet
Languages:
English
ArXiv:
Libraries:
Datasets
Dask
License:
albertvillanova HF staff commited on
Commit
ed99faa
1 Parent(s): 1189b51

Optimize downloading (#9)

Browse files

- Optimize downloading (a7c0106af07122b2e780761e87b9c54fa763c56f)

Files changed (1) hide show
  1. P3.py +5 -6
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.download_and_extract(_URLs)
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[task_name][split_name][0],
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[task_name][split_name][0],
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[task_name][split_name][0],
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[task_name][special_split_name][0],
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
  )