llama_chat_apply_template: add zephyr template

This commit is contained in:
ngxson 2024-02-17 16:54:30 +01:00
parent 6012ad651f
commit 7a3eac8cb3

View file

@ -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;