Ruff autofix E71*

This commit is contained in:
Aarni Koskela 2023-09-27 00:44:08 +03:00
parent 90991e89b4
commit 449820ec7d
8 changed files with 12 additions and 12 deletions

View File

@ -231,7 +231,7 @@ class TTS(nn.Module):
raise ValueError("Model is not multi-speaker but `speaker` is provided.")
if not self.is_multi_lingual and language is not None:
raise ValueError("Model is not multi-lingual but `language` is provided.")
if not emotion is None and not speed is None:
if emotion is not None and speed is not None:
raise ValueError("Emotion and speed can only be used with Coqui Studio models. Which is discontinued.")
def tts(

View File

@ -34,7 +34,7 @@ class AugmentWAV(object):
# ignore not listed directories
if noise_dir not in self.additive_noise_types:
continue
if not noise_dir in self.noise_list:
if noise_dir not in self.noise_list:
self.noise_list[noise_dir] = []
self.noise_list[noise_dir].append(wav_file)

View File

@ -415,7 +415,7 @@ class AlignTTS(BaseTTS):
"""Decide AlignTTS training phase"""
if isinstance(config.phase_start_steps, list):
vals = [i < global_step for i in config.phase_start_steps]
if not True in vals:
if True not in vals:
phase = 0
else:
phase = (

View File

@ -1880,7 +1880,7 @@ class Vits(BaseTTS):
self.forward = _forward
if training:
self.train()
if not disc is None:
if disc is not None:
self.disc = disc
def load_onnx(self, model_path: str, cuda=False):
@ -1914,9 +1914,9 @@ class Vits(BaseTTS):
dtype=np.float32,
)
input_params = {"input": x, "input_lengths": x_lengths, "scales": scales}
if not speaker_id is None:
if speaker_id is not None:
input_params["sid"] = torch.tensor([speaker_id]).cpu().numpy()
if not language_id is None:
if language_id is not None:
input_params["langid"] = torch.tensor([language_id]).cpu().numpy()
audio = self.onnx_sess.run(

View File

@ -516,7 +516,7 @@ class ModelManager(object):
sub_conf[field_names[-1]] = new_path
else:
# field name points to a top-level field
if not field_name in config:
if field_name not in config:
return
if isinstance(config[field_name], list):
config[field_name] = [new_path]

View File

@ -164,7 +164,7 @@ class DiscriminatorP(torch.nn.Module):
super(DiscriminatorP, self).__init__()
self.period = period
self.use_spectral_norm = use_spectral_norm
norm_f = weight_norm if use_spectral_norm == False else spectral_norm
norm_f = weight_norm if use_spectral_norm is False else spectral_norm
self.convs = nn.ModuleList(
[
norm_f(Conv2d(1, 32, (kernel_size, 1), (stride, 1), padding=(get_padding(kernel_size, 1), 0))),
@ -201,7 +201,7 @@ class DiscriminatorP(torch.nn.Module):
class DiscriminatorS(torch.nn.Module):
def __init__(self, use_spectral_norm=False):
super(DiscriminatorS, self).__init__()
norm_f = weight_norm if use_spectral_norm == False else spectral_norm
norm_f = weight_norm if use_spectral_norm is False else spectral_norm
self.convs = nn.ModuleList(
[
norm_f(Conv1d(1, 16, 15, 1, padding=7)),
@ -468,7 +468,7 @@ class FreeVC(BaseVC):
Returns:
torch.Tensor: Output tensor.
"""
if c_lengths == None:
if c_lengths is None:
c_lengths = (torch.ones(c.size(0)) * c.size(-1)).to(c.device)
if not self.use_spk:
g = self.enc_spk.embed_utterance(mel)

View File

@ -387,7 +387,7 @@ class ConvFeatureExtractionModel(nn.Module):
nn.init.kaiming_normal_(conv.weight)
return conv
assert (is_layer_norm and is_group_norm) == False, "layer norm and group norm are exclusive"
assert (is_layer_norm and is_group_norm) is False, "layer norm and group norm are exclusive"
if is_layer_norm:
return nn.Sequential(

View File

@ -298,7 +298,7 @@ class GeneratorLoss(nn.Module):
adv_loss = adv_loss + self.hinge_gan_loss_weight * hinge_fake_loss
# Feature Matching Loss
if self.use_feat_match_loss and not feats_fake is None:
if self.use_feat_match_loss and feats_fake is not None:
feat_match_loss = self.feat_match_loss(feats_fake, feats_real)
return_dict["G_feat_match_loss"] = feat_match_loss
adv_loss = adv_loss + self.feat_match_loss_weight * feat_match_loss