vllm.model_executor.models.molmo2
¶
Classes:
-
AdapterConfig–Config for a vit-llm adapter.
-
ImagePoolingAttention–Multi-head attention used for image pooling.
-
ImageProjectorMLP–MLP used for the image projector.
-
LanguageModelMLP–Molmo2's LLM mlp.
-
Molmo2Attention–Molmo2's LLM Attention.
-
Molmo2ForConditionalGeneration– -
Molmo2ImageInputs–Dimensions:
-
Molmo2VideoInputs–Dimensions:
-
Molmo2VisionBackbone– -
Molmo2VisionBlock–Residual attention block used in Vision Transformer.
-
Molmo2VisionBlockCollection–Collection of residual attention blocks used in Vision Transformer.
-
Molmo2VisionTransformer–Vision Transformer used in Vision Backbone.
-
TextConfig–Configuration for a text model transformer.
-
ViTMLP–MLP used in Vision Transformer.
-
ViTMultiHeadDotProductAttention–Multi-head attention used in Vision Transformer.
-
VitConfig–Config for a vision transformer.
AdapterConfig
dataclass
¶
Config for a vit-llm adapter.
Molmo2ForConditionalGeneration
¶
Bases: Module, SupportsMultiModal, SupportsPP, SupportsLoRA, SupportsQuant
Methods:
-
get_mm_mapping–Get the module prefix in multimodal models.
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(Annotated[Tensor, TensorShape(npp, pp)]) –An index tensor that maps image features to their corresponding
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(Annotated[Tensor, TensorShape(npp, pp)]) –An index tensor that maps image features to their corresponding
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).
Molmo2VisionBlockCollection
¶
Molmo2VisionTransformer
¶
TextConfig
dataclass
¶
Configuration for a text model transformer.
Attributes:
-
additional_vocab_size(int) –Number of additional tokens to have the input embeddings for
-
head_dim(int) –The head dimensionality for the attention mechanism.
-
hidden_act(str) –The activation function to use within the MLP layers.
-
hidden_size(int) –The hidden size of the model.
-
intermediate_size(int) –The hidden size for the MLP.
-
layer_norm_eps(float) –epsilon for layer norms
-
max_position_embeddings(int) –Max positional embeddings to use in RoPE cache
-
norm_after(bool) –Apply layer norm before and after the attention and MLP blocks.
-
num_attention_heads(int) –The number of self-attention heads.
-
num_hidden_layers(int) –The number of layers/blocks.
-
num_key_value_heads(int) –The number of heads to use for keys and values.
-
qk_norm_type(str) –The type of layer norm to use for the keys and queries.
-
qkv_bias(bool) –Do QKV projection a bias
-
rope_scaling_layers(tuple[int, ...] | None) –RoPE scaling layers.
-
rope_theta(float) –RoPE theta parameter.
-
use_qk_norm(bool) –Apply layer norm to the keys and queries within the attention mechanism.
-
vocab_size(int) –Vocabulary size of the model.
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.
VitConfig
dataclass
¶
Config for a vision transformer.