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

whisper.objc crashes on iPhone 14 Pro Max #2556

Open
alimysoyang opened this issue Nov 14, 2024 · 2 comments
Open

whisper.objc crashes on iPhone 14 Pro Max #2556

alimysoyang opened this issue Nov 14, 2024 · 2 comments

Comments

@alimysoyang
Copy link

Crash Log:
Assertion failed: (ctx != NULL), function ggml_backend_metal_device_acq, file ggml-metal.m, line 53.

Input Data, ViewController.m(Line 70):

stateInp.ctx = whisper_init_from_file_with_params([modelPath UTF8String], cparams);
Screenshot 2024-11-14 at 06 18 40
@tomer-schles
Copy link

Similar crash happend to me. On iPhone 16 Pro.

I was not interested in metal, but only in coreml, so I disabled metal according to the readme and then it worked properly. Core ml was much faster then without it (20X?).

Also was a bit confusing to understand how to use coreml and how to change the model from base.en to another one, so I opened a PR with updates to the readme here - #2569

A bit more info on my original crash using metal -
I crashed on this line if (ctx->mtl_device == nil) { because ctx was NULL. For some reason the assert was not triggering the crash.

static id<MTLDevice> ggml_backend_metal_device_acq(struct ggml_backend_metal_device_context * ctx) {
    assert(ctx != NULL);
    
    if (ctx->mtl_device == nil) {
        ctx->mtl_device = MTLCreateSystemDefaultDevice();

@JulianPscheid
Copy link

I was not interested in metal, but only in coreml, so I disabled metal according to the readme and then it worked properly. Core ml was much faster then without it (20X?).

Thanks, removing the -DGGML_USE_METAL parameter indeed fixed this error. Performance appears to be the same as before upgrading to the latest Whisper.cpp release (1.7.2) that introduced this error. I was previously using 1.7.1. Tested on iPhone X and 12.

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

No branches or pull requests

3 participants