Skip to content

Commit

Permalink
whisper : switch back to F32 mask (#0)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggerganov committed May 13, 2024
1 parent e93081f commit 2b434c4
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions whisper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 2b434c4

Please sign in to comment.