From 8bafae2f78ccf8fdada863a13354fa90980d19d9 Mon Sep 17 00:00:00 2001 From: jukofyork <69222624+jukofyork@users.noreply.github.com> Date: Thu, 27 Jun 2024 09:55:51 +0100 Subject: [PATCH] added back "alpaca" template --- src/llama.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/llama.cpp b/src/llama.cpp index 080057332..94b9c34b0 100644 --- a/src/llama.cpp +++ b/src/llama.cpp @@ -19550,6 +19550,21 @@ static int32_t llama_chat_apply_template_internal( if (add_ass) { ss << "ASSISTANT:"; } + } else if (tmpl == "alpaca" || (tmpl.find("### Instruction:") != std::string::npos && tmpl.find("<|EOT|>") == std::string::npos)) { + // meta-math/MetaMath-7B-V1.0 + for (auto message : chat) { + std::string role(message->role); + if (role == "system") { + ss << message->content << "\n\n"; + } else if (role == "user") { + ss << "### Instruction:\n" << message->content << "\n\n"; + } else if (role == "assistant") { + ss << "### Response:\n" << message->content << "\n\n"; + } + } + if (add_ass) { + ss << "### Response:\n"; + } } else if (tmpl == "deepseek" || (tmpl.find("### Instruction:") != std::string::npos && tmpl.find("<|EOT|>") != std::string::npos)) { // deepseek-ai/deepseek-coder-33b-instruct for (auto message : chat) {