mirror of
https://github.com/ggerganov/whisper.cpp.git
synced 2025-02-27 23:52:08 +01:00
whisper : handle empty mel (#2324)
This commit is contained in:
parent
f68298ce06
commit
6739eb83c3
@ -1920,7 +1920,7 @@ static struct ggml_cgraph * whisper_build_graph_conv(
|
|||||||
ggml_set_input(mel_inp);
|
ggml_set_input(mel_inp);
|
||||||
|
|
||||||
ggml_tensor * mel;
|
ggml_tensor * mel;
|
||||||
{
|
if (ggml_nelements(mel_inp) > 0) {
|
||||||
const int n_len = int(mel_inp->ne[0]);
|
const int n_len = int(mel_inp->ne[0]);
|
||||||
const int out_s = 2 * n_ctx;
|
const int out_s = 2 * n_ctx;
|
||||||
const int i0 = std::min(mel_offset, n_len);
|
const int i0 = std::min(mel_offset, n_len);
|
||||||
@ -1937,6 +1937,9 @@ static struct ggml_cgraph * whisper_build_graph_conv(
|
|||||||
} else {
|
} else {
|
||||||
mel = ggml_cont(ctx0, cur);
|
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");
|
ggml_set_name(mel, "mel");
|
||||||
|
Loading…
Reference in New Issue
Block a user