From d07c9f6a7a15ad9a75a0c62377e06ed7c9d864cc Mon Sep 17 00:00:00 2001 From: Xuan Son Nguyen Date: Sun, 12 Jan 2025 13:27:27 +0100 Subject: [PATCH] adapt --- examples/main/chat.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/main/chat.hpp b/examples/main/chat.hpp index 801e7acdc..e17cbfa02 100644 --- a/examples/main/chat.hpp +++ b/examples/main/chat.hpp @@ -10,6 +10,7 @@ struct llama_cli_chat { struct llama_context * ctx; const struct llama_model * model; + const struct llama_vocab * vocab; struct common_sampler * smpl; struct common_params params; @@ -26,6 +27,7 @@ struct llama_cli_chat { struct llama_context * ctx, struct common_sampler * smpl) : ctx(ctx), smpl(smpl), params(params) { model = llama_get_model(ctx); + vocab = llama_model_get_vocab(model); batch = llama_batch_init(params.n_batch, 0, 1); } @@ -130,7 +132,7 @@ struct llama_cli_chat { new_token_id = common_sampler_sample(smpl, ctx, -1); // is it an end of generation? - if (llama_token_is_eog(model, new_token_id)) { + if (llama_vocab_is_eog(vocab, new_token_id)) { break; }