Found error that I was trying to fix with reload=True

This commit is contained in:
James Betker 2021-08-12 15:22:34 -06:00
parent 430b650a34
commit 5b07d3b623

View File

@ -98,17 +98,11 @@ class TextMelLoader(torch.utils.data.Dataset):
return text_norm return text_norm
def __getitem__(self, index): def __getitem__(self, index):
try:
t, m, p = self.get_mel_text_pair(self.audiopaths_and_text[index]) t, m, p = self.get_mel_text_pair(self.audiopaths_and_text[index])
reload = False if self.max_mel_len is not None and m.shape[-1] > self.max_mel_len:
except: print(f"Exception {index} mel_len:{m.shape[-1]} fname: {p}")
reload = True
if reload or (self.max_mel_len != None and m.shape[-1] > self.max_mel_len):
print(f"Exception {index} {reload}")
if not reload:
print(f"mel_len:{m.shape[-1]} fname: {p}")
# It's hard to handle this situation properly. Best bet is to return the a random valid token and skew the dataset somewhat as a result. # It's hard to handle this situation properly. Best bet is to return the a random valid token and skew the dataset somewhat as a result.
rv = random.randint(0,len(self)) rv = random.randint(0,len(self)-1)
return self[rv] return self[rv]
return t, m, p return t, m, p