Download chat_template.jinja from LocalWisdom/Penny-Alpha-SFT-dev1: direct link, hf CLI and curl.
- Browser
- Download file 2.21 kB
-
https://huggingface.co/LocalWisdom/Penny-Alpha-SFT-dev1/resolve/main/chat_template.jinja
- Command line
-
hf download hf://LocalWisdom/Penny-Alpha-SFT-dev1/chat_template.jinja
-
curl -L -o chat_template.jinja https://huggingface.co/LocalWisdom/Penny-Alpha-SFT-dev1/resolve/main/chat_template.jinja
2.21 kB
| {#- Penny chat template: the exact format Penny's SFT stages train on (penny.data_mix.encode_chat). | |
| <|end▁of▁sentence|>{system}<|User|>{user}<|Assistant|><think>…</think>{reply}<|end▁of▁sentence|> | |
| * The conversation starts with bos_token (= <|end▁of▁sentence|>, the token Penny saw before every | |
| pretraining document). | |
| * An assistant turn without reasoning gets an empty-think marker "</think>" in front of its reply. | |
| Reasoning can come inside the content ("<think>…</think>reply") or in `reasoning_content`. | |
| * Any role other than system / user / assistant (tool, function, ...) is shown as a user turn | |
| "[role] content". | |
| * add_generation_prompt opens an assistant turn with "<think>" (thinking mode, the default), so | |
| the model always reasons first. enable_thinking=false opens it with "</think>" instead, for a | |
| direct answer. Both are single tokens, so the prompt is token-for-token what SFT trained on. | |
| -#} | |
| {%- macro text(c) -%} | |
| {%- if c is string -%}{{ c }} | |
| {%- elif c is iterable -%}{%- for p in c -%}{%- if p is mapping and p.get('type', 'text') == 'text' -%}{{ p.get('text', '') }}{%- elif p is string -%}{{ p }}{%- endif -%}{%- endfor -%} | |
| {%- endif -%} | |
| {%- endmacro -%} | |
| {{- bos_token -}} | |
| {%- for m in messages -%} | |
| {%- set content = text(m['content']) if m.get('content') is not none else '' -%} | |
| {%- if m['role'] == 'system' -%} | |
| {{- content -}} | |
| {%- elif m['role'] == 'user' -%} | |
| {{- '<|User|>' + content -}} | |
| {%- elif m['role'] == 'assistant' -%} | |
| {%- if m.get('reasoning_content') -%} | |
| {{- '<|Assistant|><think>' + m['reasoning_content'] + '</think>' + content + '<|end▁of▁sentence|>' -}} | |
| {%- elif (content | trim).startswith('<think>') -%} | |
| {{- '<|Assistant|>' + content + '<|end▁of▁sentence|>' -}} | |
| {%- else -%} | |
| {{- '<|Assistant|></think>' + content + '<|end▁of▁sentence|>' -}} | |
| {%- endif -%} | |
| {%- else -%} | |
| {{- '<|User|>[' + m['role'] + '] ' + content -}} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {%- if add_generation_prompt -%} | |
| {%- if enable_thinking is defined and not enable_thinking -%} | |
| {{- '<|Assistant|></think>' -}} | |
| {%- else -%} | |
| {{- '<|Assistant|><think>' -}} | |
| {%- endif -%} | |
| {%- endif -%} | |