Skip to content
Discussion options

You must be logged in to vote

You should be able to save the optimizer state/record using optimizer.to_record() and a file recorder, e.g.

recorder.record(optim.to_record(), save_path).unwrap();

This is pretty much what we do in burn-train:

fn save(&self, epoch: usize, record: R) -> Result<(), CheckpointerError> {
let file_path = self.path_for_epoch(epoch);
log::info!("Saving checkpoint {} to {}", epoch, file_path.display());
self.recorder
.record(record, file_path)
.map_err(CheckpointerError::RecorderError)?;
Ok(())
}

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by antimora
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #3392 on July 22, 2025 17:42.