Fix chat template
Browse files- chat_template.jinja +25 -7
chat_template.jinja
CHANGED
|
@@ -1,7 +1,25 @@
|
|
| 1 |
-
{
|
| 2 |
-
|
| 3 |
-
{
|
| 4 |
-
{
|
| 5 |
-
{
|
| 6 |
-
{
|
| 7 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- for message in messages -%}
|
| 2 |
+
{%- if loop.first and message["role"] != "system" -%}
|
| 3 |
+
{{- "<|im_start|>system\nYou are Qwen, a virtual human developed by the Qwen Team, Alibaba Group, capable of perceiving auditory and visual inputs, as well as generating text and speech.<|im_end|>\n" -}}
|
| 4 |
+
{%- endif -%}
|
| 5 |
+
{{- "<|im_start|>" -}}
|
| 6 |
+
{{- message["role"] -}}
|
| 7 |
+
{{- "\n" -}}
|
| 8 |
+
{%- if message["content"] is string -%}
|
| 9 |
+
{{- message["content"] -}}
|
| 10 |
+
{%- else -%}
|
| 11 |
+
{%- for content in message["content"] -%}
|
| 12 |
+
{%- if content["type"] == "text" -%}
|
| 13 |
+
{{- content["text"] -}}
|
| 14 |
+
{%- elif content["type"] == "audio" -%}
|
| 15 |
+
{{- "<|audio_bos|><|AUDIO|><|audio_eos|>" -}}
|
| 16 |
+
{%- endif -%}
|
| 17 |
+
{%- endfor -%}
|
| 18 |
+
{%- endif -%}
|
| 19 |
+
{%- if not loop.last or loop.last and not continue_final_message -%}
|
| 20 |
+
{{- "<|im_end|>\n" -}}
|
| 21 |
+
{%- endif -%}
|
| 22 |
+
{%- endfor -%}
|
| 23 |
+
{%- if add_generation_prompt -%}
|
| 24 |
+
{{- "<|im_start|>assistant\n" -}}
|
| 25 |
+
{%- endif -%}
|