unsupervised_audio_dataset: try to recover from failures of audio2numpy
This commit is contained in:
parent
5c8d266d4f
commit
359e9e27a7
|
@ -108,9 +108,13 @@ class UnsupervisedAudioDataset(torch.utils.data.Dataset):
|
|||
return torch.stack(related_clips, dim=0), actual_extra_samples
|
||||
|
||||
def __getitem__(self, index):
|
||||
# Split audio_norm into two tensors of equal size.
|
||||
audio_norm, filename = self.get_audio_for_index(index)
|
||||
alt_files, actual_samples = self.get_related_audio_for_index(index)
|
||||
try:
|
||||
# Split audio_norm into two tensors of equal size.
|
||||
audio_norm, filename = self.get_audio_for_index(index)
|
||||
alt_files, actual_samples = self.get_related_audio_for_index(index)
|
||||
except:
|
||||
print(f"Error loading audio for file {filename} or {alt_files}")
|
||||
return self[index+1]
|
||||
|
||||
# This is required when training to make sure all clips align.
|
||||
if self.pad_to is not None:
|
||||
|
|
Loading…
Reference in New Issue
Block a user