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

configure_anymodel_metadata

Attach the vLLM AnyModel wrapper contract to a realized HF config.

convert_block_configs_to_per_layer_config

In-place: convert typed block_configs to per_layer_config.

refresh_realized_checkpoint_config

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_type remains unchanged, so Transformers and native AutoModel loaders still resolve the canonical family. vLLM selects its heterogeneous wrapper from architectures and reconstructs each layer from the sparse per_layer_config emitted 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_configs to per_layer_config.

Returns True if a conversion happened, False if there was nothing to convert. If both representations exist, they must match.

keep_block_configs is 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