Skip to content

Commit d73448d

Browse files
author
Olivier Chafik
committed
Simplify default chatml logic
1 parent b2dd490 commit d73448d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

common/common.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1879,8 +1879,9 @@ std::string common_chat_format_example(const common_chat_template & tmpl, bool u
18791879

18801880
common_chat_templates common_chat_templates_from_model(const struct llama_model * model, const std::string & chat_template_override)
18811881
{
1882-
std::string default_template_src = chat_template_override == "chatml" ? CHATML_TEMPLATE_SRC : chat_template_override;
1883-
std::string template_tool_use_src = chat_template_override == "chatml" ? CHATML_TEMPLATE_SRC : "";
1882+
std::string default_template_src;
1883+
std::string template_tool_use_src;
1884+
18841885
bool has_explicit_template = !chat_template_override.empty();
18851886
if (chat_template_override.empty()) {
18861887
auto str = llama_model_chat_template(model, /* name */ nullptr);
@@ -1893,6 +1894,8 @@ common_chat_templates common_chat_templates_from_model(const struct llama_model
18931894
template_tool_use_src = str;
18941895
has_explicit_template = true;
18951896
}
1897+
} else {
1898+
default_template_src = chat_template_override;
18961899
}
18971900
if (default_template_src.empty() || default_template_src == "chatml") {
18981901
if (!template_tool_use_src.empty()) {

0 commit comments

Comments
 (0)