From 334848d8d852a8f48f2d984b9db3811ea5b080a3 Mon Sep 17 00:00:00 2001 From: Fizza-Mukhtar Date: Sat, 7 Mar 2026 07:43:47 -0800 Subject: [PATCH] fix: use actual newline in ChatML generation prompt template --- unsloth/tokenizer_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unsloth/tokenizer_utils.py b/unsloth/tokenizer_utils.py index 956ce21345..f65bac61f5 100644 --- a/unsloth/tokenizer_utils.py +++ b/unsloth/tokenizer_utils.py @@ -666,7 +666,7 @@ def _fix_chat_template(chat_template): ): after_endfor = ( "{%" + dash + " if add_generation_prompt %}" - + "{{ '<|im_start|>assistant\\n' }}" + + "{{ '<|im_start|>assistant\n' }}" + "{%" + dash + " endif %}" ) chat_template = chat_template[: where + len(chosen_end)] + after_endfor