pub fn save_training<B: Backend>(
path: impl AsRef<Path>,
checkpoint: &TrainingCheckpoint<B>,
) -> Result<()>Expand description
Save a complete training checkpoint to a file.
This saves model parameters, optimizer state, epoch, and loss history, enabling full training resume.
use shrew::checkpoint::{self, TrainingCheckpoint};
use shrew::prelude::*;
// During training:
let ckpt = TrainingCheckpoint::<CpuBackend>::new()
.with_epoch(10)
.with_global_step(5000)
.with_best_loss(0.032)
.with_loss_history(vec![0.5, 0.2, 0.1, 0.05, 0.032]);
checkpoint::save_training("training.shrew", &ckpt).unwrap();