Update chat_template.jinja
Browse files- chat_template.jinja +36 -32
chat_template.jinja
CHANGED
|
@@ -1,34 +1,38 @@
|
|
| 1 |
-
{
|
| 2 |
-
{%-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
{%- endif -%}
|
| 30 |
-
{{ '<end_of_turn>\n' }}
|
| 31 |
{%- endfor -%}
|
| 32 |
-
{%- if add_generation_prompt -%}
|
| 33 |
-
{{'<start_of_turn>model\n'}}
|
| 34 |
{%- endif -%}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- for m in messages -%}
|
| 2 |
+
{%- if m.role == "system" -%}
|
| 3 |
+
<start_of_turn>user
|
| 4 |
+
{%- set c = m.content -%}
|
| 5 |
+
{%- if c is string -%}
|
| 6 |
+
{{ c }}
|
| 7 |
+
{%- else -%}
|
| 8 |
+
{%- for it in c -%}
|
| 9 |
+
{%- if it.type == "image" -%}
|
| 10 |
+
<start_of_image>
|
| 11 |
+
{%- elif it.type == "text" -%}
|
| 12 |
+
{{ it.text }}
|
| 13 |
+
{%- endif -%}
|
| 14 |
+
{%- endfor -%}
|
| 15 |
+
{%- endif -%}
|
| 16 |
+
<end_of_turn>
|
| 17 |
+
{%- elif m.role == "user" -%}
|
| 18 |
+
<start_of_turn>user
|
| 19 |
+
{%- set c = m.content -%}
|
| 20 |
+
{%- if c is string -%}
|
| 21 |
+
{{ c }}
|
| 22 |
+
{%- else -%}
|
| 23 |
+
{%- for it in c -%}
|
| 24 |
+
{%- if it.type == "image" -%}
|
| 25 |
+
<start_of_image>
|
| 26 |
+
{%- elif it.type == "text" -%}
|
| 27 |
+
{{ it.text }}
|
| 28 |
+
{%- endif -%}
|
|
|
|
|
|
|
| 29 |
{%- endfor -%}
|
|
|
|
|
|
|
| 30 |
{%- endif -%}
|
| 31 |
+
<end_of_turn>
|
| 32 |
+
{%- elif m.role == "assistant" -%}
|
| 33 |
+
<start_of_turn>model
|
| 34 |
+
{{ m.content }}
|
| 35 |
+
<end_of_turn>
|
| 36 |
+
{%- endif -%}
|
| 37 |
+
{%- endfor -%}
|
| 38 |
+
<start_of_turn>model
|