Gadersd / whisper-burn

A Rust implementation of OpenAI's Whisper model using the burn framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Panic while transcribing audio.wav

meowcoder opened this issue · comments

thread 'main' panicked at 'slice index starts at 172409 but ends at 168511', 
/tmp/whisper-burn/src/transcribe.rs:101:22

let iter_len = (waveform.len() - n_samples_per_tensor) / shift + 1;

Here waveform.len() could be less than n_samples_per_tensor, which results in iter_len to be extremely large:

[src/transcribe.rs:97] n_samples_per_tensor = 238559
[src/transcribe.rs:97] waveform.len() = 168511
[src/transcribe.rs:97] waveform.len() - n_samples_per_tensor = 18446744073709481568

Replacing subtraction with saturating_sub fixes the issue.

Nice catch! I just pushed your correction.