Fix streaming filenames
Browse files
multilingual_librispeech.py
CHANGED
@@ -22,6 +22,7 @@ import os
|
|
22 |
|
23 |
import datasets
|
24 |
from datasets.tasks import AutomaticSpeechRecognition
|
|
|
25 |
|
26 |
|
27 |
_CITATION = """\
|
@@ -222,12 +223,12 @@ def download_audio_archives(dl_manager, root_dir, split):
|
|
222 |
# each split contains many .tar.gz archives with its audio files
|
223 |
# audio_filenames.txt contains the names of these archives
|
224 |
split_dir = os.path.join(root_dir, split)
|
225 |
-
audio_filenames_path = dl_manager.
|
226 |
|
227 |
-
with
|
228 |
audio_filenames = [line.strip() for line in file.readlines()]
|
229 |
|
230 |
archive_paths = dl_manager.download([os.path.join(split_dir, "audio", filename) for filename in audio_filenames])
|
231 |
audio_archives = [dl_manager.iter_archive(archive_path) for archive_path in archive_paths]
|
232 |
|
233 |
-
return audio_archives
|
|
|
22 |
|
23 |
import datasets
|
24 |
from datasets.tasks import AutomaticSpeechRecognition
|
25 |
+
from datasets.utils.streaming_download_manager import xopen
|
26 |
|
27 |
|
28 |
_CITATION = """\
|
|
|
223 |
# each split contains many .tar.gz archives with its audio files
|
224 |
# audio_filenames.txt contains the names of these archives
|
225 |
split_dir = os.path.join(root_dir, split)
|
226 |
+
audio_filenames_path = dl_manager.download(os.path.join(split_dir, "audio_filenames.txt"))
|
227 |
|
228 |
+
with xopen(audio_filenames_path, "r", encoding="utf-8") as file:
|
229 |
audio_filenames = [line.strip() for line in file.readlines()]
|
230 |
|
231 |
archive_paths = dl_manager.download([os.path.join(split_dir, "audio", filename) for filename in audio_filenames])
|
232 |
audio_archives = [dl_manager.iter_archive(archive_path) for archive_path in archive_paths]
|
233 |
|
234 |
+
return audio_archives
|