tracel-ai/burn · error
Can delete learning rate scheduler checkpoint.
Error message
Can delete learning rate scheduler checkpoint.
What it means
In `Learner::checkpoint`, the learning-rate-scheduler checkpointer's `delete(epoch)` is unwrapped with expect(). It panics with this message when the LR scheduler checkpoint for that epoch cannot be deleted by the file recorder.
Source
Thrown at crates/burn-train/src/learner/base.rs:173
}
}
/// Create checkpoint for the training process.
pub fn checkpoint(&mut self, learner: &Learner<M>, epoch: usize, store: &EventStoreClient) {
let actions = self.strategy.checkpointing(epoch, store);
for action in actions {
match action {
CheckpointingAction::Delete(epoch) => {
self.model
.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.
///View on GitHub (pinned to d16f7ba2ed)
Solutions
- Confirm the LR scheduler checkpoint file for the epoch exists in the configured directory and is deletable.
- Ensure all three checkpoints (model, optimizer, scheduler) are saved/deleted atomically per epoch.
- Point the checkpointer at the directory that actually holds the scheduler checkpoints.
- Stop concurrent training jobs sharing the checkpoint directory.
- If a prior crash left partial checkpoints, restore the set from backup or delete the whole epoch directory manually and resave.
Example fix
// before
actions = vec![CheckpointingAction::Delete(epoch)]; // scheduler file never written (previous crash)
// after: save all components first, or guard the delete
if scheduler_file_exists(dir, epoch) {
actions.push(CheckpointingAction::Delete(epoch));
}
checkpointer.checkpoint(actions); Defensive patterns
Strategy: validation
Validate before calling
let sched_path = Path::new(&checkpoint_dir).join(format!("scheduler-{epoch}"));
if !sched_path.exists() {
eprintln!("scheduler checkpoint missing for epoch {epoch}; not scheduling delete");
} Type guard
fn scheduler_checkpoint_exists(dir: &str, epoch: usize) -> bool {
Path::new(dir).join(format!("scheduler-{epoch}")).exists()
} Try / catch
let result = std::panic::catch_unwind(AssertUnwindSafe(|| checkpointer.checkpoint(actions)));
if result.is_err() { eprintln!("LR scheduler checkpoint delete failed"); } Prevention
- Save and delete model/optimizer/scheduler checkpoints together so sets stay complete.
- Recover from crashes by checking all three components exist before resuming or pruning.
- Use create_dir_all on the checkpoint base dir before training starts.
When it happens
Trigger: Applying CheckpointingAction::Delete(epoch) where the LR scheduler checkpoint file for that epoch does not exist or cannot be removed (permissions, IO error, wrong directory).
Common situations: Incomplete checkpoint sets where the scheduler file was never saved (e.g. crash between model and scheduler saves) or was cleaned externally; misconfigured checkpoint path; concurrent runs.
Related errors
- Can save 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/a0b505ce7047314f.
Report an issue: GitHub.