vllm_adapter

ModelOpt/AnyModel -> vLLM/AnyModel config adapter.

ModelOpt/AnyModel checkpoints describe per-layer overrides via a dense block_configs list with nested attention / ffn sub-sections. AnyModel in vLLM now consumes the HuggingFace heterogeneity schema: a sparse per_layer_config dict mapping layer_idx -> {flat HF keys + optional "skip" list}.

This module rewrites the Puzzletron schema in-place so vLLM only ever sees per_layer_config. It is invoked from AnyModelConfig.verify_and_update_model_config before the arch convertor or layer-patching runs.

Functions

convert_block_configs_to_per_layer_config

In-place: convert legacy block_configs on hf_config to per_layer_config on its text config.

convert_block_configs_to_per_layer_config(hf_config)

In-place: convert legacy block_configs on hf_config to per_layer_config on its text config.

Returns True if a conversion happened, False if there was nothing to convert. If per_layer_config is already set, the legacy field is dropped and a warning emitted (the new schema wins).

Parameters:

hf_config (Any)

Return type:

bool