add API functions to access remaining model parameters:

mult, head and rot
This commit is contained in:
xaedes 2023-08-16 15:30:31 +02:00
parent 9eb1ef8653
commit c0a372fd3d
No known key found for this signature in database
GPG key ID: 30030EDD817EA2B1
2 changed files with 30 additions and 0 deletions

View file

@ -4147,6 +4147,18 @@ int llama_n_embd_from_model(const struct llama_model * model) {
return model->hparams.n_embd; 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) { int llama_n_layer_from_model(const struct llama_model * model) {
return model->hparams.n_layer; return model->hparams.n_layer;
} }
@ -4163,6 +4175,18 @@ int llama_n_embd(const struct llama_context * ctx) {
return ctx->model.hparams.n_embd; 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) { int llama_n_layer(const struct llama_context * ctx) {
return ctx->model.hparams.n_layer; return ctx->model.hparams.n_layer;
} }

View file

@ -330,11 +330,17 @@ extern "C" {
LLAMA_API int llama_n_vocab(const struct llama_context * ctx); 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_ctx (const struct llama_context * ctx);
LLAMA_API int llama_n_embd (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_layer(const struct llama_context * ctx);
LLAMA_API int llama_n_vocab_from_model(const struct llama_model * model); 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_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_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); LLAMA_API int llama_n_layer_from_model(const struct llama_model * model);
// Get the vocabulary as output parameters. // Get the vocabulary as output parameters.