tobiolatunji commited on
Commit
1042eff
1 Parent(s): 931cf65

fix audio shard loop

Browse files
Files changed (1) hide show
  1. afrispeech-200.py +5 -3
afrispeech-200.py CHANGED
@@ -181,14 +181,14 @@ class AfriSpeech(datasets.GeneratorBasedBuilder):
181
  audio_urls = {}
182
  splits = ("train", "dev") # , "test"
183
  for split in splits:
184
- if accent == 'all':
185
  audio_urls[split] = []
186
  for accent in ACCENT_STATS:
187
  if accent == "all" or split not in ACCENT_STATS[accent]:
188
  continue
189
  for i in range(ACCENT_STATS[accent][split]['shards']):
190
  audio_urls[split].append(_AUDIO_URL.format(accent=accent, split=split, shard_idx=i))
191
- elif accent == 'all':
192
  audio_urls[split] = [
193
  _AUDIO_URL_ALL.format(split=split, shard_idx=i) for i in range(_SHARDS[split])
194
  ]
@@ -199,7 +199,9 @@ class AfriSpeech(datasets.GeneratorBasedBuilder):
199
  ]
200
  archive_paths = dl_manager.download(audio_urls)
201
  local_extracted_archive_paths = dl_manager.extract(archive_paths) if not dl_manager.is_streaming else {}
202
-
 
 
203
  if accent == 'all':
204
  meta_urls = {split: _TRANSCRIPT_URL_ALL.format(split=split) for split in splits}
205
  elif accent == 'allx':
 
181
  audio_urls = {}
182
  splits = ("train", "dev") # , "test"
183
  for split in splits:
184
+ if self.config.name == 'all':
185
  audio_urls[split] = []
186
  for accent in ACCENT_STATS:
187
  if accent == "all" or split not in ACCENT_STATS[accent]:
188
  continue
189
  for i in range(ACCENT_STATS[accent][split]['shards']):
190
  audio_urls[split].append(_AUDIO_URL.format(accent=accent, split=split, shard_idx=i))
191
+ elif accent == 'allx':
192
  audio_urls[split] = [
193
  _AUDIO_URL_ALL.format(split=split, shard_idx=i) for i in range(_SHARDS[split])
194
  ]
 
199
  ]
200
  archive_paths = dl_manager.download(audio_urls)
201
  local_extracted_archive_paths = dl_manager.extract(archive_paths) if not dl_manager.is_streaming else {}
202
+
203
+ accent = self.config.name
204
+
205
  if accent == 'all':
206
  meta_urls = {split: _TRANSCRIPT_URL_ALL.format(split=split) for split in splits}
207
  elif accent == 'allx':