From 5c46543765192016a5638824cf3ff6fe88081088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eren=20G=C3=B6lge?= Date: Mon, 1 Feb 2021 13:18:56 +0000 Subject: [PATCH] linter fixes and version updates for deps --- TTS/bin/train_vocoder_wavegrad.py | 2 +- TTS/utils/audio.py | 2 +- hubconf.py | 15 ++++++--------- pyproject.toml | 2 +- requirements.txt | 2 +- tests/test_vocoder_gan_datasets.py | 3 ++- 6 files changed, 12 insertions(+), 14 deletions(-) diff --git a/TTS/bin/train_vocoder_wavegrad.py b/TTS/bin/train_vocoder_wavegrad.py index b104652d..fe5fb3d7 100644 --- a/TTS/bin/train_vocoder_wavegrad.py +++ b/TTS/bin/train_vocoder_wavegrad.py @@ -344,7 +344,7 @@ def main(args): # pylint: disable=redefined-outer-name # setup criterion criterion = torch.nn.L1Loss().cuda() - + if use_cuda: model.cuda() criterion.cuda() diff --git a/TTS/utils/audio.py b/TTS/utils/audio.py index 87ae4f5b..3d31ce6e 100644 --- a/TTS/utils/audio.py +++ b/TTS/utils/audio.py @@ -292,7 +292,7 @@ class AudioProcessor(object): return pad // 2, pad // 2 + pad % 2 ### Compute F0 ### - # TODO: pw causes some dep issues + # TODO: pw causes some dep issues # def compute_f0(self, x): # f0, t = pw.dio( # x.astype(np.double), diff --git a/hubconf.py b/hubconf.py index 0e2e60d8..9de4f7b2 100644 --- a/hubconf.py +++ b/hubconf.py @@ -1,9 +1,6 @@ dependencies = ['torch', 'gdown'] import torch -import os -import zipfile -from TTS.utils.generic_utils import get_user_data_dir from TTS.utils.synthesizer import Synthesizer from TTS.utils.manage import ModelManager @@ -15,7 +12,7 @@ def tts(model_name='tts_models/en/ljspeech/tacotron2-DCA', vocoder_name='vocoder >>> synthesizer = torch.hub.load('mozilla/TTS', 'tts', source='github') >>> wavs = synthesizer.tts("This is a test! This is also a test!!") wavs - is a list of values of the synthesized speech. - + Args: model_name (str, optional): One of the model names from .model.json. Defaults to 'tts_models/en/ljspeech/tacotron2-DCA'. vocoder_name (str, optional): One of the model names from .model.json. Defaults to 'vocoder_models/en/ljspeech/mulitband-melgan'. @@ -23,15 +20,15 @@ def tts(model_name='tts_models/en/ljspeech/tacotron2-DCA', vocoder_name='vocoder Returns: TTS.utils.synthesizer.Synthesizer: Synthesizer object wrapping both vocoder and tts models. - """ + """ manager = ModelManager() - + model_path, config_path = manager.download_model(model_name) vocoder_path, vocoder_config_path = manager.download_model(vocoder_name) - + # create synthesizer - synthesizer = Synthesizer(model_path, config_path, vocoder_path, vocoder_config_path) - return synthesizer + synt = Synthesizer(model_path, config_path, vocoder_path, vocoder_config_path) + return synt if __name__ == '__main__': diff --git a/pyproject.toml b/pyproject.toml index fc0aca47..77d6b975 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,2 +1,2 @@ [build-system] -requires = ["setuptools", "wheel", "Cython", "numpy>=1.16.0"] \ No newline at end of file +requires = ["setuptools", "wheel", "Cython", "numpy==1.17.0"] \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 1e92f17e..a427062e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ torch>=1.5 tensorflow==2.3.1 -numpy>=1.16.0 +numpy==1.17.0 scipy>=0.19.0 numba==0.48 librosa==0.7.2 diff --git a/tests/test_vocoder_gan_datasets.py b/tests/test_vocoder_gan_datasets.py index 2a487d9a..99a25dcf 100644 --- a/tests/test_vocoder_gan_datasets.py +++ b/tests/test_vocoder_gan_datasets.py @@ -61,7 +61,8 @@ def gan_dataset_case(batch_size, seq_len, hop_len, conv_pad, return_segments, us mel = ap.melspectrogram(audio) # the first 2 and the last 2 frames are skipped due to the padding # differences in stft - assert (feat - mel[:, :feat1.shape[-1]])[:, 2:-2].sum() <= 0, f' [!] {(feat - mel[:, :feat1.shape[-1]])[:, 2:-2].sum()}' + max_diff = abs((feat - mel[:, :feat1.shape[-1]])[:, 2:-2]).max() + assert max_diff <= 0, f' [!] {max_diff}' count_iter += 1 # if count_iter == max_iter: