Skip to content

vllm.model_executor.models.mllama4

Classes:

Llama4ForConditionalGeneration

Bases: Module, SupportsMultiModal, SupportsPP, MixtureOfExperts, SupportsEncoderCudaGraph, SupportsEagle3, SupportsLoRA

Methods:

_load_other_weights(other_weights, params_dict, stacked_params_mapping)

Load non-language-model weights with stacking support.

_rename_weight_for_modelopt_checkpoint(name)

Rename weights from ModelOpt llama4 fp8 checkpoints to vLLM format.

get_mm_mapping()

Get the module prefix in multimodal models.

Llama4ImagePatchInputs

Bases: TensorSchema

Dimensions: - batch_size: Batch size - total_num_chunks: Batch size * number of chunks - num_channels: Number of channels - image_size: Size of each image

Attributes:

aspect_ratios instance-attribute

A list of aspect ratios corresponding to the number of tiles in each dimension that each image in the batch corresponds to. Each aspect ratio is a pair (ratio_h, ratio_w).

patches_per_image instance-attribute

The number of chunked image tiles for each image in the batch.

This is used to split the embeddings which has the first two dimensions flattened just like pixel_values.

Llama4VisionEncoder

Bases: Module

Methods:

forward(hidden_states)

hidden_states: Input tensor of shape (batch_size, sequence_length, hidden_size). Hidden states from the model embeddings, representing the input tokens. associated vectors than the model's internal embedding lookup matrix.