lara-martin commited on
Commit
d23d0f2
1 Parent(s): 18f66bd

Update FIREBALL.py

Browse files
Files changed (1) hide show
  1. FIREBALL.py +6 -7
FIREBALL.py CHANGED
@@ -188,15 +188,15 @@ class NewDataset(datasets.GeneratorBasedBuilder):
188
  # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
189
  # It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
190
  # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
191
- urls = _URLS[self.config.name]
192
- data_dir = dl_manager.download_and_extract(urls)
 
193
  return [
194
  datasets.SplitGenerator(
195
  name=datasets.Split.TRAIN,
196
  # These kwargs will be passed to _generate_examples
197
  gen_kwargs={
198
- "filepath": data_dir,
199
- "split": "train",
200
  },
201
  ),
202
  ]
@@ -206,9 +206,8 @@ class NewDataset(datasets.GeneratorBasedBuilder):
206
  # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
207
  # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
208
  key = 0
209
- for root,dirs,files in os.walk(filepath):
210
- for file in files:
211
- with jsonlines.open(os.path.join(root,file)) as f:
212
  for data in f:
213
  # Yields examples as (key, example) tuples
214
  yield key, {
 
188
  # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
189
  # It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
190
  # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
191
+ url = _URLS[self.config.name]
192
+ #data_dir = dl_manager.download_and_extract(urls)
193
+ downloaded_files = dl_manager.download([files for root,dir,files in os.walk(url)][0])
194
  return [
195
  datasets.SplitGenerator(
196
  name=datasets.Split.TRAIN,
197
  # These kwargs will be passed to _generate_examples
198
  gen_kwargs={
199
+ "filepath": downloaded_files
 
200
  },
201
  ),
202
  ]
 
206
  # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
207
  # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
208
  key = 0
209
+ for file in filepath:
210
+ with jsonlines.open(file) as f:
 
211
  for data in f:
212
  # Yields examples as (key, example) tuples
213
  yield key, {