vllm: add MiniCPM-V 4.6 support (MiniCPMV4_6ForConditionalGeneration)#472
Open
Zjq9409 wants to merge 2 commits into
Open
vllm: add MiniCPM-V 4.6 support (MiniCPMV4_6ForConditionalGeneration)#472Zjq9409 wants to merge 2 commits into
Zjq9409 wants to merge 2 commits into
Conversation
Zjq9409
commented
Jun 12, 2026
- 新增 MiniCPMV4_6ForConditionalGeneration(Qwen3.5 backbone + Idefics2 vision tower + hybrid mamba)。
- 依赖 transformers==5.8.0(仓库已 pin,无需改)。
- 6处针对 b8.3.1 基线的适配(mamba dtype 2 参、_get_data_parser().parse_mm_data、vit_merger qkv 权重名、handle_oov_mm_token、idefics2 attention_mask、im_id token 走 tokenizer)。
- 验证:Arc Pro B60 / intel/llm-scaler-vllm:0.14.0-b8.3.1,文本 + 图片(OpenAI API)推理均通过,fp8 量化在线服务正常。
Signed-off-by: Zhoujianqian <15205085056@163.com>
…kens The XPU MiniCPM-V-4.6 support passed vLLM ImageSize (width, height) directly to transformers image_processor.get_sliced_grid / find_best_resize / get_refine_size, which expect (height, width). For non-square images whose slice grid is asymmetric (e.g. 1084x820) this produced a transposed grid, so the number of image placeholder tokens (495) did not match the vision encoder output (441). The mismatched masked_scatter_ then tripped the XPU indexing assert 'totalElements <= srcSize' (torch-xpu-ops Indexing.cpp), killing EngineCore (EngineDeadError -> HTTP 500). Convert ImageSize to (height, width) before calling the processor, matching upstream vLLM releases/v0.24.0. Verified across 12 image sizes that placeholder count now equals encoder token count, and the original crashing request now succeeds.
Author
追加修复:MiniCPM-V-4.6 图像 (W,H)/(H,W) 顺序导致 XPU 崩溃 (commit e71854d)现象:非正方形、且切片网格非对称的图(如 1084×820)发到 XPU 服务时返回 500,server 端报: 根因:
两者不一致 → 修复:在调用 processor 前显式转成 (height, width),与上游 vLLM # vLLM ImageSize is (width, height); transformers get_sliced_grid/
# find_best_resize/get_refine_size expect (height, width).
if hasattr(image_size, "height"):
hf_image_size = (image_size.height, image_size.width)
else:
hf_image_size = (image_size[1], image_size[0])(改动落在 验证:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.