fix: resolve chat template names before kwargs detection (#36937)

Co-authored-by: giulio-leone <giulio.leone@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Giulio Leone
2026-03-14 00:20:16 +00:00
committed by GitHub
co-authored by giulio-leone Copilot
parent 367cf5cd3e
commit b41aa264f9
2 changed files with 59 additions and 1 deletions
+3 -1
View File
@@ -108,7 +108,9 @@ def resolve_chat_template(
) -> str | None:
# 1st priority: The given chat template
if chat_template is not None:
return chat_template
# Resolve template names (e.g. "tool_use") to actual Jinja content
# so that downstream kwargs detection can parse template variables.
return tokenizer.get_chat_template(chat_template, tools=tools)
# 2nd priority: AutoProcessor chat template, unless tool calling is enabled
if tools is None: