Update chat_template.jinja
Browse files- chat_template.jinja +4 -28
chat_template.jinja
CHANGED
|
@@ -7,40 +7,16 @@
|
|
| 7 |
{%- if not sep_token is defined -%}
|
| 8 |
{%- set sep_token = "<|end_of_sentence|>" -%}
|
| 9 |
{%- endif -%}
|
| 10 |
-
{%- if not image_token is defined -%}
|
| 11 |
-
{%- set image_token = "<|IMAGE_START|><|IMAGE_PLACEHOLDER|><|IMAGE_END|>" -%}
|
| 12 |
-
{%- endif -%}
|
| 13 |
{{- cls_token -}}
|
| 14 |
{%- for message in messages -%}
|
| 15 |
{%- if message["role"] == "user" -%}
|
| 16 |
-
{{- "User: " -}}
|
| 17 |
-
{%- for content in message["content"] -%}
|
| 18 |
-
{%- if content["type"] == "image" -%}
|
| 19 |
-
{{ image_token }}
|
| 20 |
-
{%- endif -%}
|
| 21 |
-
{%- endfor -%}
|
| 22 |
-
{%- for content in message["content"] -%}
|
| 23 |
-
{%- if content["type"] == "text" -%}
|
| 24 |
-
{{ content["text"] }}
|
| 25 |
-
{%- endif -%}
|
| 26 |
-
{%- endfor -%}
|
| 27 |
-
{{ "\n" -}}
|
| 28 |
{%- elif message["role"] == "assistant" -%}
|
| 29 |
-
{{- "Assistant: " -}}
|
| 30 |
-
{%- for content in message["content"] -%}
|
| 31 |
-
{%- if content["type"] == "text" -%}
|
| 32 |
-
{{ content["text"] + "\n" }}
|
| 33 |
-
{%- endif -%}
|
| 34 |
-
{%- endfor -%}
|
| 35 |
-
{{ sep_token -}}
|
| 36 |
{%- elif message["role"] == "system" -%}
|
| 37 |
-
{
|
| 38 |
-
{%- if content["type"] == "text" -%}
|
| 39 |
-
{{ content["text"] + "\n" }}
|
| 40 |
-
{%- endif -%}
|
| 41 |
-
{%- endfor -%}
|
| 42 |
{%- endif -%}
|
| 43 |
{%- endfor -%}
|
| 44 |
{%- if add_generation_prompt -%}
|
| 45 |
{{- "Assistant: " -}}
|
| 46 |
-
{%- endif -%}
|
|
|
|
| 7 |
{%- if not sep_token is defined -%}
|
| 8 |
{%- set sep_token = "<|end_of_sentence|>" -%}
|
| 9 |
{%- endif -%}
|
|
|
|
|
|
|
|
|
|
| 10 |
{{- cls_token -}}
|
| 11 |
{%- for message in messages -%}
|
| 12 |
{%- if message["role"] == "user" -%}
|
| 13 |
+
{{- "User: <|IMAGE_START|><|IMAGE_PLACEHOLDER|><|IMAGE_END|>" + message["content"] + "\n" -}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
{%- elif message["role"] == "assistant" -%}
|
| 15 |
+
{{- "Assistant: " + message["content"] + sep_token -}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
{%- elif message["role"] == "system" -%}
|
| 17 |
+
{{- message["content"] -}}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
{%- endif -%}
|
| 19 |
{%- endfor -%}
|
| 20 |
{%- if add_generation_prompt -%}
|
| 21 |
{{- "Assistant: " -}}
|
| 22 |
+
{%- endif -%}
|