tracel-ai/burn · error
Can save learning rate scheduler checkpoint.
Error message
Can save learning rate scheduler checkpoint.
What it means
On CheckpointingAction::Save, the learning-rate scheduler record is written via its checkpointer and unwrapped with expect(). Failure to serialize or write the scheduler checkpoint panics with this message.
Source
Thrown at crates/burn-train/src/learner/base.rs:184
.delete(epoch)
.expect("Can delete model checkpoint.");
self.optim
.delete(epoch)
.expect("Can delete optimizer checkpoint.");
self.lr_scheduler
.delete(epoch)
.expect("Can delete learning rate scheduler checkpoint.");
}
CheckpointingAction::Save => {
self.model
.save(epoch, learner.model.clone().into_record())
.expect("Can save model checkpoint.");
self.optim
.save(epoch, learner.optim.to_record())
.expect("Can save optimizer checkpoint.");
self.lr_scheduler
.save(epoch, learner.lr_scheduler.to_record())
.expect("Can save learning rate scheduler checkpoint.");
}
}
}
}
/// Load a training checkpoint.
///
/// No device is taken: checkpoints are device-free burnpack records (file-backed bytes). On
/// load, the model keeps the device of the learner's existing parameters, and the optimizer
/// state is migrated to each parameter's device on the next step. The training device is fixed
/// earlier, when the learner's model is created/forked.
pub fn load_checkpoint(&self, mut learner: Learner<M>, epoch: usize) -> Learner<M> {
let record = self
.model
.restore(epoch)
.expect("Can load model checkpoint.");
learner.load_model(record);
View on GitHub (pinned to d16f7ba2ed)
Solutions
- Verify the scheduler FileCheckpointer's directory matches the other checkpointers and is writable.
- Check free disk space — saves happen sequentially, so an almost-full disk often fails on the last component.
- Create the directory up front (create_dir_all) before training starts.
- If a partial save happened, delete that epoch's three files and re-run the Save action.
- Keep all three checkpointers pointed at the same base directory to spot misconfiguration quickly.
Example fix
// before let sched_cp = FileCheckpointer::new(Recorder, "/checkpoint/sched", "scheduler"); // wrong dir // after let base = "/checkpoints/run-1"; std::fs::create_dir_all(base)?; let model_cp = FileCheckpointer::new(Recorder, base, "model"); let optim_cp = FileCheckpointer::new(Recorder, base, "optim"); let sched_cp = FileCheckpointer::new(Recorder, base, "scheduler");
Defensive patterns
Strategy: validation
Validate before calling
let dir = Path::new(&checkpoint_dir);
std::fs::create_dir_all(dir).expect("create checkpoint dir");
assert!(dir.metadata().unwrap().permissions().readonly() == false, "checkpoint dir read-only"); Type guard
fn dir_writable(dir: &str) -> bool {
let p = Path::new(dir).join(".probe");
std::fs::write(&p, b"1").is_ok() && std::fs::remove_file(p).is_ok()
} Try / catch
let result = std::panic::catch_unwind(AssertUnwindSafe(|| checkpointer.checkpoint(actions)));
if result.is_err() { eprintln!("scheduler checkpoint save failed; check dir/disk"); } Prevention
- Configure all three checkpointers with the same base directory to catch path typos.
- Create the checkpoint directory before constructing checkpointers.
- Check disk headroom before each save epoch — sequential saves fail last on a full disk.
When it happens
Trigger: Calling checkpoint() with Save when the LR scheduler record cannot be written: unwritable/missing checkpoint directory, disk full, or serialization error for the scheduler record.
Common situations: Scheduler checkpointer configured with a different (typo'd) path than the other checkpointers; permissions changed on the dir after startup; disk filled during the save sequence (model and optimizer succeeded, scheduler failed).
Related errors
- Can delete learning rate scheduler checkpoint.
- Failed to load module from file
- Can delete model checkpoint.
- Can delete optimizer checkpoint.
- Can save model checkpoint.
AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05).
Data as JSON: /api/errors/e824a998a7d30b79.
Report an issue: GitHub.