diff options
author | Marcus Dunn <51931484+MarcusDunn@users.noreply.github.com> | 2023-12-21 11:57:48 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-21 21:57:48 +0200 |
commit | 31f27758faf4a4bd08101a57c7ec3a473f771f86 (patch) | |
tree | e968fc19ea2aff2db17646dd410648dbd0e07990 | |
parent | 56fa50819f7a3ca2128f63b81c17c08a4454479e (diff) |
llama : allow getting n_batch from llama_context in c api (#4540)
* allowed getting n_batch from llama_context in c api
* changed to use `uint32_t` instead of `int`
* changed to use `uint32_t` instead of `int` in `llama_n_ctx`
* Update llama.h
---------
Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
-rw-r--r-- | llama.cpp | 6 | ||||
-rw-r--r-- | llama.h | 4 |
2 files changed, 8 insertions, 2 deletions
@@ -9532,10 +9532,14 @@ const llama_model * llama_get_model(const struct llama_context * ctx) { return &ctx->model; } -int llama_n_ctx(const struct llama_context * ctx) { +uint32_t llama_n_ctx(const struct llama_context * ctx) { return ctx->cparams.n_ctx; } +uint32_t llama_n_batch(const struct llama_context * ctx) { + return ctx->cparams.n_batch; +} + enum llama_vocab_type llama_vocab_type(const struct llama_model * model) { return model->vocab.type; } @@ -314,7 +314,9 @@ extern "C" { LLAMA_API const struct llama_model * llama_get_model(const struct llama_context * ctx); - LLAMA_API int llama_n_ctx (const struct llama_context * ctx); + // TODO: become more consistent with returned int types across the API + LLAMA_API uint32_t llama_n_ctx (const struct llama_context * ctx); + LLAMA_API uint32_t llama_n_batch (const struct llama_context * ctx); LLAMA_API enum llama_vocab_type llama_vocab_type(const struct llama_model * model); |