From 1eebfc9f0fd79fe4a707198415a602e93d7545b0 Mon Sep 17 00:00:00 2001 From: Kai Zau Date: Mon, 1 Apr 2024 19:34:31 +0800 Subject: [PATCH] Separate deepseek bos from system message --- llama.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/llama.cpp b/llama.cpp index 28dae85c4..13dafda4a 100644 --- a/llama.cpp +++ b/llama.cpp @@ -15738,8 +15738,11 @@ static int32_t llama_chat_apply_template_internal( // Use of both U+ff5c and U+007c pipes is deliberate, based on the Jinja template for (auto message : chat) { std::string role(message->role); + if (message == chat.front()) { + ss << "<|begin▁of▁sentence|>"; + } if (role == "system") { - ss << "<|begin▁of▁sentence|>" << message->content; + ss << message->content; } else if (role == "user") { ss << "### Instruction:\n" << message->content << "\n"; } else if (role == "assistant") {