From: Diego Devesa Date: Sat, 2 Nov 2024 12:08:53 +0000 (+0100) Subject: simple-chat : only add bos on first prompt (#10129) X-Git-Tag: upstream/0.0.4488~474 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=b634f8a26fef65210fd9fb2f87e83a2809535e89;p=pkg%2Fggml%2Fsources%2Fllama.cpp simple-chat : only add bos on first prompt (#10129) --- diff --git a/examples/simple-chat/simple-chat.cpp b/examples/simple-chat/simple-chat.cpp index 14264cfc..5f997316 100644 --- a/examples/simple-chat/simple-chat.cpp +++ b/examples/simple-chat/simple-chat.cpp @@ -96,7 +96,7 @@ int main(int argc, char ** argv) { // tokenize the prompt const int n_prompt_tokens = -llama_tokenize(model, prompt.c_str(), prompt.size(), NULL, 0, true, true); std::vector prompt_tokens(n_prompt_tokens); - if (llama_tokenize(model, prompt.c_str(), prompt.size(), prompt_tokens.data(), prompt_tokens.size(), true, true) < 0) { + if (llama_tokenize(model, prompt.c_str(), prompt.size(), prompt_tokens.data(), prompt_tokens.size(), llama_get_kv_cache_used_cells(ctx) == 0, true) < 0) { GGML_ABORT("failed to tokenize the prompt\n"); }