mirror of
https://github.com/deepseek-ai/DeepSeek-VL2.git
synced 2026-11-05 01:07:23 +00:00
[GH-ISSUE #77] DeepSeek-VL2 tokenizer_config.json文件兼容vllm多模态接口修复建议 #63
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
deepseek-ai/DeepSeek-VL2#63
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @songafu on GitHub (Feb 12, 2025).
Original GitHub issue: https://github.com/deepseek-ai/DeepSeek-VL2/issues/77
环境要求:
vllm版本:>=0.7.2
注意vllm运行必须带architectures参数:python -m vllm.entrypoints.openai.api_server --hf_overrides '{"architectures": ["DeepseekVLV2ForCausalLM"]}'
涉及文件https://huggingface.co/deepseek-ai/deepseek-vl2/blob/main/tokenizer_config.json
建议tokenizer_config.json文件补充增加如下内容:
"chat_template": "{%- set found_item = false -%}\n{%- for message in messages -%}\n {%- if message['role'] == 'system' -%}\n {%- set found_item = true -%}\n {%- endif -%}\n{%- endfor -%}\n{%- if not found_item -%}\n{{'You are an AI programming assistant, utilizing the Deepseek Coder model, developed by Deepseek Company, and you only answer questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer.\n'}}\n{%- endif %}\n{%- for message in messages %}\n {%- if message['role'] == 'system' %}\n{{ message['content'] }}\n {%- else %}\n {%- if message['role'] == 'user' %}\n{{'### Instruction:\n' + message['content'] + '\n'}}\n {%- else %}\n{{'### Response:\n' + message['content'] + '\n<|EOT|>\n'}}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{{'### Response:\n'}}\n",
此时可以利用vllm原生的多模态接口可访问成功:
curl http://localhost:8000/v1/chat/completions
-H "Content-Type: application/json"
-d '{
"model": "deepseek-ai/deepseek-vl2",
"messages": [
{
"role": "user",
"content": [
{
"type": "image_url",
"image_url": {
"url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg"
}
},
{
"type": "text",
"text": "Describe this image in one sentence."
}
]
}
]
@HubHop commented on GitHub (Feb 13, 2025):
Thanks @songafu, we will consider making an update.
@VincentYCYao commented on GitHub (Jul 21, 2025):
Hey! Same issue when using lmms-eval
I add chat template support to lmms-eval here.
Inference:
We can use the chat template file: chat template: https://raw.githubusercontent.com/vllm-project/vllm/main/examples/template_deepseek_vl2.jinja
It's definitely better to have the chat template in tokenizer so that we can get the template with
@VincentYCYao commented on GitHub (Jul 21, 2025):
The chat template file is removed from vllm repo, see the original PR (https://github.com/vllm-project/vllm/pull/12143/files).
Alternative: