Upload chat_template.jinja with huggingface_hub
Browse files- chat_template.jinja +21 -0
chat_template.jinja
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- for message in messages -%}
|
| 2 |
+
{{- '<|start_of_role|>' + message['role'] + '<|end_of_role|>' -}}
|
| 3 |
+
{%- if message['content'] is string -%}
|
| 4 |
+
{{- message['content'] -}}
|
| 5 |
+
{%- else -%}
|
| 6 |
+
{%- for part in message['content'] -%}
|
| 7 |
+
{%- if part['type'] == 'text' -%}
|
| 8 |
+
{{- part['text'] -}}
|
| 9 |
+
{%- elif part['type'] == 'image' -%}
|
| 10 |
+
{{- '<image>' -}}
|
| 11 |
+
{%- endif -%}
|
| 12 |
+
{%- endfor -%}
|
| 13 |
+
{%- endif -%}
|
| 14 |
+
{{- '<|end_of_text|>
|
| 15 |
+
' -}}
|
| 16 |
+
{%- endfor -%}
|
| 17 |
+
{%- if add_generation_prompt -%}
|
| 18 |
+
{{- '<|start_of_role|>assistant' -}}
|
| 19 |
+
{%- if controls -%}{{- ' ' + controls | tojson() -}}{%- endif -%}
|
| 20 |
+
{{- '<|end_of_role|>' -}}
|
| 21 |
+
{%- endif -%}
|