Description
I've been going mildly crazy over this issue for the past few hours before I finally figured out what it was, so excuse me if this gets somewhat rambly :)
For some context: whisper-rs
uses the no_state whisper model creation functions across the board, and forces users to create a new state object each time they would like to run a transcription, even if they only want to run one across the lifetime of the program. This is just overall an easier and safer way to wrap the C API, and migrating to the ones with state would be a major headache.
I ran into this issue myself trying to use OpenVINO with whisper-rs, on a local branch where it's implemented. A quick reproduction is trying to initialize a whisper_context
with one of the no_state functions, then trying to call whisper_ctx_init_openvino_encoder
(with a valid device name). Initialization succeeds, but immediately after the function returns a segfault happens.
Thread 1 "scripty_stt_ser" received signal SIGSEGV, Segmentation fault.
0x000055555562d50a in whisper_ctx_init_openvino_encoder (ctx=0x555555a4bba0 = {...}, model_path=0x0, device=0x555556253330 "GPU", cache_dir=0x0) at /home/niko/.cargo/git/checkouts/whisper-rs-c8b9fa7c09c8c913/749c18c/sys/whisper.cpp/whisper.cpp:2843
2843 ctx->state->ctx_openvino = whisper_openvino_init(path_encoder_cstr, device, path_cache_cstr);
The target architecture is set to "auto" (currently "i386:x86-64").
After a few hours of digging through completely wrong ideas, I evaluated ctx->state
after the program segfaulted. CLion reported it as NULL. After sifting through each initialization function, this makes total sense, as none of the no_state functions initialize a state on ctx.state
.
This issue basically makes OpenVINO completely useless in whisper-rs
as it stands. Would it be possible to add something to initialize OpenVINO globally for all states, or failing that, a function to initialize it for each new state?