API reference
Checkpoints
Signatures, parameters, return contracts, and source for checkpoints.
Overview
Checkpoint files contain model_kind, config, state_dict, and metadata. save_checkpoint writes a temporary sibling then atomically replaces the destination. Model-only checkpoints do not store a complete optimizer or scheduler trajectory. load_checkpoint uses torch.load with weights_only=False, so load trusted artifacts.
Source revision: caef7be03abd. Public export index.
save_checkpoint
axosim.checkpoint.save_checkpoint(model: torch.nn.Module, path: str | Path, *, metadata: dict[str, Any] | None=None) -> None
Serialize supported model weights, configuration, model kind, and caller metadata.
Writes model kind, serializable configuration, state_dict, and metadata. Creates parent directories. Unsupported model types raise TypeError. Returns None.
Parameters
modeltorch.nn.Module- required. Model to execute, optimize, count, or serialize for this operation.
pathstr | Path- required. Filesystem location to read or write; see the operation's persistence contract.
metadatadict[str, Any] | None- keyword-only, default=None. Caller metadata stored with model state.
Returns
resultNone- No return value.
load_checkpoint
axosim.checkpoint.load_checkpoint(path: str | Path, *, map_location: str='cpu') -> tuple[torch.nn.Module, dict[str, Any]]
Reconstruct a supported model and its stored metadata from a trusted checkpoint.
Returns (reconstructed torch.nn.Module, metadata dictionary). Supports baseline/branch_elm, official, branch-trace-rnn, axomamba and axomamba-pytorch, axo-temporal variants, axo-block-forecast variants, adaptive P4 variants, and generic Mamba kinds. An unknown kind raises ValueError; PyTorch artifacts are loaded with weights_only=False.
Parameters
pathstr | Path- required. Filesystem location to read or write; see the operation's persistence contract.
map_locationstr- keyword-only, default='cpu'. PyTorch destination for loaded tensors.
Returns
modeltorch.nn.Module- Reconstructed model with its stored weights, architecture configuration, and backend.
metadatadict[str, Any]- Metadata stored with the checkpoint; an empty dictionary when absent.