Commit ·
045f1dc
1
Parent(s): 31fe8fa
Add generation markers to the chat template (#3)
Browse files- Add generation markers to the chat template (59617bfc61ba2fc79082b4619b6da7e1058d65da)
Co-authored-by: Quentin Gallouédec <qgallouedec@users.noreply.huggingface.co>
39 unmodified lines404142434445464748495051525315 unmodified lines69707172737439 unmodified lines{%- set content = content.split('</think>')[-1].lstrip('\n') %}{%- endif %}{%- endif %}{%- if loop.index0 > ns.last_query_index %}{%- if loop.last or (not loop.last and reasoning_content) %}{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}{%- else %}{{- '<|im_start|>' + message.role + '\n' + content }}{%- endif %}{%- else %}{{- '<|im_start|>' + message.role + '\n' + content }}{%- endif %}{%- if message.tool_calls %}{%- for tool_call in message.tool_calls %}15 unmodified lines{%- endfor %}{%- endif %}{{- '<|im_end|>\n' }}{%- elif message.role == "tool" %}{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}{{- '<|im_start|>user' }}39 unmodified lines4041424344454647484950515253545515 unmodified lines7172737475767739 unmodified lines{%- set content = content.split('</think>')[-1].lstrip('\n') %}{%- endif %}{%- endif %}{{- '<|im_start|>' + message.role + '\n' }}{%- generation %}{%- if loop.index0 > ns.last_query_index %}{%- if loop.last or (not loop.last and reasoning_content) %}{{- '<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}{%- else %}{{- content }}{%- endif %}{%- else %}{{- content }}{%- endif %}{%- if message.tool_calls %}{%- for tool_call in message.tool_calls %}15 unmodified lines{%- endfor %}{%- endif %}{{- '<|im_end|>\n' }}{%- endgeneration %}{%- elif message.role == "tool" %}{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}{{- '<|im_start|>user' }}
chat_template.jinja+6-3