diff --git a/cpp/whisper.cpp b/cpp/whisper.cpp index 13809b9..fa58cef 100644 --- a/cpp/whisper.cpp +++ b/cpp/whisper.cpp @@ -738,7 +738,6 @@ struct whisper_state { std::string path_model; // populated by whisper_init_from_file() #ifdef WHISPER_USE_COREML whisper_coreml_context * ctx_coreml = nullptr; - bool load_coreml = true; #endif #ifdef WSP_GGML_USE_METAL @@ -771,6 +770,9 @@ struct whisper_context { whisper_state * state = nullptr; std::string path_model; // populated by whisper_init_from_file() +#ifdef WHISPER_USE_COREML + bool load_coreml = true; +#endif }; static void whisper_default_log(const char * text) { diff --git a/scripts/whisper.cpp.patch b/scripts/whisper.cpp.patch index 3ae822b..a41f652 100644 --- a/scripts/whisper.cpp.patch +++ b/scripts/whisper.cpp.patch @@ -1,32 +1,34 @@ ---- whisper.cpp.orig 2023-10-12 10:40:07 -+++ whisper.cpp 2023-10-12 10:38:11 -@@ -738,6 +738,7 @@ +--- whisper.cpp.orig 2023-10-12 11:44:51 ++++ whisper.cpp 2023-10-12 11:43:31 +@@ -770,6 +770,9 @@ + whisper_state * state = nullptr; + std::string path_model; // populated by whisper_init_from_file() - #ifdef WHISPER_USE_COREML - whisper_coreml_context * ctx_coreml = nullptr; ++#ifdef WHISPER_USE_COREML + bool load_coreml = true; - #endif - - #ifdef WSP_GGML_USE_METAL -@@ -2854,6 +2855,7 @@ ++#endif + }; + + static void whisper_default_log(const char * text) { +@@ -2854,6 +2857,7 @@ } - + #ifdef WHISPER_USE_COREML +if (ctx->load_coreml) { // Not in correct layer for easy patch const auto path_coreml = whisper_get_coreml_path_encoder(ctx->path_model); - + log("%s: loading Core ML model from '%s'\n", __func__, path_coreml.c_str()); -@@ -2869,6 +2871,7 @@ +@@ -2869,6 +2873,7 @@ } else { log("%s: Core ML model loaded\n", __func__); } +} #endif - + state->logits.reserve(ctx->vocab.n_vocab * ctx->model.hparams.n_text_ctx); -@@ -2987,7 +2990,24 @@ +@@ -2987,7 +2992,24 @@ state->rng = std::mt19937(0); - + return state; +} + @@ -46,6 +48,6 @@ + return ctx; } +#endif - + int whisper_ctx_init_openvino_encoder( struct whisper_context * ctx,