diff --git a/llama.cpp b/llama.cpp index 1f9d3784415ec..5b154d50c659c 100644 --- a/llama.cpp +++ b/llama.cpp @@ -2188,6 +2188,11 @@ struct llama_context * llama_init_from_file( return ctx; } +void llama_init_ggml(struct ggml_init_params params) { + struct ggml_context * ctx = ggml_init(params); + ggml_free(ctx); +} + void llama_free(struct llama_context * ctx) { delete ctx; } diff --git a/llama.h b/llama.h index f955fa23db048..db98d05b7eb26 100644 --- a/llama.h +++ b/llama.h @@ -97,6 +97,10 @@ extern "C" { const char * path_model, struct llama_context_params params); + // Init the ggml context (it won't return a context ptr because it will free + // the ctx after initialing it). + LLAMA_API void llama_init_ggml(struct ggml_init_params params); + // Frees all allocated memory LLAMA_API void llama_free(struct llama_context * ctx);