Skip to content
This repository was archived by the owner on Nov 21, 2025. It is now read-only.

Commit b92361b

Browse files
fix-torch-stft-error-on-gpus-sm-53
This pull request addresses an issue that arises when executing the finetune_speaker_v2.py script on GPUs with compute capability less than SM_53. The error occurs at line 104 of mel_processing.py, where the torch.stft() function is called with a half data type. To fix this, I updated the data type to float.
1 parent 8137fb9 commit b92361b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mel_processing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ def mel_spectrogram_torch(y, n_fft, num_mels, sampling_rate, hop_size, win_size,
101101
y = torch.nn.functional.pad(y.unsqueeze(1), (int((n_fft-hop_size)/2), int((n_fft-hop_size)/2)), mode='reflect')
102102
y = y.squeeze(1)
103103

104-
spec = torch.stft(y, n_fft, hop_length=hop_size, win_length=win_size, window=hann_window[wnsize_dtype_device],
105-
center=center, pad_mode='reflect', normalized=False, onesided=True)
104+
spec = torch.stft(y.float(), n_fft, hop_length=hop_size, win_length=win_size, window=hann_window[wnsize_dtype_device],
105+
center=center, pad_mode='reflect', normalized=False, onesided=True)
106106

107107
spec = torch.sqrt(spec.pow(2).sum(-1) + 1e-6)
108108

0 commit comments

Comments
 (0)