Skip to content

Commit 48be797

Browse files
authored
llama : expose model's rope_freq_scale in the API (#3418)
so it can be scaled further before creating a context.
1 parent f56e1ba commit 48be797

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

llama.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7038,6 +7038,10 @@ int llama_n_embd(const struct llama_model * model) {
70387038
return model->hparams.n_embd;
70397039
}
70407040

7041+
float llama_rope_freq_scale_train(const struct llama_model * model) {
7042+
return model->hparams.rope_freq_scale_train;
7043+
}
7044+
70417045
int llama_model_desc(const struct llama_model * model, char * buf, size_t buf_size) {
70427046
return snprintf(buf, buf_size, "%s %s %s",
70437047
llama_model_arch_name(model->arch).c_str(),

llama.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,9 @@ extern "C" {
282282
LLAMA_API int llama_n_ctx_train(const struct llama_model * model);
283283
LLAMA_API int llama_n_embd (const struct llama_model * model);
284284

285+
// Get the model's RoPE frequency scaling factor
286+
LLAMA_API float llama_rope_freq_scale_train(const struct llama_model * model);
287+
285288
// Get a string describing the model type
286289
LLAMA_API int llama_model_desc(const struct llama_model * model, char * buf, size_t buf_size);
287290

0 commit comments

Comments
 (0)