Skip to content

Commit

Permalink
whisper : handle empty mel (ggerganov#2324)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggerganov authored and iThalay committed Sep 23, 2024
1 parent 58e9b82 commit cdfe9a6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/whisper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1920,7 +1920,7 @@ static struct ggml_cgraph * whisper_build_graph_conv(
ggml_set_input(mel_inp);

ggml_tensor * mel;
{
if (ggml_nelements(mel_inp) > 0) {
const int n_len = int(mel_inp->ne[0]);
const int out_s = 2 * n_ctx;
const int i0 = std::min(mel_offset, n_len);
Expand All @@ -1937,6 +1937,9 @@ static struct ggml_cgraph * whisper_build_graph_conv(
} else {
mel = ggml_cont(ctx0, cur);
}
} else {
// empty mel - just create a dummy tensor with the correct size
mel = ggml_new_tensor_2d(ctx0, GGML_TYPE_F32, 2*n_ctx, n_mels);
}

ggml_set_name(mel, "mel");
Expand Down

0 comments on commit cdfe9a6

Please sign in to comment.