]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
llama : expose model's rope_freq_scale in the API (#3418)
authorAlex Klinkhamer <redacted>
Tue, 3 Oct 2023 17:09:28 +0000 (10:09 -0700)
committerGitHub <redacted>
Tue, 3 Oct 2023 17:09:28 +0000 (20:09 +0300)
so it can be scaled further before creating a context.

llama.cpp
llama.h

index 4a61eecdd328befe8257be231f97b5a9e9da3294..aa1b4732c7c0ca56623ab3d9c2c78e61d6a86894 100644 (file)
--- a/llama.cpp
+++ b/llama.cpp
@@ -7038,6 +7038,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 fd21584003b842aa1f22cea09d7a3ec2cf7c312e..0177d07a9104406ec242ece5ee20c5d3fedd3695 100644 (file)
--- 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);