Fixing the dummy files.
Browse files- asr_dummy.py +8 -5
asr_dummy.py
CHANGED
@@ -159,21 +159,24 @@ class AsrDummy(datasets.GeneratorBasedBuilder):
|
|
159 |
)
|
160 |
|
161 |
def _split_generators(self, dl_manager):
|
162 |
-
|
|
|
|
|
|
|
|
|
163 |
return [
|
164 |
datasets.SplitGenerator(
|
165 |
name=datasets.Split.TEST,
|
166 |
-
gen_kwargs={"archive_path": archive_path
|
167 |
),
|
168 |
]
|
169 |
|
170 |
def _generate_examples(self, archive_path):
|
171 |
"""Generate examples."""
|
172 |
-
for i in
|
173 |
-
path = os.path.join(archive_path, f"{i+1}.flac")
|
174 |
key = str(i)
|
175 |
example = {
|
176 |
"id": key,
|
177 |
-
"file":
|
178 |
}
|
179 |
yield key, example
|
|
|
159 |
)
|
160 |
|
161 |
def _split_generators(self, dl_manager):
|
162 |
+
DL_URLS = [
|
163 |
+
f"https://huggingface.co/datasets/Narsil/asr_dummy/raw/main/{i}.flac"
|
164 |
+
for i in range(1, 4)
|
165 |
+
]
|
166 |
+
archive_path = dl_manager.download_and_extract(DL_URLS)
|
167 |
return [
|
168 |
datasets.SplitGenerator(
|
169 |
name=datasets.Split.TEST,
|
170 |
+
gen_kwargs={"archive_path": archive_path},
|
171 |
),
|
172 |
]
|
173 |
|
174 |
def _generate_examples(self, archive_path):
|
175 |
"""Generate examples."""
|
176 |
+
for i, filename in enumerate(archive_path):
|
|
|
177 |
key = str(i)
|
178 |
example = {
|
179 |
"id": key,
|
180 |
+
"file": filename,
|
181 |
}
|
182 |
yield key, example
|