diff --git a/GPT_SoVITS/module/mel_processing.py b/GPT_SoVITS/module/mel_processing.py index 503825ec..422adaa5 100644 --- a/GPT_SoVITS/module/mel_processing.py +++ b/GPT_SoVITS/module/mel_processing.py @@ -68,7 +68,7 @@ def spectrogram_torch(y, n_fft, sampling_rate, hop_size, win_size, center=False) mode="reflect", ) y = y.squeeze(1) - spec = torch.stft( + spec = torch.view_as_real(torch.stft( y, n_fft, hop_length=hop_size, @@ -78,8 +78,8 @@ def spectrogram_torch(y, n_fft, sampling_rate, hop_size, win_size, center=False) pad_mode="reflect", normalized=False, onesided=True, - return_complex=False, - ) + return_complex=True, + )) spec = torch.sqrt(spec.pow(2).sum(-1) + 1e-6) return spec @@ -132,7 +132,7 @@ def mel_spectrogram_torch( ) y = y.squeeze(1) - spec = torch.stft( + spec = torch.view_as_real(torch.stft( y, n_fft, hop_length=hop_size, @@ -142,8 +142,8 @@ def mel_spectrogram_torch( pad_mode="reflect", normalized=False, onesided=True, - return_complex=False, - ) + return_complex=True, + )) spec = torch.sqrt(spec.pow(2).sum(-1) + 1e-6) diff --git a/GPT_SoVITS/onnx_export.py b/GPT_SoVITS/onnx_export.py index ab457d75..a824c2da 100644 --- a/GPT_SoVITS/onnx_export.py +++ b/GPT_SoVITS/onnx_export.py @@ -23,7 +23,7 @@ def spectrogram_torch(y, n_fft, sampling_rate, hop_size, win_size, center=False) mode="reflect", ) y = y.squeeze(1) - spec = torch.stft( + spec = torch.view_as_real(torch.stft( y, n_fft, hop_length=hop_size, @@ -33,8 +33,8 @@ def spectrogram_torch(y, n_fft, sampling_rate, hop_size, win_size, center=False) pad_mode="reflect", normalized=False, onesided=True, - return_complex=False, - ) + return_complex=True, + )) spec = torch.sqrt(spec.pow(2).sum(-1) + 1e-6) return spec