Datasets:

Multilinguality:
multilingual
Language Creators:
crowdsourced
Annotations Creators:
crowdsourced
Source Datasets:
extended|common_voice
ArXiv:
Tags:
License:
mariosasko commited on
Commit
a1c4251
1 Parent(s): e095840

Make `path` valid file path in non-streaming mode

Browse files

Fixes https://github.com/huggingface/datasets/issues/5918.

Files changed (1) hide show
  1. common_voice_11_0.py +4 -6
common_voice_11_0.py CHANGED
@@ -186,14 +186,12 @@ class CommonVoice(datasets.GeneratorBasedBuilder):
186
  metadata[row["path"]] = row
187
 
188
  for i, audio_archive in enumerate(archives):
189
- for filename, file in audio_archive:
190
- _, filename = os.path.split(filename)
191
  if filename in metadata:
192
  result = dict(metadata[filename])
193
  # set the audio feature and the path to the extracted file
194
- path = os.path.join(local_extracted_archive_paths[i], filename) if local_extracted_archive_paths else filename
195
  result["audio"] = {"path": path, "bytes": file.read()}
196
- # set path to None if the audio file doesn't exist locally (i.e. in streaming mode)
197
- result["path"] = path if local_extracted_archive_paths else filename
198
-
199
  yield path, result
186
  metadata[row["path"]] = row
187
 
188
  for i, audio_archive in enumerate(archives):
189
+ for path, file in audio_archive:
190
+ _, filename = os.path.split(path)
191
  if filename in metadata:
192
  result = dict(metadata[filename])
193
  # set the audio feature and the path to the extracted file
194
+ path = os.path.join(local_extracted_archive_paths[i], path) if local_extracted_archive_paths else path
195
  result["audio"] = {"path": path, "bytes": file.read()}
196
+ result["path"] = path
 
 
197
  yield path, result