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

Crash at __ggml_metal_graph_compute due to failed assertion -- SIGABRT ggml_metal_graph_compute: command buffer 0 failed with status 5 #1664

Open
Digipom opened this issue Dec 20, 2023 · 0 comments

Comments

@Digipom
Copy link
Contributor

Digipom commented Dec 20, 2023

Whisper 1.5.2 via Swift package

Whisper logs:

whisper_init_from_file_with_params_no_state: loading model from '/var/mobile/Containers/Data/Application/6C3E9FA2-AC0F-4DA5-BD68-ADC424E7F5CE/Library/Application Support/ggml-base.bin'
whisper_model_load: loading model
whisper_model_load: n_vocab       = 51865
whisper_model_load: n_audio_ctx   = 1500
whisper_model_load: n_audio_state = 512
whisper_model_load: n_audio_head  = 8
whisper_model_load: n_audio_layer = 6
whisper_model_load: n_text_ctx    = 448
whisper_model_load: n_text_state  = 512
whisper_model_load: n_text_head   = 8
whisper_model_load: n_text_layer  = 6
whisper_model_load: n_mels        = 80
whisper_model_load: ftype         = 1
whisper_model_load: qntvr         = 0
whisper_model_load: type          = 2 (base)
whisper_model_load: adding 1608 extra tokens
whisper_model_load: n_langs       = 99
whisper_backend_init: using Metal backend
ggml_metal_init: allocating
ggml_metal_init: picking default device: Apple A15 GPU
ggml_metal_init: loading '/var/containers/Bundle/Application/078A9408-F9A4-4B75-8AAC-2AADFD3FC35C/EasyTranscription.app/whisper_whisper.bundle/default.metallib'
whisper_model_load:    Metal buffer size =   147.47 MB
whisper_model_load: model size    =  147.37 MB
whisper_backend_init: using Metal backend
ggml_metal_init: allocating
ggml_metal_init: picking default device: Apple A15 GPU
ggml_metal_init: loading '/var/containers/Bundle/Application/078A9408-F9A4-4B75-8AAC-2AADFD3FC35C/EasyTranscription.app/whisper_whisper.bundle/default.metallib'
whisper_init_state: kv self size  =   16.52 MB
whisper_init_state: kv cross size =   18.43 MB
whisper_init_state: compute buffer (conv)   =   14.92 MB
whisper_init_state: compute buffer (encode) =   86.06 MB
whisper_init_state: compute buffer (cross)  =    4.84 MB
whisper_init_state: compute buffer (decode) =   96.55 MB
ggml_metal_graph_compute: command buffer 0 failed with status 5
GGML_ASSERT: whisper.cpp/ggml-metal.m:2353: false

Stack trace:

2  libsystem_c.dylib              0x75b90 abort + 180
3  EasyTranscription              0x1d05d0 __ggml_metal_graph_compute_block_invoke.cold.1 + 4334814672 (ggml-metal.m:4334814672)
4  EasyTranscription              0x17744c __ggml_metal_graph_compute_block_invoke + 968 (ggml-metal.m:968)
5  App                            0x174f58 ggml_backend_graph_compute + 161 (ggml-backend.c:161)
6  App                            0x1aa6d0 whisper_decode_internal(whisper_context&, whisper_state&, whisper_batch const&, int, bool (*)(void*), void*) + 2579 (whisper.cpp:2579)
7  App                            0x1b050c whisper_full_with_state + 5571 (whisper.cpp:5571)
8  App                            0x1b6704 whisper_full + 5826 (whisper.cpp:5826)

I'm not sure if it's normal for it to be allocating metal twice, but I also see that elsewhere in the logs.

I believe this may be due to the metal allocation taking place after the app was sent to the background. The app seems to not crash if the transcription is already happening when backgrounded, but it does seem to crash if the backgrounding happens at around the same time as the metal library is being loaded.

Having a fallback or an error instead of an abort() would help to mitigate this. I'll do some more testing on my end to see when it's happening.

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

1 participant