Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix uninitialized exp_n_audio_ctx #520

Merged
merged 1 commit into from
Feb 21, 2023
Merged

Fix uninitialized exp_n_audio_ctx #520

merged 1 commit into from
Feb 21, 2023

Conversation

finnvoor
Copy link
Contributor

We've been using whisper.cpp (whisper.spm) in www.detail.co and have run into a number of crashes at this assertion:

whisper.cpp/ggml.c

Lines 1653 to 1657 in 0d22916

if (ctx->scratch.offs + size_needed > ctx->scratch.size) {
GGML_PRINT("%s: not enough space in the scratch memory\n", __func__);
assert(false);
return NULL;
}

Debugging these it seems like exp_n_audio_ctx is not initialized before whisper_lang_auto_detect -> whisper_encode, and n_ctx is therefore set to a large random number, creating a mel tensor that runs out of memory.

const int n_ctx = wctx.exp_n_audio_ctx > 0 ? wctx.exp_n_audio_ctx : hparams.n_audio_ctx;

Initializing exp_n_audio_ctx to 0 fixes this issue for us.

@ggerganov ggerganov merged commit fb4d0d4 into ggerganov:master Feb 21, 2023
@jordibruin
Copy link

Thanks for finding this @finnvoor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants