Skip to content

Better chat format for Qwen2.5-VL #2040

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alcoftTAO
Copy link

CHAT_FORMAT = (
    "<|im_start|>system\n"
    "You are a helpful assistant.<|im_end|>\n"
    "{% for message in messages %}"
    "{% if message['role'] == 'user' %}"
    "<|im_start|>user\n"
    "{% if message['content'] is string %}"
    "{{ message['content'] }}"
    "{% else %}"
    "{% for content in message['content'] %}"
    "{% if content['type'] == 'text' %}"
    "{{ content['text'] }}"
    "{% elif content['type'] == 'image_url' %}"
    "{% if content.image_url is string %}"
    "{{ content.image_url }}"
    "{% else %}"
    "{{ content.image_url.url }}"
    "{% endif %}"
    "{% endif %}"
    "{% endfor %}"
    "{% endif %}"
    "<|im_end|>\n"
    "{% endif %}"
    "{% endfor %}"
    "<|im_start|>assistant\n"
)

This is the current chat format for Qwen2.5-VL, it works but sometimes the model prints a 'random' first token. Example: : In this image, I see...

This new chat format fixes it and also adds custom system messages for the model.

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

Successfully merging this pull request may close these issues.

1 participant