From e3f841742d3f2c0a919f9f220d5286723d1cd082 Mon Sep 17 00:00:00 2001 From: Reuben Morais Date: Fri, 19 Jul 2019 11:48:12 +0200 Subject: [PATCH] Address even more lint problems --- models/tacotron2.py | 4 ++-- tests/test_layers.py | 1 + tests/test_loader.py | 2 ++ tests/test_tacotron2_model.py | 2 ++ tests/test_tacotron_model.py | 4 +++- 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/models/tacotron2.py b/models/tacotron2.py index a77afd21..05b4c0fd 100644 --- a/models/tacotron2.py +++ b/models/tacotron2.py @@ -88,8 +88,8 @@ class Tacotron2(nn.Module): def _add_speaker_embedding(self, encoder_outputs, speaker_ids): if hasattr(self, "speaker_embedding") and speaker_ids is None: - raise RuntimeError(" [!] Model has speaker embedding layer but speaker_id is not provided") - elif hasattr(self, "speaker_embedding") and speaker_ids is not None: + raise RuntimeError(" [!] Model has speaker embedding layer but speaker_id is not provided") + if hasattr(self, "speaker_embedding") and speaker_ids is not None: speaker_embeddings = self.speaker_embedding(speaker_ids) speaker_embeddings.unsqueeze_(1) diff --git a/tests/test_layers.py b/tests/test_layers.py index 257628d0..7d9e0650 100644 --- a/tests/test_layers.py +++ b/tests/test_layers.py @@ -5,6 +5,7 @@ from layers.tacotron import Prenet, CBHG, Decoder, Encoder from layers.losses import L1LossMasked from utils.generic_utils import sequence_mask +#pylint: disable=unused-variable class PrenetTests(unittest.TestCase): def test_in_out(self): diff --git a/tests/test_loader.py b/tests/test_loader.py index dd69ffc2..5d1f83b6 100644 --- a/tests/test_loader.py +++ b/tests/test_loader.py @@ -8,6 +8,8 @@ from utils.audio import AudioProcessor from datasets import TTSDataset from datasets.preprocess import ljspeech +#pylint: disable=unused-variable + file_path = os.path.dirname(os.path.realpath(__file__)) OUTPATH = os.path.join(file_path, "outputs/loader_tests/") os.makedirs(OUTPATH, exist_ok=True) diff --git a/tests/test_tacotron2_model.py b/tests/test_tacotron2_model.py index c2c39231..d0a6a3ee 100644 --- a/tests/test_tacotron2_model.py +++ b/tests/test_tacotron2_model.py @@ -10,6 +10,8 @@ from utils.generic_utils import load_config from layers.losses import MSELossMasked from models.tacotron2 import Tacotron2 +#pylint: disable=unused-variable + torch.manual_seed(1) use_cuda = torch.cuda.is_available() device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") diff --git a/tests/test_tacotron_model.py b/tests/test_tacotron_model.py index 78a66f44..dfdebbfc 100644 --- a/tests/test_tacotron_model.py +++ b/tests/test_tacotron_model.py @@ -9,6 +9,8 @@ from utils.generic_utils import load_config from layers.losses import L1LossMasked from models.tacotron import Tacotron +#pylint: disable=unused-variable + torch.manual_seed(1) use_cuda = torch.cuda.is_available() device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") @@ -45,7 +47,7 @@ class TacotronTrainTest(unittest.TestCase): criterion_st = nn.BCEWithLogitsLoss().to(device) model = Tacotron( 32, - 5, + 5, linear_dim=c.audio['num_freq'], mel_dim=c.audio['num_mels'], r=c.r,