From e0f9d9d73243699e0e98ed566d8b7bb3a265d0e4 Mon Sep 17 00:00:00 2001 From: Kai Zau Date: Sat, 30 Mar 2024 14:41:43 +0900 Subject: [PATCH] Add chat template for orca-vicuna --- llama.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/llama.cpp b/llama.cpp index fa473e5be..abff2304c 100644 --- a/llama.cpp +++ b/llama.cpp @@ -15714,6 +15714,7 @@ static int32_t llama_chat_apply_template_internal( ss << "GPT4 Correct Assistant:"; } } else if (tmpl == "vicuna" || tmpl.find("USER: ") != std::string::npos) { + // Vicuna 1.1+, Nous Capybara, etc. for (auto message : chat) { std::string role(message->role); if (role == "user") { @@ -15730,6 +15731,22 @@ static int32_t llama_chat_apply_template_internal( if (add_ass) { ss << "ASSISTANT:"; } + } else if (tmpl == "orca-vicuna" || tmpl.find("SYSTEM: ") != std::string::npos) { + // Orca-Vicuna + for (auto message : chat) { + std::string role(message->role); + if (role == "system") { + ss << "SYSTEM: "; + } else if (role == "user") { + ss << "USER: "; + } else if (role == "assistant") { + ss << "ASSISTANT: "; + } + ss << message->content << "\n"; + } + if (add_ass) { + ss << "ASSISTANT:"; + } } else { // template not supported return -1;