From ca694d0190c1253fec267299f024d7653e2eb2b3 Mon Sep 17 00:00:00 2001 From: ZDisket <30500847+ZDisket@users.noreply.github.com> Date: Fri, 26 May 2023 16:49:23 -0300 Subject: [PATCH] Make easier to train on max sample length = 10s --- configs/ljs_li44_tmbert_ft_small_s1_arpa.json | 4 ++-- data_utils.py | 2 +- preprocess.py | 2 +- train.py | 4 +++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/configs/ljs_li44_tmbert_ft_small_s1_arpa.json b/configs/ljs_li44_tmbert_ft_small_s1_arpa.json index 510a92c..d42ee5f 100644 --- a/configs/ljs_li44_tmbert_ft_small_s1_arpa.json +++ b/configs/ljs_li44_tmbert_ft_small_s1_arpa.json @@ -8,8 +8,8 @@ "learning_rate": 2e-4, "betas": [0.8, 0.99], "eps": 1e-9, - "batch_size": 16, - "grad_acc_steps": 2, + "batch_size": 12, + "grad_acc_steps": 3, "fp16_run": true, "lr_decay": 0.999875, "segment_size": 8192, diff --git a/data_utils.py b/data_utils.py index 0b98d91..cea7be2 100644 --- a/data_utils.py +++ b/data_utils.py @@ -58,7 +58,7 @@ class TextAudioLoader(torch.utils.data.Dataset): continue au_len = librosa.get_duration(filename=audiopath) - if au_len > 13.0: + if au_len > 10.0: n_fau += 1 continue diff --git a/preprocess.py b/preprocess.py index 30ebc1d..f53cef3 100644 --- a/preprocess.py +++ b/preprocess.py @@ -24,7 +24,7 @@ if __name__ == '__main__': test_sentences = ["The quick brown fox jumps over the lazy dog", "In a galaxy far, far away, a young hero embarks on an epic adventure", "Ladies and gentlemen, welcome to the annual science fair!", - "The chef skillfully prepares a delicious gourmet meal with fresh ingredients and exquisite flavors", + "Peter Piper picked a peck of pickled peppers. How many pickled peppers did Peter Piper pick?", "The crowd erupted in cheers as the team scored the winning goal in the final seconds of the match"] if len(args.test) > 1: diff --git a/train.py b/train.py index 9075a43..37e76e5 100644 --- a/train.py +++ b/train.py @@ -394,7 +394,9 @@ def evaluate(hps, generator, eval_loader, writer_eval): t_bert_lens = torch.LongTensor([t_bert.size(1)]).cuda(0) t_bert = t_bert.cuda(0) - audio, attn, t_mask, _ = generator.module.infer(t_text_norm, t_text_lengths, t_moji, t_bert, t_bert_lens, noise_scale=.667, noise_scale_w=0.8, length_scale=1.0) + with torch.no_grad(): + audio, attn, t_mask, _ = generator.module.infer(t_text_norm, t_text_lengths, t_moji, t_bert, t_bert_lens, noise_scale=.667, noise_scale_w=0.8, length_scale=1.0) + test_audio_lengths = t_mask.sum([1,2]).long() * hps.data.hop_length y_test_mel = mel_spectrogram_torch( audio.squeeze(1).float(),