Add debug_failures flag

This commit is contained in:
James Betker 2021-12-23 16:12:16 -07:00
parent 9677f7084c
commit ead2a74bf0

View File

@ -60,6 +60,7 @@ class TextWavLoader(torch.utils.data.Dataset):
self.load_conditioning = opt_get(hparams, ['load_conditioning'], False) self.load_conditioning = opt_get(hparams, ['load_conditioning'], False)
self.conditioning_candidates = opt_get(hparams, ['num_conditioning_candidates'], 3) self.conditioning_candidates = opt_get(hparams, ['num_conditioning_candidates'], 3)
self.conditioning_length = opt_get(hparams, ['conditioning_length'], 44100) self.conditioning_length = opt_get(hparams, ['conditioning_length'], 44100)
self.debug_failures = opt_get(hparams, ['debug_loading_failures'], False)
self.audiopaths_and_text = [] self.audiopaths_and_text = []
for p, fm in zip(self.path, fetcher_mode): for p, fm in zip(self.path, fetcher_mode):
if fm == 'lj' or fm == 'libritts': if fm == 'lj' or fm == 'libritts':
@ -127,6 +128,7 @@ class TextWavLoader(torch.utils.data.Dataset):
tseq, wav, text, path = self.get_wav_text_pair(self.audiopaths_and_text[index]) tseq, wav, text, path = self.get_wav_text_pair(self.audiopaths_and_text[index])
cond = self.load_conditioning_candidates(self.audiopaths_and_text[index][0]) if self.load_conditioning else None cond = self.load_conditioning_candidates(self.audiopaths_and_text[index][0]) if self.load_conditioning else None
except: except:
if self.debug_failures:
print(f"error loading {self.audiopaths_and_text[index][0]}") print(f"error loading {self.audiopaths_and_text[index][0]}")
return self[index+1] return self[index+1]
if wav is None or \ if wav is None or \