forked from mrq/DL-Art-School
Just offer generic re-load for nv-tacotron
This commit is contained in:
parent
154f5aa73c
commit
0c4d6b1916
|
@ -98,8 +98,12 @@ class TextMelLoader(torch.utils.data.Dataset):
|
||||||
return text_norm
|
return text_norm
|
||||||
|
|
||||||
def __getitem__(self, index):
|
def __getitem__(self, index):
|
||||||
t, m, p = self.get_mel_text_pair(self.audiopaths_and_text[index])
|
try:
|
||||||
if self.max_mel_len != None and m.shape[-1] > self.max_mel_len:
|
t, m, p = self.get_mel_text_pair(self.audiopaths_and_text[index])
|
||||||
|
reload = False
|
||||||
|
except:
|
||||||
|
reload = True
|
||||||
|
if reload and self.max_mel_len != None and m.shape[-1] > self.max_mel_len:
|
||||||
# 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))
|
||||||
return self[rv]
|
return self[rv]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user