Skip to content

Commit

Permalink
Fix bug in whisper transformer (#2681)
Browse files Browse the repository at this point in the history
* Fix bug in whisper transformer
- due to num_threads going to zero
in single threaded case

* Apply rustfmt.

---------

Co-authored-by: Laurent <laurent.mazare@gmail.com>
  • Loading branch information
mert-kurttutan and LaurentMazare authored Dec 24, 2024
1 parent 11aa30b commit cd63913
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions candle-transformers/src/models/whisper/audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ pub fn log_mel_spectrogram_<T: Float>(

// ensure that the number of threads is even and less than 12
let n_threads = std::cmp::min(get_num_threads() - get_num_threads() % 2, 12);
let n_threads = std::cmp::max(n_threads, 2);

let hann = Arc::new(hann);
let samples = Arc::new(samples);
Expand Down

0 comments on commit cd63913

Please sign in to comment.