added back "alpaca" template

This commit is contained in:
jukofyork 2024-06-27 09:55:51 +01:00 committed by GitHub
parent 911e35bb8b
commit 8bafae2f78
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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) {