From 7a3eac8cb32961735e65613e088d0b29ee579a54 Mon Sep 17 00:00:00 2001 From: ngxson Date: Sat, 17 Feb 2024 16:54:30 +0100 Subject: [PATCH] llama_chat_apply_template: add zephyr template --- llama.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/llama.cpp b/llama.cpp index 615a9b901..dee685c19 100644 --- a/llama.cpp +++ b/llama.cpp @@ -12522,6 +12522,14 @@ int32_t llama_chat_apply_template_internal(std::string &dest, std::string chat_t } } // llama2 templates seem to not care about "add_generation_prompt" + } else if (chat_template.find("<|user|>") != std::string::npos) { + // zephyr template + for (auto message : conversation) { + ss << "<|" << message->role << "|>" << "\n" << message->content << "<|endoftext|>\n"; + } + if (add_ass) { + ss << "<|assistant|>\n"; + } } else { // template not supported return -1;