Fix bug in whisper transformer (#2681)

* 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>
This commit is contained in:
mert-kurttutan
2024-12-24 13:58:21 +01:00
committed by GitHub
parent 11aa30be10
commit cd639131f0

View File

@ -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);