From bde2e7605f705abc7b1df64ca1cbb4d14193bf3f Mon Sep 17 00:00:00 2001 From: tristandruyen Date: Wed, 22 May 2024 03:19:01 +0200 Subject: [PATCH] Fix phi3 template matching vs zephyr --- llama.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llama.cpp b/llama.cpp index abff8c1c0..04ed0866e 100644 --- a/llama.cpp +++ b/llama.cpp @@ -17628,7 +17628,7 @@ static int32_t llama_chat_apply_template_internal( } } // llama2 templates seem to not care about "add_generation_prompt" - } else if (tmpl == "zephyr" || tmpl.find("<|user|>") != std::string::npos) { + } else if (tmpl == "zephyr" || (tmpl.find("<|user|>") != std::string::npos && tmpl.find("<|end|>") == std::string::npos)) { // zephyr template for (auto message : chat) { ss << "<|" << message->role << "|>" << "\n" << message->content << "<|endoftext|>\n";