From 9767260c6c693b17a25abe9de46b3a1f7f9ebf8c Mon Sep 17 00:00:00 2001 From: James Betker Date: Tue, 15 Mar 2022 10:31:26 -0600 Subject: [PATCH] tacotron stft - loosen bounds restrictions and clip --- codes/models/tacotron2/layers.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/codes/models/tacotron2/layers.py b/codes/models/tacotron2/layers.py index 81a5ab94..baaa7fd6 100644 --- a/codes/models/tacotron2/layers.py +++ b/codes/models/tacotron2/layers.py @@ -70,11 +70,12 @@ class TacotronSTFT(torch.nn.Module): ------- mel_output: torch.FloatTensor of shape (B, n_mel_channels, T) """ - assert(torch.min(y.data) >= -1) - assert(torch.max(y.data) <= 1) + assert(torch.min(y.data) >= -10) + assert(torch.max(y.data) <= 10) + y = torch.clip(y, min=-1, max=1) magnitudes, phases = self.stft_fn.transform(y) magnitudes = magnitudes.data mel_output = torch.matmul(self.mel_basis, magnitudes) mel_output = self.spectral_normalize(mel_output) - return mel_output \ No newline at end of file + return mel_output