Update chat_template.jinja
Browse files- chat_template.jinja +26 -1
chat_template.jinja
CHANGED
|
@@ -1 +1,26 @@
|
|
| 1 |
-
{% set image_count = namespace(value=0) %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% set image_count = namespace(value=0) %}
|
| 2 |
+
{% for message in messages %}
|
| 3 |
+
{% if loop.first and message['role'] != 'system' %}
|
| 4 |
+
<|im_start|>system<|im_end|>
|
| 5 |
+
{% endif %}
|
| 6 |
+
<|im_start|>{{ message['role'] }}
|
| 7 |
+
{% if message['content'] is string %}
|
| 8 |
+
{{ message['content'] }}<|im_end|>
|
| 9 |
+
{% else %}
|
| 10 |
+
{% for content in message['content'] %}
|
| 11 |
+
{% if content['type'] == 'image' or 'image' in content or 'image_url' in content %}
|
| 12 |
+
{% set image_count.value = image_count.value + 1 %}
|
| 13 |
+
{% if add_vision_id %}
|
| 14 |
+
Picture {{ image_count.value }}:
|
| 15 |
+
{% endif -%}
|
| 16 |
+
<|image_pad|>
|
| 17 |
+
{%- elif 'text' in content %}
|
| 18 |
+
{{ content['text'] }}
|
| 19 |
+
{% endif %}
|
| 20 |
+
{% endfor %}
|
| 21 |
+
<|im_end|>
|
| 22 |
+
{% endif %}
|
| 23 |
+
{% endfor %}
|
| 24 |
+
{% if add_generation_prompt %}
|
| 25 |
+
<|im_start|>assistant
|
| 26 |
+
{% endif %}
|