mirror of https://github.com/coqui-ai/TTS.git
linter fixes
This commit is contained in:
parent
e97bb45aba
commit
669a2e1d73
|
@ -179,6 +179,7 @@ class TacotronLoss(torch.nn.Module):
|
||||||
if c.ga_alpha > 0:
|
if c.ga_alpha > 0:
|
||||||
self.criterion_ga = GuidedAttentionLoss(sigma=ga_sigma)
|
self.criterion_ga = GuidedAttentionLoss(sigma=ga_sigma)
|
||||||
# stopnet loss
|
# stopnet loss
|
||||||
|
# pylint: disable=not-callable
|
||||||
self.criterion_st = BCELossMasked(pos_weight=torch.tensor(stopnet_pos_weight)) if c.stopnet else None
|
self.criterion_st = BCELossMasked(pos_weight=torch.tensor(stopnet_pos_weight)) if c.stopnet else None
|
||||||
|
|
||||||
def forward(self, postnet_output, decoder_output, mel_input, linear_input,
|
def forward(self, postnet_output, decoder_output, mel_input, linear_input,
|
||||||
|
|
2
train.py
2
train.py
|
@ -408,7 +408,7 @@ def evaluate(model, criterion, ap, global_step, epoch):
|
||||||
loss_dict['ga_loss'].item(),
|
loss_dict['ga_loss'].item(),
|
||||||
keep_avg['avg_ga_loss'],
|
keep_avg['avg_ga_loss'],
|
||||||
align_score, keep_avg['avg_align_score']),
|
align_score, keep_avg['avg_align_score']),
|
||||||
flush=True)
|
flush=Tr ue)
|
||||||
|
|
||||||
if args.rank == 0:
|
if args.rank == 0:
|
||||||
# Diagnostic visualizations
|
# Diagnostic visualizations
|
||||||
|
|
|
@ -50,7 +50,7 @@ class AudioProcessor(object):
|
||||||
self.clip_norm = clip_norm
|
self.clip_norm = clip_norm
|
||||||
self.do_trim_silence = do_trim_silence
|
self.do_trim_silence = do_trim_silence
|
||||||
self.trim_db = trim_db
|
self.trim_db = trim_db
|
||||||
self.sound_norm = sound_norm
|
self.do_sound_norm = sound_norm
|
||||||
# setup stft parameters
|
# setup stft parameters
|
||||||
if hop_length is None:
|
if hop_length is None:
|
||||||
self.n_fft, self.hop_length, self.win_length = self._stft_parameters()
|
self.n_fft, self.hop_length, self.win_length = self._stft_parameters()
|
||||||
|
@ -232,7 +232,8 @@ class AudioProcessor(object):
|
||||||
return librosa.effects.trim(
|
return librosa.effects.trim(
|
||||||
wav, top_db=self.trim_db, frame_length=self.win_length, hop_length=self.hop_length)[0]
|
wav, top_db=self.trim_db, frame_length=self.win_length, hop_length=self.hop_length)[0]
|
||||||
|
|
||||||
def sound_norm(self, x):
|
@staticmethod
|
||||||
|
def sound_norm(x):
|
||||||
return x / abs(x).max() * 0.9
|
return x / abs(x).max() * 0.9
|
||||||
|
|
||||||
### save and load ###
|
### save and load ###
|
||||||
|
@ -241,6 +242,14 @@ class AudioProcessor(object):
|
||||||
x, sr = sf.read(filename)
|
x, sr = sf.read(filename)
|
||||||
else:
|
else:
|
||||||
x, sr = librosa.load(filename, sr=sr)
|
x, sr = librosa.load(filename, sr=sr)
|
||||||
|
if self.do_trim_silence:
|
||||||
|
try:
|
||||||
|
x = self.trim_silence(x)
|
||||||
|
except ValueError:
|
||||||
|
print(f' [!] File cannot be trimmed for silence - {filename}')
|
||||||
|
assert self.sample_rate == sr, "%s vs %s"%(self.sample_rate, sr)
|
||||||
|
if self.do_sound_norm:
|
||||||
|
x = self.sound_norm(x)
|
||||||
return x
|
return x
|
||||||
|
|
||||||
def save_wav(self, wav, path):
|
def save_wav(self, wav, path):
|
||||||
|
@ -263,20 +272,6 @@ class AudioProcessor(object):
|
||||||
x = np.sign(wav) / mu * ((1 + mu) ** np.abs(wav) - 1)
|
x = np.sign(wav) / mu * ((1 + mu) ** np.abs(wav) - 1)
|
||||||
return x
|
return x
|
||||||
|
|
||||||
def load_wav(self, filename, sr=None):
|
|
||||||
if sr is None:
|
|
||||||
x, sr = sf.read(filename)
|
|
||||||
else:
|
|
||||||
x, sr = librosa.load(filename, sr=sr)
|
|
||||||
if self.do_trim_silence:
|
|
||||||
try:
|
|
||||||
x = self.trim_silence(x)
|
|
||||||
except ValueError:
|
|
||||||
print(f' [!] File cannot be trimmed for silence - {filename}')
|
|
||||||
assert self.sample_rate == sr, "%s vs %s"%(self.sample_rate, sr)
|
|
||||||
if self.sound_norm:
|
|
||||||
x = x / abs(x).max() * 0.9
|
|
||||||
return x
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def encode_16bits(x):
|
def encode_16bits(x):
|
||||||
|
|
Loading…
Reference in New Issue