]> git.djapps.eu Git - pkg/ggml/sources/ggml/commitdiff
whisper : switch back to F32 mask (whisper/0)
authorGeorgi Gerganov <redacted>
Mon, 13 May 2024 11:43:43 +0000 (14:43 +0300)
committerGeorgi Gerganov <redacted>
Tue, 14 May 2024 12:31:03 +0000 (15:31 +0300)
examples/whisper/whisper.cpp

index f3daf5b6d6058a7ea071e64332fe5e80351bb51c..bdcf3de40e25cda20098ec974f6c83c8c5434b21 100644 (file)
@@ -2294,8 +2294,6 @@ static struct ggml_cgraph * whisper_build_graph_decoder(
     ggml_set_name(KQ_mask, "KQ_mask");
     ggml_set_input(KQ_mask);
 
-    struct ggml_tensor * KQ_mask_f16 = ggml_cast(ctx0, KQ_mask, GGML_TYPE_F16);
-
     // token encoding + position encoding
     struct ggml_tensor * cur =
         ggml_add(ctx0,
@@ -2379,7 +2377,7 @@ static struct ggml_cgraph * whisper_build_graph_decoder(
             // K * Q
             struct ggml_tensor * KQ = ggml_mul_mat(ctx0, K, Q);
 
-            struct ggml_tensor * KQ_soft_max = ggml_soft_max_ext(ctx0, KQ, KQ_mask_f16, 1.0f, 0.0f);
+            struct ggml_tensor * KQ_soft_max = ggml_soft_max_ext(ctx0, KQ, KQ_mask, 1.0f, 0.0f);
 
             struct ggml_tensor * V =
                 ggml_view_3d(ctx0, kv_self.v,
@@ -2873,8 +2871,8 @@ static void log_mel_spectrogram_worker_thread(int ith, const std::vector<float>
     int i = ith;
 
     // make sure n_fft == 1 + (WHISPER_N_FFT / 2), bin_0 to bin_nyquist
-    assert( n_fft == 1 + (frame_size / 2) );
-    
+    assert(n_fft == 1 + (frame_size / 2));
+
     // calculate FFT only when fft_in are not all zero
     for (; i < std::min(n_samples / frame_step + 1, mel.n_len); i += n_threads) {
         const int offset = i * frame_step;