tobiolatunji commited on
Commit
931cf65
1 Parent(s): 7f89ccd

fix audio shard loop

Browse files
Files changed (1) hide show
  1. afrispeech-200.py +6 -5
afrispeech-200.py CHANGED
@@ -182,11 +182,12 @@ class AfriSpeech(datasets.GeneratorBasedBuilder):
182
  splits = ("train", "dev") # , "test"
183
  for split in splits:
184
  if accent == 'all':
185
- audio_urls[split] = [
186
- _AUDIO_URL.format(accent=accent, split=split, shard_idx=i)
187
- for accent in ACCENT_STATS for i in range(ACCENT_STATS[accent][split]['shards'])
188
- if (accent != 'all') and (split in ACCENT_STATS[accent]) and ('shards' in ACCENT_STATS[accent][split])
189
- ]
 
190
  elif accent == 'all':
191
  audio_urls[split] = [
192
  _AUDIO_URL_ALL.format(split=split, shard_idx=i) for i in range(_SHARDS[split])
 
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])