From c0a372fd3d338d15333a2489c4b538f51479f20c Mon Sep 17 00:00:00 2001 From: xaedes Date: Wed, 16 Aug 2023 15:30:31 +0200 Subject: [PATCH] add API functions to access remaining model parameters: mult, head and rot --- llama.cpp | 24 ++++++++++++++++++++++++ llama.h | 6 ++++++ 2 files changed, 30 insertions(+) diff --git a/llama.cpp b/llama.cpp index c5112e5ba..ccec53c86 100644 --- a/llama.cpp +++ b/llama.cpp @@ -4147,6 +4147,18 @@ int llama_n_embd_from_model(const struct llama_model * model) { return model->hparams.n_embd; } +int llama_n_mult_from_model(const struct llama_model * model) { + return model->hparams.n_mult; +} + +int llama_n_head_from_model(const struct llama_model * model) { + return model->hparams.n_head; +} + +int llama_n_rot_from_model(const struct llama_model * model) { + return model->hparams.n_rot; +} + int llama_n_layer_from_model(const struct llama_model * model) { return model->hparams.n_layer; } @@ -4163,6 +4175,18 @@ int llama_n_embd(const struct llama_context * ctx) { return ctx->model.hparams.n_embd; } +int llama_n_mult(const struct llama_context * ctx) { + return ctx->model.hparams.n_mult; +} + +int llama_n_head(const struct llama_context * ctx) { + return ctx->model.hparams.n_head; +} + +int llama_n_rot(const struct llama_context * ctx) { + return ctx->model.hparams.n_rot; +} + int llama_n_layer(const struct llama_context * ctx) { return ctx->model.hparams.n_layer; } diff --git a/llama.h b/llama.h index 647f9abdc..e74279aba 100644 --- a/llama.h +++ b/llama.h @@ -330,11 +330,17 @@ extern "C" { LLAMA_API int llama_n_vocab(const struct llama_context * ctx); LLAMA_API int llama_n_ctx (const struct llama_context * ctx); LLAMA_API int llama_n_embd (const struct llama_context * ctx); + LLAMA_API int llama_n_mult (const struct llama_context * ctx); + LLAMA_API int llama_n_head (const struct llama_context * ctx); + LLAMA_API int llama_n_rot (const struct llama_context * ctx); LLAMA_API int llama_n_layer(const struct llama_context * ctx); LLAMA_API int llama_n_vocab_from_model(const struct llama_model * model); LLAMA_API int llama_n_ctx_from_model (const struct llama_model * model); LLAMA_API int llama_n_embd_from_model (const struct llama_model * model); + LLAMA_API int llama_n_mult_from_model (const struct llama_model * model); + LLAMA_API int llama_n_head_from_model (const struct llama_model * model); + LLAMA_API int llama_n_rot_from_model (const struct llama_model * model); LLAMA_API int llama_n_layer_from_model(const struct llama_model * model); // Get the vocabulary as output parameters.