vllm_adapter
Puzzletron typed block configs -> vLLM/AnyModel config adapter.
Puzzletron stores canonical checkpoints with a dense block_configs list of
typed subblock_configs. The vLLM AnyModel fork consumes the HuggingFace
heterogeneity schema: a sparse per_layer_config dict mapping
layer_idx -> {flat HF keys + optional "skip" list}.
This module rewrites the typed Puzzletron schema in-place so vLLM only sees
per_layer_config. When both forms are present, they must be equivalent.
Functions
Attach the vLLM AnyModel wrapper contract to a realized HF config. |
|
In-place: convert typed |
|
Rebuild vLLM interchange fields without trusting checkpoint code by default. |
- configure_anymodel_metadata(hf_config, descriptor)
Attach the vLLM AnyModel wrapper contract to a realized HF config.
model_typeremains unchanged, so Transformers and native AutoModel loaders still resolve the canonical family. vLLM selects its heterogeneous wrapper fromarchitecturesand reconstructs each layer from the sparseper_layer_configemitted below.- Parameters:
hf_config (Any)
descriptor (Any)
- Return type:
bool
- convert_block_configs_to_per_layer_config(hf_config, *, keep_block_configs=False)
In-place: convert typed
block_configstoper_layer_config.Returns
Trueif a conversion happened,Falseif there was nothing to convert. If both representations exist, they must match.keep_block_configsis intended for canonical realized checkpoints that must be consumable by both Puzzletron’s patched HF model constructors and vLLM AnyModel. The default remains an export-only conversion that removes the Puzzletron representation after deriving vLLM’s representation.- Parameters:
hf_config (Any)
keep_block_configs (bool)
- Return type:
bool
- refresh_realized_checkpoint_config(checkpoint_dir, *, trust_remote_code=False)
Rebuild vLLM interchange fields without trusting checkpoint code by default.
- Parameters:
checkpoint_dir (str | Path)
trust_remote_code (bool)
- Return type:
Path