deepseek-ai / deepseek-ai/DeepSeek-VL2
DeepSeek-VL2 tokenizer_config.json文件兼容vllm多模态接口修复建议
- Dominant language
- Python
- Stars
- 5.4k
- Forks
- 1.8k
- PR merge metrics
- No merged PRs in 30d
Description
环境要求:
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."
}
]
}
]
}'
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.