fixing split generator
Browse files- 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
|
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 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
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):
|