From cd639131f04990c16bfc498ea347cb9df3d2374f Mon Sep 17 00:00:00 2001 From: mert-kurttutan Date: Tue, 24 Dec 2024 13:58:21 +0100 Subject: 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 --- candle-transformers/src/models/whisper/audio.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'candle-transformers') diff --git a/candle-transformers/src/models/whisper/audio.rs b/candle-transformers/src/models/whisper/audio.rs index 35f9f3df..8490533c 100644 --- a/candle-transformers/src/models/whisper/audio.rs +++ b/candle-transformers/src/models/whisper/audio.rs @@ -204,6 +204,7 @@ pub fn log_mel_spectrogram_( // 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); -- cgit v1.2.3