From bb941fcee8da0ca922fe9ae760066a48555a83cb Mon Sep 17 00:00:00 2001 From: grencez Date: Mon, 2 Oct 2023 04:01:53 -0700 Subject: [PATCH] llama : expose model's rope_freq_scale in the API so it can be scaled further before creating a context. --- llama.cpp | 4 ++++ llama.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/llama.cpp b/llama.cpp index 05b570bd12ee2..83733e718fd8b 100644 --- a/llama.cpp +++ b/llama.cpp @@ -6895,6 +6895,10 @@ int llama_n_embd(const struct llama_model * model) { return model->hparams.n_embd; } +float llama_rope_freq_scale_train(const struct llama_model * model) { + return model->hparams.rope_freq_scale_train; +} + int llama_model_desc(const struct llama_model * model, char * buf, size_t buf_size) { return snprintf(buf, buf_size, "%s %s %s", llama_model_arch_name(model->arch).c_str(), diff --git a/llama.h b/llama.h index fd21584003b84..0177d07a91044 100644 --- a/llama.h +++ b/llama.h @@ -282,6 +282,9 @@ extern "C" { LLAMA_API int llama_n_ctx_train(const struct llama_model * model); LLAMA_API int llama_n_embd (const struct llama_model * model); + // Get the model's RoPE frequency scaling factor + LLAMA_API float llama_rope_freq_scale_train(const struct llama_model * model); + // Get a string describing the model type LLAMA_API int llama_model_desc(const struct llama_model * model, char * buf, size_t buf_size);