Simplify default chatml logic
This commit is contained in:
parent
b2dd490926
commit
d73448de1c
1 changed files with 5 additions and 2 deletions
|
@ -1879,8 +1879,9 @@ std::string common_chat_format_example(const common_chat_template & tmpl, bool u
|
||||||
|
|
||||||
common_chat_templates common_chat_templates_from_model(const struct llama_model * model, const std::string & chat_template_override)
|
common_chat_templates common_chat_templates_from_model(const struct llama_model * model, const std::string & chat_template_override)
|
||||||
{
|
{
|
||||||
std::string default_template_src = chat_template_override == "chatml" ? CHATML_TEMPLATE_SRC : chat_template_override;
|
std::string default_template_src;
|
||||||
std::string template_tool_use_src = chat_template_override == "chatml" ? CHATML_TEMPLATE_SRC : "";
|
std::string template_tool_use_src;
|
||||||
|
|
||||||
bool has_explicit_template = !chat_template_override.empty();
|
bool has_explicit_template = !chat_template_override.empty();
|
||||||
if (chat_template_override.empty()) {
|
if (chat_template_override.empty()) {
|
||||||
auto str = llama_model_chat_template(model, /* name */ nullptr);
|
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
|
||||||
template_tool_use_src = str;
|
template_tool_use_src = str;
|
||||||
has_explicit_template = true;
|
has_explicit_template = true;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
default_template_src = chat_template_override;
|
||||||
}
|
}
|
||||||
if (default_template_src.empty() || default_template_src == "chatml") {
|
if (default_template_src.empty() || default_template_src == "chatml") {
|
||||||
if (!template_tool_use_src.empty()) {
|
if (!template_tool_use_src.empty()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue