Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

fix issue with qwen3 template double quote escapes

David Dobolyia063c4a41e4c
diff --git a/unsloth/chat_templates.py b/unsloth/chat_templates.py
index cfb3ece4791..e7849092cb0 100644
--- a/unsloth/chat_templates.py
+++ b/unsloth/chat_templates.py
@@ -1029,7 +1029,7 @@ qwen3_template = \
{{- "\n" }}
{{- tool | tojson }}
{%- endfor %}
- {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\\"name\\": <function-name>, \\"arguments\\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
{%- else %}
{%- if messages[0].role == 'system' %}
{{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}