Skip to content

Commit 325b7c6

Browse files
committed
fix bug
1 parent bc62f43 commit 325b7c6

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

training/nsf_HiFigan_task.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,11 @@ def __getitem__(self, index):
9191
start = random.randint(0, audio.shape[0] - 1 - crop_wav_samples)
9292
end = start + crop_wav_samples
9393
audio = audio[start:end]
94-
f0, uv = get_pitch(audio.numpy(), hparams=self.config, speed=speed, interp_uv=True, length=mel.shape[-1])
95-
if f0 is None:
96-
return {'f0': data['f0'], 'spectrogram': data['mel'], 'audio': data['audio']}
9794
audio_aug = wav_aug(audio, self.config["hop_size"], speed=speed)
9895
mel_aug = dynamic_range_compression_torch(self.mel_spec_transform(audio_aug[None,:]))
99-
audio_aug = audio_aug[2*samples_per_frame: -2*samples_per_frame].numpy()
100-
mel_aug = mel_aug[0, :, 2:-2].T.numpy()
96+
f0, uv = get_pitch(audio.numpy(), hparams=self.config, speed=speed, interp_uv=True, length=mel_aug.shape[-1])
97+
if f0 is None:
98+
return {'f0': data['f0'], 'spectrogram': data['mel'], 'audio': data['audio']}
10199
f0_aug = f0[2:-2] * speed
102100
return {'f0': f0_aug, 'spectrogram': mel_aug, 'audio': audio_aug}
103101

0 commit comments

Comments
 (0)