fix: use actual newline in ChatML generation prompt template

This commit is contained in:
Fizza-Mukhtar 2026-03-07 07:43:47 -08:00 committed by Daniel Han
commit 334848d8d8

View file

@ -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