Răsfoiți Sursa

simple-chat : only add bos on first prompt (#10129)

Diego Devesa 1 an în urmă
părinte
comite
b634f8a26f
1 a modificat fișierele cu 1 adăugiri și 1 ștergeri
  1. 1 1
      examples/simple-chat/simple-chat.cpp

+ 1 - 1
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<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");
         }