Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/whisper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4676,6 +4676,7 @@ static bool whisper_vad_init_context(whisper_vad_context * vctx) {
ggml_set_name(vctx->c_state, "c_state");

vctx->buffer = ggml_backend_alloc_ctx_tensors(ctx, vctx->backends[0]);
ggml_free(ctx);
if (!vctx->buffer) {
WHISPER_LOG_ERROR("%s: failed to allocate memory for the VAD state\n", __func__);
return false;
Expand Down Expand Up @@ -5420,6 +5421,9 @@ struct whisper_vad_segments * whisper_vad_segments_from_samples(

void whisper_vad_free(whisper_vad_context * ctx) {
if (ctx) {
if (ctx->buffer) {
ggml_backend_buffer_free(ctx->buffer);
}
for (ggml_context * context : ctx->model.ctxs) {
ggml_free(context);
}
Expand All @@ -5434,6 +5438,9 @@ void whisper_vad_free(whisper_vad_context * ctx) {
ggml_backend_free(backend);
}

delete[] ctx->model.hparams.encoder_in_channels;
delete[] ctx->model.hparams.encoder_out_channels;
delete[] ctx->model.hparams.kernel_sizes;

delete ctx;
}
Expand Down
Loading