Skip to content

vllm.config.model_arch

Classes:

ModelArchitectureConfig

Configuration for model architecture that required by vLLM runtime.

Methods:

  • __getitem__ –

    ModelArchitectureConfig for a specific layer.

  • from_layers –

    Whole-model config for a checkpoint whose layers differ.

Attributes:

architectures instance-attribute

List of model architecture class names (e.g., ['LlamaForCausalLM']). It can be None upon calling vllm_config.with_hf_config(config.text_config)

derived_max_model_len_and_key instance-attribute

Derived maximum model length and key from the hf config.

head_size instance-attribute

Head dimension of the model.

hidden_size instance-attribute

Hidden size of the model.

is_deepseek_mla instance-attribute

Whether the model is a DeepSeek MLA model.

is_mm_prefix_lm instance-attribute

Whether the model uses image bidirectional attention.

model_type instance-attribute

Model type identifier (e.g., 'llama', 'gpt_oss').

num_experts instance-attribute

Number of experts in the model.

num_experts_per_token instance-attribute

Number of routed experts selected per token.

per_layer_overrides = None class-attribute instance-attribute

Per-layer values for the fields that vary, None unless some field does.

One dict per layer, holding only the fields whose value differs from the whole-model value above. Everything else is read from the whole-model config, so later edits to it are visible through self[layer_idx].

quantization_config instance-attribute

Quantization configuration dictionary containing quantization parameters.

rswa_window instance-attribute

Reference Sliding Window Attention window size (None disables R-SWA).

text_model_type instance-attribute

Text model type identifier (e.g., 'llama4_text').

total_num_attention_heads instance-attribute

Number of attention heads in the model.

total_num_hidden_layers instance-attribute

Number of hidden layers in the model.

total_num_kv_heads instance-attribute

Number of key value heads in the model.

vocab_size instance-attribute

Vocabulary size of the model.

__getitem__(layer_idx)

ModelArchitectureConfig for a specific layer.

Returns self when no field varies by layer, so callers never need to branch on heterogeneity. Mirrors PreTrainedConfig.per_layer_config[i].

from_layers(layers) classmethod

Whole-model config for a checkpoint whose layers differ.

Fields that agree across layers are taken as they are. Fields that differ are collapsed with max, so buffers are sized for the largest layer, and the differing values are kept per layer. No field is named here: which ones vary is whatever the checkpoint says.