From 31ded71339d00c14e808848ee70db4e49fb257ad Mon Sep 17 00:00:00 2001 From: peardox Date: Mon, 14 Apr 2025 00:58:33 +0100 Subject: [PATCH 1/2] Expose whisper_load_backends to make GGML_BACKEND_DL functional --- examples/bench/bench.cpp | 3 +++ examples/cli/cli.cpp | 4 ++++ examples/stream/stream.cpp | 4 ++++ include/whisper.h | 3 +++ 4 files changed, 14 insertions(+) diff --git a/examples/bench/bench.cpp b/examples/bench/bench.cpp index 54f73110d42..61a00ac50db 100644 --- a/examples/bench/bench.cpp +++ b/examples/bench/bench.cpp @@ -60,6 +60,9 @@ void whisper_print_usage(int /*argc*/, char ** argv, const whisper_params & para static int whisper_bench_full(const whisper_params & params) { // whisper init + #ifdef GGML_BACKEND_DL + whisper_load_backends(); + #endif struct whisper_context_params cparams = whisper_context_default_params(); diff --git a/examples/cli/cli.cpp b/examples/cli/cli.cpp index 4b2b3521b80..ffa626c69c7 100644 --- a/examples/cli/cli.cpp +++ b/examples/cli/cli.cpp @@ -1004,6 +1004,10 @@ int main(int argc, char ** argv) { // whisper init + #ifdef GGML_BACKEND_DL + whisper_load_backends(); + #endif + struct whisper_context_params cparams = whisper_context_default_params(); cparams.use_gpu = params.use_gpu; diff --git a/examples/stream/stream.cpp b/examples/stream/stream.cpp index 65c6587db92..f58001e16b4 100644 --- a/examples/stream/stream.cpp +++ b/examples/stream/stream.cpp @@ -155,6 +155,10 @@ int main(int argc, char ** argv) { exit(0); } + #ifdef GGML_BACKEND_DL + whisper_load_backends(); + #endif + struct whisper_context_params cparams = whisper_context_default_params(); cparams.use_gpu = params.use_gpu; diff --git a/include/whisper.h b/include/whisper.h index 1e1375033ad..cb758888aab 100644 --- a/include/whisper.h +++ b/include/whisper.h @@ -259,6 +259,9 @@ extern "C" { WHISPER_API void whisper_free_params(struct whisper_full_params * params); WHISPER_API void whisper_free_context_params(struct whisper_context_params * params); + // Required for GGML_BACKEND_DL + WHISPER_API void whisper_load_backends(); + // Convert RAW PCM audio to log mel spectrogram. // The resulting spectrogram is stored inside the default state of the provided whisper context. // Returns 0 on success From 7521cdeabe205d4dadbf0410626f2c14fd26f21a Mon Sep 17 00:00:00 2001 From: peardox Date: Mon, 14 Apr 2025 02:00:19 +0100 Subject: [PATCH 2/2] Expose whisper_load_backends Conditionaly --- include/whisper.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/whisper.h b/include/whisper.h index cb758888aab..42c7632128e 100644 --- a/include/whisper.h +++ b/include/whisper.h @@ -260,7 +260,9 @@ extern "C" { WHISPER_API void whisper_free_context_params(struct whisper_context_params * params); // Required for GGML_BACKEND_DL + #ifdef GGML_BACKEND_DL WHISPER_API void whisper_load_backends(); + #endif // Convert RAW PCM audio to log mel spectrogram. // The resulting spectrogram is stored inside the default state of the provided whisper context.