Skip to main content

CheckpointFn

Trait CheckpointFn 

Source
pub trait CheckpointFn {
    // Required method
    fn save(
        &mut self,
        epoch: usize,
        artifact: &EpochArtifact,
    ) -> Result<(), String>;
}
Expand description

Per-epoch checkpoint hook (task #111 step 7).

Invoked by PretrainLoop::run_epoch after the divergence gate (GATE-TRAIN-005) has passed for the epoch, so aborted epochs never produce checkpoint files. The implementation must write to artifact.checkpoint_path (an .apr file per the contract’s per_epoch_artifacts.path_template). Returning an error does not abort the loop — it records a warning to stderr and the epoch artifact is still added to history — so a slow or flaky disk does not lose training progress.

Required Methods§

Source

fn save(&mut self, epoch: usize, artifact: &EpochArtifact) -> Result<(), String>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§