pimm.export.load_state_dict_from_checkpoint#

load_state_dict_from_checkpoint(checkpoint_path: str, device: str | device = 'cpu', weights_only: bool = False) Dict[str, Any][source]#

Load state dictionary from checkpoint file.

Automatically detects checkpoint format and extracts the state dict. Supports both pretrained weights (just state dict) and training checkpoints (dict with metadata).

Parameters:
  • checkpoint_path – Path to checkpoint file.

  • device – Device to load checkpoint to.

  • weights_only – Whether to load only weights (torch.load parameter).

Returns:

State dictionary extracted from checkpoint.