Skip to content

Commit

Permalink
llama : expose model's rope_freq_scale in the API (ggerganov#3418)
Browse files Browse the repository at this point in the history
so it can be scaled further before creating a context.
  • Loading branch information
grencez authored and yusiwen committed Oct 7, 2023
1 parent 6bd6c2f commit 6487ea7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions llama.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
3 changes: 3 additions & 0 deletions llama.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 6487ea7

Please sign in to comment.