Add a cheap trick to avoid short audio clips

This commit is contained in:
Eren Gölge 2022-02-05 20:34:17 +01:00
parent 1a43e05460
commit 7dfd753d91
1 changed files with 2 additions and 1 deletions

View File

@ -229,7 +229,8 @@ class TTSDataset(Dataset):
# after phonemization the text length may change
# this is a shareful 🤭 hack to prevent longer phonemes
# TODO: find a better fix
if len(token_ids) > self.max_text_len:
if len(token_ids) > self.max_text_len or len(wav) < self.min_audio_len:
self.rescue_item_idx += 1
return self.load_data(self.rescue_item_idx)
# get f0 values