tacotron_dataset: recover gracefully

This commit is contained in:
James Betker 2021-11-03 00:31:50 -06:00
parent af51d00dee
commit 2fa80486de

View File

@ -84,7 +84,11 @@ class TextWavLoader(torch.utils.data.Dataset):
return text_norm
def __getitem__(self, index):
tseq, wav, text, path = self.get_wav_text_pair(self.audiopaths_and_text[index])
try:
tseq, wav, text, path = self.get_wav_text_pair(self.audiopaths_and_text[index])
except:
print(f"error loadding {self.audiopaths_and_text[index][0]")
return self[index+1]
if wav is None or \
(self.max_wav_len is not None and wav.shape[-1] > self.max_wav_len) or \
(self.max_text_len is not None and tseq.shape[0] > self.max_text_len):