Unverified Commit b75e314f authored by Alphi's avatar Alphi Committed by GitHub
Browse files

[Bugfix] Add image placeholder for OpenAI Compatible Server of MiniCPM-V (#6787)


Co-authored-by: default avatarhezhihui <hzh7269@modelbest.cn>
Co-authored-by: default avatarCyrus Leung <cyrus.tl.leung@gmail.com>
parent 316a41ac
...@@ -4,6 +4,8 @@ from vllm import LLM, SamplingParams ...@@ -4,6 +4,8 @@ from vllm import LLM, SamplingParams
from vllm.assets.image import ImageAsset from vllm.assets.image import ImageAsset
# 2.0 # 2.0
# The official repo doesn't work yet, so we need to use a fork for now
# For more details, please see: See: https://github.com/vllm-project/vllm/pull/4087#issuecomment-2250397630
# MODEL_NAME = "HwwwH/MiniCPM-V-2" # MODEL_NAME = "HwwwH/MiniCPM-V-2"
# 2.5 # 2.5
MODEL_NAME = "openbmb/MiniCPM-Llama3-V-2_5" MODEL_NAME = "openbmb/MiniCPM-Llama3-V-2_5"
......
...@@ -100,7 +100,9 @@ def _image_token_str(model_config: ModelConfig, ...@@ -100,7 +100,9 @@ def _image_token_str(model_config: ModelConfig,
if model_type == "phi3_v": if model_type == "phi3_v":
# Workaround since this token is not defined in the tokenizer # Workaround since this token is not defined in the tokenizer
return "<|image_1|>" return "<|image_1|>"
if model_type in ("blip-2", "chatglm", "fuyu", "minicpmv", "paligemma"): if model_type == "minicpmv":
return "(<image>./</image>)"
if model_type in ("blip-2", "chatglm", "fuyu", "paligemma"):
# These models do not use image tokens in the prompt # These models do not use image tokens in the prompt
return None return None
if model_type.startswith("llava"): if model_type.startswith("llava"):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment