read n_ctx back after making llama_context (#21939)

This commit is contained in:
Matt 2026-04-15 00:24:57 -07:00 committed by GitHub
parent 5d14e5d19b
commit e39eba26f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -602,8 +602,8 @@ int main(int argc, char ** argv) {
int n_input = input_tokens.size();
if (n_input >= params.n_ctx) {
LOG_ERR("error: input too long (%d tokens), max context is %d\n", n_input, params.n_ctx);
if (static_cast<uint32_t>(n_input) >= llama_n_ctx(ctx)) {
LOG_ERR("error: input too long (%d tokens), max context is %d\n", n_input, llama_n_ctx(ctx));
llama_free(ctx);
llama_model_free(model);
return 1;