vllm.transformers_utils.model_arch_config_convertor
¶
Classes:
ModelArchConfigConvertorBase
¶
Methods:
-
convert_layer–Convert one homogeneous config, without resolving per-layer values.
-
get_num_experts–Returns the number of experts in the model.
-
get_num_experts_from_block_configs–Check block_configs for heterogeneous models (e.g., NemotronH).
-
get_per_layer_hf_configs–(hf_config, hf_text_config)per layer, orNoneif homogeneous. -
is_mm_prefix_lm–Whether to use bidirectional attention for mm positions.
_get_qk_rope_head_dim()
¶
Get qk_rope_head_dim, fixing the transformers v5.4+ attribute_map bug.
convert_layer(supports_multimodal=True)
¶
Convert one homogeneous config, without resolving per-layer values.
convert calls this once per layer, so it must not recurse back into
per-layer resolution: the configs it receives are already layer-specific,
and they can still carry the attributes that made the model look
heterogeneous in the first place.
get_num_experts()
¶
Returns the number of experts in the model.
get_num_experts_from_block_configs()
¶
Check block_configs for heterogeneous models (e.g., NemotronH).
For heterogeneous models with varying expert counts per layer, returns the MAX to ensure all expert weights can be loaded.
get_per_layer_hf_configs()
¶
(hf_config, hf_text_config) per layer, or None if homogeneous.
This is the only place that decides whether a checkpoint is heterogeneous and how many layers it has, so a convertor can declare variation that Transformers does not express.
Each pair is converted independently and the results are diffed, so a convertor that overrides this must not also collapse a varying field in its getters: the collapse would then be applied per layer and every layer would report the same value.
is_mm_prefix_lm(supports_multimodal=True)
¶
Whether to use bidirectional attention for mm positions.
supports_multimodal is False when the deployment is configuration-
disabled for multimodal inputs (text-only serving). In that case
mm_prefix is unnecessary and must stay off so attention backends
without supports_mm_prefix() remain eligible.