nvalchemi.training.TrainingStrategy.save_checkpoint#
- TrainingStrategy.save_checkpoint(root_folder, *, checkpoint_index=-1)[source]#
Save this strategy as a restartable checkpoint.
Rather than pickling the strategy, this writes a spec-based checkpoint: model weights and architecture, optimizer and scheduler state, the training counters (
step_count,epoch_count,batch_count,global_step_count), and the state of anyCheckpointableHookare each serialized through their Pydantic specs, so a restart reconstructs the objects without executing arbitrary pickled code. The non-serializable pieces –training_fnandloss_target_assembler– are intentionally excluded and must be supplied again at load time.Checkpoints are indexed within
root_folderand tracked by a manifest.checkpoint_index=-1(the default) auto-increments from the latest manifest entry, so repeated calls accumulate0, 1, 2, ..., while an explicit index overwrites that slot in place.- Parameters:
root_folder (Path | str) – Root directory for checkpoint files.
checkpoint_index (int, optional) – Checkpoint index to write.
-1auto-increments from the latest manifest index, or starts at0when no manifest exists.
- Returns:
The checkpoint index that was written.
- Return type:
int
See also
restore_checkpointRestore saved state into this strategy instance.
Notes
See Checkpointing in the training guide for the four categories of state a checkpoint captures and the developer requirements for custom models, schedules, and hooks.