Skip to content

Distribute and run LLMs with a single file.

fix: Detect Granite for models where the template got truncated

Gabe Goodhartf44916fe8f60
diff --git a/llama.cpp/llama.cpp b/llama.cpp/llama.cpp
index 5bcc10af..78416fba 100644
--- a/llama.cpp/llama.cpp
+++ b/llama.cpp/llama.cpp
@@ -19294,7 +19294,7 @@ static int32_t llama_chat_apply_template_internal(
if (add_ass) {
ss << "[|assistant|]";
}
- } else if (tmpl == "granite" || tmpl == "granitemoe" || tmpl_contains("<|start_of_role|>")) {
+ } else if (tmpl == "granite" || tmpl == "granitemoe" || tmpl_contains("<|start_of_role|>") || tmpl_contains("Granite")) {
// IBM Granite template
for (const auto & message : chat) {
std::string role(message->role);