Download chat_template.jinja from SLAI-AITP/SLAI-T-Rex-Pro: direct link, hf CLI and curl.
- Browser
- Download file 2.12 kB
-
https://huggingface.co/SLAI-AITP/SLAI-T-Rex-Pro/resolve/main/chat_template.jinja
- Command line
-
hf download hf://SLAI-AITP/SLAI-T-Rex-Pro/chat_template.jinja
-
curl -L -o chat_template.jinja https://huggingface.co/SLAI-AITP/SLAI-T-Rex-Pro/resolve/main/chat_template.jinja
2.12 kB
| {%- if not add_generation_prompt is defined -%} | |
| {%- set add_generation_prompt = false -%} | |
| {%- endif -%} | |
| {%- if not thinking is defined -%} | |
| {%- if enable_thinking is defined -%} | |
| {%- set thinking = enable_thinking -%} | |
| {%- else -%} | |
| {%- set thinking = false -%} | |
| {%- endif -%} | |
| {%- endif -%} | |
| {%- set ns = namespace(system_prompt='', is_first_sp=true, is_last_user=false, is_only_sys=false, is_prefix=false) -%} | |
| {%- for message in messages -%} | |
| {%- if message['role'] == 'system' -%} | |
| {%- if ns.is_first_sp -%} | |
| {%- set ns.system_prompt = ns.system_prompt + message['content'] -%} | |
| {%- set ns.is_first_sp = false -%} | |
| {%- else -%} | |
| {%- set ns.system_prompt = ns.system_prompt + '\n\n' + message['content'] -%} | |
| {%- endif -%} | |
| {%- set ns.is_only_sys = true -%} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {{- bos_token -}}{{- ns.system_prompt -}} | |
| {%- for message in messages -%} | |
| {%- if message['role'] == 'user' -%} | |
| {%- set ns.is_last_user = true -%} | |
| {{- '<|User|>' + message['content'] -}} | |
| {%- endif -%} | |
| {%- if message['role'] == 'assistant' -%} | |
| {%- if ns.is_last_user -%} | |
| {{- '<|Assistant|>' -}} | |
| {%- if message['prefix'] is defined and message['prefix'] and thinking -%} | |
| {{- '<think>' -}} | |
| {%- else -%} | |
| {{- '</think>' -}} | |
| {%- endif -%} | |
| {%- endif -%} | |
| {%- if message['prefix'] is defined and message['prefix'] -%} | |
| {%- set ns.is_prefix = true -%} | |
| {%- endif -%} | |
| {%- set ns.is_last_user = false -%} | |
| {%- set content = message['content'] -%} | |
| {%- if '</think>' in content -%} | |
| {%- set content = content.split('</think>', 1)[1] -%} | |
| {%- endif -%} | |
| {{- content + '<|end▁of▁sentence|>' -}} | |
| {%- endif -%} | |
| {%- if message['role'] != 'system' -%} | |
| {%- set ns.is_only_sys = false -%} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {%- if add_generation_prompt -%} | |
| {%- if ns.is_last_user or ns.is_only_sys or not ns.is_prefix -%} | |
| {{- '<|Assistant|>' -}} | |
| {%- if not thinking -%} | |
| {{- '</think>' -}} | |
| {%- else -%} | |
| {{- '<think>' -}} | |
| {%- endif -%} | |
| {%- endif -%} | |
| {%- endif -%} |