From 03f1343d469fbc4c3ee114c894c9cadd1ab0f906 Mon Sep 17 00:00:00 2001 From: ZHANG Hao Date: Tue, 28 Oct 2025 09:40:37 +0800 Subject: [PATCH] add chat_template --- README.md | 2 +- README.zh.md => README.zh.md.ori | 0 chat_template.jinja | 16 ++++++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) rename README.zh.md => README.zh.md.ori (100%) create mode 100644 chat_template.jinja diff --git a/README.md b/README.md index 6a1350d..5324101 100644 --- a/README.md +++ b/README.md @@ -175,4 +175,4 @@ curl -X POST http://localhost:10086/v1/chat/completions \ | Qwen/Qwen2-Audio-7B-Instruct | 111.3 | 48.6 | | | Qwen/QwQ-32B-Preview | 53.3 | 18.0 | | | Qwen/Qwen3-Coder-30B-A3B-Instruct | 30.2 | 14.3 | | -| Qwen/Qwen-72B-Chat | 46.9 | 51.4 | 需要提供额外的chat_template.jinja | \ No newline at end of file +| Qwen/Qwen-72B-Chat | 46.9 | 51.4 | 需要提供额外的 [chat_template.jinja](chat_template.jinja) | diff --git a/README.zh.md b/README.zh.md.ori similarity index 100% rename from README.zh.md rename to README.zh.md.ori diff --git a/chat_template.jinja b/chat_template.jinja new file mode 100644 index 0000000..d0088be --- /dev/null +++ b/chat_template.jinja @@ -0,0 +1,16 @@ +{%- for message in messages %} +{%- if message['role'] == 'system' -%} +<|im_start|>system +{{ message['content'] }}<|im_end|> +{%- elif message['role'] == 'user' -%} +<|im_start|>user +{{ message['content'] }}<|im_end|> +{%- elif message['role'] == 'assistant' -%} +<|im_start|>assistant +{{ message['content'] }}<|im_end|> +{%- elif message['role'] == 'tool' -%} +<|im_start|>tool +{{ message['content'] }}<|im_end|> +{%- endif -%} +{%- endfor %} +<|im_start|>assistant