Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] chatglm3-6b No corresponding template chat-template #2051

Closed
lostmaniac opened this issue Dec 12, 2023 · 6 comments
Closed

[bug] chatglm3-6b No corresponding template chat-template #2051

lostmaniac opened this issue Dec 12, 2023 · 6 comments

Comments

@lostmaniac
Copy link

https://github.com/vllm-project/vllm/blob/main/examples/template_chatml.jinja

This template is suitable for chatglm2, but not suitable for chatglm3. The new template address document is. https://github.com/THUDM/ChatGLM3/blob/main/PROMPT.md

@jrsperry
Copy link

you can specify the chat template on start up with --chat-template formatted as a single line string, or as a path to a .jinja file. The chat templates come from the tokenizer used by the model, see here for explanation. I've noticed a frequent mismatch as a result, although it's much improved compared to pre-v0.2.3.

@lostmaniac
Copy link
Author

I am using the latest version 0.2.5, but chatglm3 has changed the chat template https://github.com/THUDM/ChatGLM3/blob/main/PROMPT.md

@lostmaniac
Copy link
Author

I've been looking at this template for a long time, but I don't understand how to write it. Could you please help me write a template that supports chatglm3?

@ZhiWenMo
Copy link

I've been looking at this template for a long time, but I don't understand how to write it. Could you please help me write a template that supports chatglm3?

you can modify the .jinjia file like this

{% for message in messages %}
{{'<|' + message['role'] + '|>' + '\n' + message['content'] + '\n' }}
{% endfor %}
{{ '<|assistant|>' }}

and start up with --chat-template

Remember to set the stop token <|user|>

This works fine for my api serve.

@zzhdbw
Copy link

zzhdbw commented Feb 23, 2024

这个模板我看了很久了,但我不明白怎么写。你能帮我写一个支持chatglm3的模板吗?

您可以像这样修改 .jinjia 文件

{% for message in messages %}
{{'<|' + message['role'] + '|>' + '\n' + message['content'] + '\n' }}
{% endfor %}
{{ '<|assistant|>' }}

并使用 --chat-template 启动

请记住设置停止令牌<|user|>

这适用于我的 api 服务。

thank you! ti is useful for me, and could you please provide a chatglm2 template ?, cause the jinjia is hard to understand and use. thank you!

@DarkLight1337
Copy link
Member

thank you! ti is useful for me, and could you please provide a chatglm2 template ?, cause the jinjia is hard to understand and use. thank you!

As mentioned in the original post, this one should work for chatglm2:

https://github.com/vllm-project/vllm/blob/main/examples/template_chatml.jinja

I'm closing this issue since @ZhiWenMo has already provided the template for chatglm3, which answers the original question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants