Create chat_template.jinja
Browse files- chat_template.jinja +39 -0
chat_template.jinja
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{# ============================================================
|
| 2 |
+
Ina-v11.1 Chat Template (Llama-3.1 header style)
|
| 3 |
+
============================================================ #}
|
| 4 |
+
|
| 5 |
+
{{- '<|begin_of_text|>' }}
|
| 6 |
+
|
| 7 |
+
{%- for message in messages %}
|
| 8 |
+
|
| 9 |
+
{%- if message['role'] == 'system' %}
|
| 10 |
+
{{- '<|start_header_id|>system<|end_header_id|>' + '\n' }}
|
| 11 |
+
{{- message['content'] }}
|
| 12 |
+
{{- '<|eot_id|>' }}
|
| 13 |
+
|
| 14 |
+
{%- elif message['role'] == 'user' %}
|
| 15 |
+
{{- '<|start_header_id|>user<|end_header_id|>' + '\n' }}
|
| 16 |
+
{{- message['content'] }}
|
| 17 |
+
{{- '<|eot_id|>' }}
|
| 18 |
+
|
| 19 |
+
{%- elif message['role'] == 'assistant' %}
|
| 20 |
+
{{- '<|start_header_id|>assistant<|end_header_id|>' + '\n' }}
|
| 21 |
+
{{- message['content'] }}
|
| 22 |
+
{{- '<|eot_id|>' }}
|
| 23 |
+
|
| 24 |
+
{%- elif message['role'] == 'tool' %}
|
| 25 |
+
{# Optional: format tool responses if you ever add tools #}
|
| 26 |
+
{{- '<|start_header_id|>tool<|end_header_id|>' + '\n' }}
|
| 27 |
+
{{- message['content'] }}
|
| 28 |
+
{{- '<|eot_id|>' }}
|
| 29 |
+
|
| 30 |
+
{%- endif %}
|
| 31 |
+
|
| 32 |
+
{%- endfor %}
|
| 33 |
+
|
| 34 |
+
{# ============================================================
|
| 35 |
+
Optional: add generation header if user requests it
|
| 36 |
+
============================================================ #}
|
| 37 |
+
{%- if add_generation_prompt %}
|
| 38 |
+
{{- '<|start_header_id|>assistant<|end_header_id|>' + '\n' }}
|
| 39 |
+
{%- endif %}
|