Loading & export#

Load trained models and turn checkpoints into portable artifacts. See Load, run, and fine-tune a model and Export and publish a model for guides.

Top-level functions#

from_pretrained

Load a pimm model from a local export, Hub repo, or raw checkpoint.

save_pretrained

Save model weights to a directory as bare serialized tensors.

push_to_hub

Upload an exported pimm model directory to the Hugging Face Hub.

State-dict helpers#

Lower-level helpers in pimm.export for partial loads and key remapping.

load_pretrained

Load pretrained weights into model with flexible key matching.

load_state_dict_from_checkpoint

Load state dictionary from checkpoint file.

load_checkpoint_metadata

Load checkpoint metadata (everything except state_dict).

clean_state_dict

Remove DDP and torch.compile prefixes from state dict keys.

filter_state_dict_by_prefix

Filter state dict to only include keys with given prefix.

remap_state_dict_keys

Remap state dict keys according to mapping.