Skip to content

vllm.model_executor.models.mimo_v2_omni

Classes:

MiMoV2OmniForCausalLM

Bases: Module, SupportsMultiModal, SupportsPP, SupportsQuant, SupportsEagle3

Methods:

  • forward –

    Run forward pass for Qwen2.5-VL.

forward(input_ids, positions, intermediate_tensors=None, inputs_embeds=None, **kwargs)

Run forward pass for Qwen2.5-VL.

Parameters:

  • input_ids

    (Tensor | None) –

    Flattened (concatenated) input_ids corresponding to a batch.

  • positions

    (Tensor) –

    Flattened (concatenated) position ids corresponding to a batch. NOTE: If mrope is enabled (default setting for Qwen2.5-VL opensource models), the shape will be (3, seq_len), otherwise it will be `(seq_len,).

  • intermediate_tensors

    (IntermediateTensors | None, default: None ) –

    Intermediate tensors from prior forward pass.

  • inputs_embeds

    (Tensor | None, default: None ) –

    Optional tensor of input embeddings.

MiMoV2OmniMultiModalProcessor

Bases: BaseMultiModalProcessor[MiMoV2OmniProcessingInfo]

vLLM multimodal processor for MiMo-Omni (image + video).

Key differences from Qwen2.5-VL: - Videos use timestamp tokens between temporal grid positions. - The HF processor expects (TCHW_tensor, timestamps_T_tensor) video tuples rather than plain numpy arrays. - video_start_times is tracked so prompt-update reconstruction can regenerate the exact same timestamp token IDs.

_get_hf_mm_inputs(mm_items, hf_kwargs)

Convert numpy video arrays to (TCHW, timestamps) tuples for MiMo.

MiMoVisionAttention

Bases: Module

Methods:

_forward_window_attn(q, k, v, cu_seqlens, max_seqlen)

Window attention with the per-head sink applied to key 0.

The reference adds sinks[h] to the logit of each sequence's first key, which the Triton prefill kernel supports directly, so the softmax normalizes over the biased scores in one pass.

forward(x, cu_seqlens, rotary_pos_emb_cos, rotary_pos_emb_sin, max_seqlen, full_attn=True)

Args: x: [seq_len, batch=1, embed_dim] (seq-first convention) cu_seqlens: cumulative sequence lengths [num_seqs+1], int32 rotary_pos_emb_cos: [seq_len, qk_channels // 2] rotary_pos_emb_sin: [seq_len, qk_channels // 2] max_seqlen: maximum sequence length full_attn: if True, full attention; if False, window attention

MiMoVisionTransformer

Bases: Module

Methods:

  • apply_index –

    Reindex tensor at the spatial_merge_unit granularity.

  • forward –

    Args:

  • get_window_index_1d –

    Compute 1D window indices for col-based or row-based SWA reordering.

  • rot_pos_emb –

    Compute 2D rotary position embedding cos/sin for given grid sizes.

apply_index(tensor, index)

Reindex tensor at the spatial_merge_unit granularity.

forward(x, grid_thw)

Parameters:

  • x

    (Tensor) –

    [total_tokens, C] pre-flattened patches

  • grid_thw

    (Tensor) –

    [num_images, 3] tensor of (t, h, w) for each image/video

Returns: [merged_tokens, out_hidden_size]

get_window_index_1d(grid_thw, col=True)

Compute 1D window indices for col-based or row-based SWA reordering.

rot_pos_emb(grid_thw)

Compute 2D rotary position embedding cos/sin for given grid sizes.

Returns:

  • cos ( Tensor ) –

    [total_tokens, qk_channels // 2]

  • sin ( Tensor ) –

    [total_tokens, qk_channels // 2]

_video_timestamps(num_frames, metadata)

Media time of each sampled frame, or 1 s apart without frame timing.

Assume uniform sampling and space them evenly between the first and last sampled frame.