Skip to content

vllm.model_executor.models.minicpmv4_7

Inference-only MiniCPM-V 4.7 model.

Same vision/LLM stack as MiniCPM-V 4.6, plus canvas 3D M-RoPE.

Functions:

  • canvas_rope_delta –

    Offset applied to the 1-D positions of tokens decoded after the prompt.

_CanvasLayout

Bases: NamedTuple

Grid of one canvas measured in LLM tokens.

A canvas is a thumbnail plus the slices cut from it, tiled row-major.

Attributes:

  • cols (int) –

    Slices sharing a canvas row. Zero when the canvas has no slices.

  • slice_w (int) –

    Per-slice grid. Zero when the canvas has no slices.

  • thumb_w (int) –

    Thumbnail grid.

  • width (int) –

    Assembled canvas.

cols instance-attribute

Slices sharing a canvas row. Zero when the canvas has no slices.

slice_w instance-attribute

Per-slice grid. Zero when the canvas has no slices.

thumb_w instance-attribute

Thumbnail grid.

width instance-attribute

Assembled canvas.

_assign_canvas_span(pos3d, *, thumbnail, span_end, slices, base, target_sizes)

Place one canvas at base, writing its 3-D positions into pos3d.

Shared by the video-frame and single-image paths; they differ only in how the per-canvas base advances, not in the geometry placed here.

Mutates pos3d in place, as the packed canvas computation has always done. Returns the distance to the next canvas base, so each caller keeps only its own base advancement.

_canvas_layout(thumbnail, slices, target_sizes)

Measure the canvas for one (thumbnail, slices) group.

thumbnail and each slice are (start, end, target_index) token spans.

_sequential_positions(seq_len)

Positions for the fallback where canvas M-RoPE cannot be computed.

_target_hw(target_sizes, index)

Patch-grid height/width recorded for one image or slice.

canvas_rope_delta(position_ids, seq_len)

Offset applied to the 1-D positions of tokens decoded after the prompt.

The first decoded token sits one past the last prefill position.