From 742f9c54da050516fb01c4cb28677f950e349bc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eren=20G=C3=B6lge?= Date: Fri, 10 Sep 2021 08:26:05 +0000 Subject: [PATCH] Warn user if nan in GL --- TTS/utils/audio.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/TTS/utils/audio.py b/TTS/utils/audio.py index a8952afc..45c061d2 100644 --- a/TTS/utils/audio.py +++ b/TTS/utils/audio.py @@ -608,6 +608,9 @@ class AudioProcessor(object): angles = np.exp(2j * np.pi * np.random.rand(*S.shape)) S_complex = np.abs(S).astype(np.complex) y = self._istft(S_complex * angles) + if not np.isfinite(y).all(): + print(" [!] Waveform is not finite everywhere. Skipping the GL.") + return np.array([0]) for _ in range(self.griffin_lim_iters): angles = np.exp(1j * np.angle(self._stft(y))) y = self._istft(S_complex * angles)