convert_any_model
Convert a HuggingFace model to AnyModel format.
Functions
Attach AnyModel metadata to a HuggingFace checkpoint. |
- convert_model(input_dir, output_dir, converter)
Attach AnyModel metadata to a HuggingFace checkpoint.
This function keeps the standard HuggingFace checkpoint layout used for loading and adds typed block_configs for AnyModel compression. The conversion process:
Copies standard checkpoint files, including safetensors and index files
Creates block_configs for each layer
Saves HuggingFace config artifacts with the typed block_configs attached
- Parameters:
input_dir (str) – Path to the input HuggingFace checkpoint directory.
output_dir (str) – Path to the output AnyModel checkpoint directory.
converter (Converter | str) – Either a converter name (e.g., “llama”) or a Converter class.
Example
>>> convert_model( ... input_dir="models/Llama-3.1-8B-Instruct", ... output_dir="puzzle_runs/output/ckpts/teacher", ... converter="llama", ... )