Skip to content

vllm.model_executor.models.molmo2

Classes:

AdapterConfig dataclass

Config for a vit-llm adapter.

ImagePoolingAttention

Bases: Module

Multi-head attention used for image pooling.

ImageProjectorMLP

Bases: Module

MLP used for the image projector.

LanguageModelMLP

Bases: Module

Molmo2's LLM mlp.

Molmo2Attention

Bases: Module

Molmo2's LLM Attention.

Molmo2ForConditionalGeneration

Bases: Module, SupportsMultiModal, SupportsPP, SupportsLoRA, SupportsQuant

Methods:

get_mm_mapping()

Get the module prefix in multimodal models.

Molmo2ImageInputs

Bases: TensorSchema

Dimensions: - nc: The total number of crops (dynamic) - np: The total number of patches per crop - cps: Number of channels * patch_size * patch_size - npp: Number of pooled patches (dynamic) - pp: pooling_size * pooling_size - ni: Number of images - nt: Number of image tokens (dynamic)

Attributes:

token_pooling instance-attribute

An index tensor that maps image features to their corresponding patch tokens before pooling.

Molmo2VideoInputs

Bases: TensorSchema

Dimensions: - nc: The total number of frames (dynamic) - np: The total number of patches per frame - cps: Number of channels * patch_size * patch_size - npp: Number of pooled patches (dynamic) - pp: pooling_size * pooling_size - nv: Number of videos - nt: Number of video tokens (dynamic)

Attributes:

token_pooling instance-attribute

An index tensor that maps image features to their corresponding patch tokens before pooling.

Molmo2VisionBackbone

Bases: Module, SupportsQuant

Methods:

  • encode_image –

    : param images: (batch_size, num_crops, num_patch, n_pixels).

encode_image(images)

: param images: (batch_size, num_crops, num_patch, n_pixels).

Molmo2VisionBlock

Bases: Module

Residual attention block used in Vision Transformer.

Molmo2VisionBlockCollection

Bases: Module

Collection of residual attention blocks used in Vision Transformer.

Molmo2VisionTransformer

Bases: Module

Vision Transformer used in Vision Backbone.

Methods:

  • forward –

    : param x: (batch_size, num_patch, n_pixels).

forward(x, patch_num=None)

: param x: (batch_size, num_patch, n_pixels).

TextConfig dataclass

Configuration for a text model transformer.

Attributes:

additional_vocab_size = 128 class-attribute instance-attribute

Number of additional tokens to have the input embeddings for

head_dim = 128 class-attribute instance-attribute

The head dimensionality for the attention mechanism.

hidden_act = 'silu' class-attribute instance-attribute

The activation function to use within the MLP layers.

hidden_size = 3584 class-attribute instance-attribute

The hidden size of the model.

intermediate_size = 18944 class-attribute instance-attribute

The hidden size for the MLP.

layer_norm_eps = 1e-06 class-attribute instance-attribute

epsilon for layer norms

max_position_embeddings = 4096 class-attribute instance-attribute

Max positional embeddings to use in RoPE cache

norm_after = False class-attribute instance-attribute

Apply layer norm before and after the attention and MLP blocks.

num_attention_heads = 28 class-attribute instance-attribute

The number of self-attention heads.

num_hidden_layers = 48 class-attribute instance-attribute

The number of layers/blocks.

num_key_value_heads = 4 class-attribute instance-attribute

The number of heads to use for keys and values.

qk_norm_type = 'olmo' class-attribute instance-attribute

The type of layer norm to use for the keys and queries. Can be "olmo" or "qwen3".

qkv_bias = True class-attribute instance-attribute

Do QKV projection a bias

rope_scaling_layers = None class-attribute instance-attribute

RoPE scaling layers.

rope_theta = 1000000.0 class-attribute instance-attribute

RoPE theta parameter.

use_qk_norm = False class-attribute instance-attribute

Apply layer norm to the keys and queries within the attention mechanism. This can help stabilize training.

vocab_size = 152064 class-attribute instance-attribute

Vocabulary size of the model.

ViTMLP

Bases: Module

MLP used in Vision Transformer.

ViTMultiHeadDotProductAttention

Bases: Module

Multi-head attention used in Vision Transformer.

VitConfig dataclass

Config for a vision transformer.