mirror of
https://github.com/openai/whisper.git
synced 2025-11-24 14:35:57 +00:00
Add error handling to log_mel_spectrogram function
This commit is contained in:
parent
ba3f3cd54b
commit
49c833dcee
@ -140,6 +140,9 @@ def log_mel_spectrogram(
|
||||
audio = load_audio(audio)
|
||||
audio = torch.from_numpy(audio)
|
||||
|
||||
if len(audio) < N_SAMPLES: # Check if audio length is less than expected
|
||||
raise ValueError("Input audio length is shorter than the expected length.")
|
||||
|
||||
if device is not None:
|
||||
audio = audio.to(device)
|
||||
if padding > 0:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user