vllm.config.model_arch ¶
Classes:
-
ModelArchitectureConfig–Configuration for model architecture that required by vLLM runtime
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(list[str]) –List of model architecture class names (e.g., ['LlamaForCausalLM']).
-
derived_max_model_len_and_key(tuple[float, str | None]) –Derived maximum model length and key from the hf config.
-
head_size(int) –Head dimension of the model.
-
hidden_size(int) –Hidden size of the model.
-
is_deepseek_mla(bool) –Whether the model is a DeepSeek MLA model.
-
is_mm_prefix_lm(bool) –Whether the model uses image bidirectional attention.
-
model_type(str) –Model type identifier (e.g., 'llama', 'gpt_oss').
-
num_experts(int) –Number of experts in the model.
-
num_experts_per_token(int) –Number of routed experts selected per token.
-
per_layer_overrides(list[dict[str, Any]] | None) –Per-layer values for the fields that vary,
Noneunless some field does. -
quantization_config(dict[str, Any] | None) –Quantization configuration dictionary containing quantization parameters.
-
rswa_window(int | None) –Reference Sliding Window Attention window size (None disables R-SWA).
-
text_model_type(str | None) –Text model type identifier (e.g., 'llama4_text').
-
total_num_attention_heads(int) –Number of attention heads in the model.
-
total_num_hidden_layers(int) –Number of hidden layers in the model.
-
total_num_kv_heads(int) –Number of key value heads in the model.
-
vocab_size(int) –Vocabulary size of the model.
Source code in vllm/config/model_arch.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
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].
Source code in vllm/config/model_arch.py
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.