]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
simple-chat : only add bos on first prompt (#10129)
authorDiego Devesa <redacted>
Sat, 2 Nov 2024 12:08:53 +0000 (13:08 +0100)
committerGitHub <redacted>
Sat, 2 Nov 2024 12:08:53 +0000 (13:08 +0100)
examples/simple-chat/simple-chat.cpp

index 14264cfcb54727aed956ce91707d3b0f927ed94d..5f9973163732d3cf71b2afc16c2bc0a7f6542d70 100644 (file)
@@ -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<llama_token> 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");
         }