Reduce precision difference for whipser model (#4116)

develop
zxcd 2 days ago committed by GitHub
parent 1e3e186c18
commit af2bdf120f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1613,7 +1613,9 @@ def log_mel_spectrogram(audio: Union[str, np.ndarray, paddle.Tensor],
magnitudes = stft[:, :-1].abs()**2
filters = mel_filters(resource_path, n_mels)
mel_spec = filters @ magnitudes
mel_spec = paddle.to_tensor(
filters.numpy()
@ magnitudes.numpy()) # Use numpy to reduce precision difference
mel_spec = paddle.to_tensor(mel_spec.numpy().tolist())
log_spec = paddle.clip(mel_spec, min=1e-10).log10()

Loading…
Cancel
Save