vllm.model_executor.models.minicpmv4_6
¶
Inference-only MiniCPM-V 4.6 model (MiniCPMV4_6ForConditionalGeneration).
Classes:
-
MiniCPMV4_6DownsampleMLP–Match HF (transformers v5.7+) parameter naming: pre_norm/linear_1/
-
MiniCPMV4_6ForConditionalGeneration– -
MiniCPMV4_6Merger– -
MiniCPMV4_6MultiModalProcessor– -
MiniCPMV4_6ProcessingInfo–
MiniCPMV4_6DownsampleMLP
¶
Bases: Module
Match HF (transformers v5.7+) parameter naming: pre_norm/linear_1/ act/linear_2 (instead of pre_norm + Sequential(mlp.0/mlp.2)).
MiniCPMV4_6ForConditionalGeneration
¶
Bases: Module, SupportsMultiModal, SupportsLoRA, SupportsPP, HasInnerState, IsHybrid, SupportsEagle3, SupportsMRoPE
Methods:
-
get_mrope_input_positions–MiniCPM-V uses embedding injection for vision, not spatial M-RoPE.
_drop_vision_last_layer()
¶
Whether the last vision encoder layer is dropped.
MiniCPM-V 4.6 checkpoints always define this. 4.7's config no longer carries the field, so it overrides this.
get_mrope_input_positions(input_tokens, mm_features)
¶
MiniCPM-V uses embedding injection for vision, not spatial M-RoPE.
All tokens (text and vision placeholders) get identical sequential positions duplicated across the 3 M-RoPE channels expected by the Qwen3.5 backbone.
MiniCPMV4_6Merger
¶
MiniCPMV4_6MultiModalProcessor
¶
Bases: MiniCPMVMultiModalProcessor
_video_local_id_prefix(video_idx)
¶
<image_id>{idx}</image_id> prefix emitted in front of a video placeholder.
MiniCPM-V 4.6 numbers each video with a local id, matching MiniCPMV4_6Processor. 4.7 treats a video as one temporal sequence and is trained without these ids, so it overrides this to return an empty string.
MiniCPMV4_6ProcessingInfo
¶
Bases: MiniCPMVProcessingInfo
_compute_visual_tokens(image_size, max_slice_nums=None, downsample_mode=None, image_processor=None)
¶
Compute grid, source_image_visual_tokens and patch_visual_tokens.
Parameters:
-
(image_size¶ImageSize) –Size of the source image.
-
(max_slice_nums¶int | None, default:None) –Maximum number of slices, or None for the default.
-
(downsample_mode¶str | None, default:None) –"16x"(default, full merge) or"4x"(skip vit_merger, 4x more visual tokens). -
(image_processor¶Any, default:None) –Image processor to use, or None to look it up.
Returns:
_expand_flags(value, num_items)
¶
Broadcast a batched per-item flag to exactly one entry per item.
_flat_processor_kwargs(mm_kwargs, downsample_mode)
¶
Drop the modality-scoped nesting and pin the resolved downsample mode.
The placeholder count and the vision tower must read the same mode, so the value resolved for this modality is passed down explicitly rather than leaving the processor to fall back to its own default.
_scoped_mm_kwarg(merged, modality, key)
¶
Read a processor kwarg for one modality.
merged is what _merge_and_resolve_mm_processor_kwargs returns: it
routes a flat key into every scope whose processor declares it, and a value
scoped to the other modality stays there, so it is not visible here.
_select_vision_items(image_input, item_indices, num_slices)
¶
Slice a vision input down to the given items, keeping their order.
_stack_vit_merger_qkv(weights)
¶
Fold separate vit_merger q/k/v projections into the fused qkv_proj module.
HF checkpoints store the window-attention projections separately, while vLLM keeps them fused. The shard_id mechanism on the submodule's WeightsMapper cannot do this: AutoWeightsLoader still recurses over every incoming key after calling a submodule's load_weights, so a "k_proj" key with no matching child raises before the mapping is honoured.