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

fixing split generator

Browse files
Files changed (1) hide show
  1. FIREBALL.py +20 -23
FIREBALL.py CHANGED
@@ -76,7 +76,7 @@ class NewDataset(datasets.GeneratorBasedBuilder):
76
  # data = datasets.load_dataset('my_dataset', 'first_domain')
77
  # data = datasets.load_dataset('my_dataset', 'second_domain')
78
  BUILDER_CONFIGS = [
79
- datasets.BuilderConfig(name="FIREBALL", version=VERSION, description="This part of my dataset covers a first domain"),
80
  ]
81
 
82
  DEFAULT_CONFIG_NAME = "FIREBALL" # It's not mandatory to have a default configuration. Just use one if it make sense.
@@ -181,28 +181,25 @@ class NewDataset(datasets.GeneratorBasedBuilder):
181
  citation=_CITATION,
182
  )
183
 
184
- # def _split_generators(self, dl_manager):
185
- # # TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
186
- # # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
187
-
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
- # for root,dirs,files in os.walk(data_dir):
194
- # for f in files:
195
- # data = os.path.join()
196
- # return [
197
- # datasets.SplitGenerator(
198
- # name=datasets.Split.TRAIN,
199
- # # These kwargs will be passed to _generate_examples
200
- # gen_kwargs={
201
- # "filepath": os.path.join(data_dir, "train.jsonl"),
202
- # "split": "train",
203
- # },
204
- # ),
205
- # ]
206
 
207
  # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
208
  def _generate_examples(self, filepath, split):
 
76
  # data = datasets.load_dataset('my_dataset', 'first_domain')
77
  # data = datasets.load_dataset('my_dataset', 'second_domain')
78
  BUILDER_CONFIGS = [
79
+ datasets.BuilderConfig(name="FIREBALL", version=VERSION),
80
  ]
81
 
82
  DEFAULT_CONFIG_NAME = "FIREBALL" # It's not mandatory to have a default configuration. Just use one if it make sense.
 
181
  citation=_CITATION,
182
  )
183
 
184
+ def _split_generators(self, dl_manager):
185
+ # TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
186
+ # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
187
+
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
+ ]
 
 
 
203
 
204
  # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
205
  def _generate_examples(self, filepath, split):