Skip to content

vllm.model_executor.models.ernie45_vl

Inference-only Ernie VL model compatible with HuggingFace weights.

Classes:

Functions:

Ernie4_5_VLImagePixelInputs

Bases: TensorSchema

Dimensions: - np: The total number of patches over each image over each prompt in the batch - ni: Number of images - cps: Number of channels * patch_size * patch_size

Ernie4_5_VLMoeForConditionalGeneration

Bases: Module, SupportsMultiModal, SupportsLoRA, SupportsPP, SupportsMRoPE, SupportsEncoderCudaGraph

_set_visual_token_mask(input_ids)

Set mask for visual tokens (image/video patches and delimiters).

Ernie4_5_VLVideoPixelInputs

Bases: TensorSchema

Dimensions: - np: The total number of patches over each image over each prompt in the batch - ni: Number of images - cps: Number of channels * temporal_patch_size * patch_size * patch_size

Ernie4_5_VisionAttention

Bases: Module

VisionAttention using VLLM framework APIs.

Ernie4_5_VisionTransformer

Bases: Module

Methods:

prepare_encoder_metadata(grid_thw, *, num_pad=0, max_batch_size=None, max_seqlen_override=None, device=None)

Compute encoder metadata outside the CUDA graph.

Splits the rotary embeddings, cu_seqlens and max_seqlen out of forward so they can be precomputed on the host side and fed into a captured graph through fixed buffers. Shared by the eager path, CUDA graph capture and CUDA graph replay

Parameters:

  • grid_thw

    (Tensor | list[list[int]]) –

    Per-frame grid sizes as a [num_frames, 3] tensor or an equivalent list of [t, h, w].

  • num_pad

    (int, default: 0 ) –

    Legacy cu_seqlens padding

  • max_batch_size

    (int | None, default: None ) –

    If set, pad cu_seqlens to max_batch_size + 1 entries for a fixed graph buffer shape.

  • max_seqlen_override

    (int | None, default: None ) –

    If set, use this value for max_seqlen instead of deriving it from cu_seqlens. CUDA graph capture bakes max_seqlen at capture time, so it must cover the worst-case replay.

  • device

    (device | None, default: None ) –

    Device for the returned tensors. Defaults to self.device.

Returns:

  • dict[str, Tensor] –

    Dict with rotary_pos_emb, cu_seqlens and max_seqlen.

all_gather_interleave(local_tensor, hidden_size, tp_size)

All-gather the input tensor interleavely across model parallel group.