{"record":{"id":"12870c33116b6270","repo":"tracel-ai/burn","slug":"can-load-learning-rate-scheduler-checkpoint","errorCode":null,"errorMessage":"Can load learning rate scheduler checkpoint.","messagePattern":"Can load learning rate scheduler checkpoint\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-train/src/learner/base.rs","lineNumber":212,"sourceCode":"    /// state is migrated to each parameter's device on the next step. The training device is fixed\n    /// earlier, when the learner's model is created/forked.\n    pub fn load_checkpoint(&self, mut learner: Learner<M>, epoch: usize) -> Learner<M> {\n        let record = self\n            .model\n            .restore(epoch)\n            .expect(\"Can load model checkpoint.\");\n        learner.load_model(record);\n\n        let record = self\n            .optim\n            .restore(epoch)\n            .expect(\"Can load optimizer checkpoint.\");\n        learner.load_optim(record);\n\n        let record = self\n            .lr_scheduler\n            .restore(epoch)\n            .expect(\"Can load learning rate scheduler checkpoint.\");\n        learner.load_scheduler(record);\n\n        learner\n    }\n}\n\n/// Cloneable reference to an early stopping strategy\npub(crate) type EarlyStoppingStrategyRef = Box<dyn CloneEarlyStoppingStrategy>;\n\n#[derive(Clone, Default)]\n/// A handle that allows aborting the training/evaluation process early.\npub struct Interrupter {\n    state: Arc<AtomicBool>,\n    message: Arc<Mutex<Option<String>>>,\n}\n\nimpl Interrupter {\n    /// Create a new instance.","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-train/src/learner/base.rs#L194-L230","documentation":"In `load_checkpoint`, the learning-rate scheduler record is restored via `restore(epoch)` and unwrapped with expect(). A missing or unreadable scheduler checkpoint for the epoch panics with this message.","triggerScenarios":"Calling load_checkpoint(learner, epoch) where the LR scheduler checkpoint for that epoch is absent (crash between optimizer and scheduler saves, external deletion) or fails to deserialize (different scheduler type/step settings, burn version mismatch).","commonSituations":"Resume runs configured without the scheduler checkpointer or with a different directory; switching LR scheduler (e.g. CosineAnnealing → StepLR) between save and resume; cleaned checkpoint dirs that kept only model weights.","solutions":["Verify the scheduler checkpoint file for the epoch exists in the scheduler checkpointer's directory.","Use the same scheduler checkpointer directory/prefix and the same LR scheduler configuration as the saving run.","Keep all three checkpoint components saved/deleted together to avoid partial sets.","If the scheduler was intentionally changed, don't restore its checkpoint — construct the learner without restore or provide your own loading path.","Recover the file from a backup snapshot, or restart training from an epoch where the full checkpoint set exists."],"exampleFix":"// before\n// scheduler checkpointer never configured on resume\nlearner::load_checkpoint(learner, epoch); // panics\n// after: configure all three checkpointers identically to the saving run\nlet base = \"/checkpoints/run-1\";\nlet checkpointer = LearnerCheckpointer::new(\n    FileCheckpointer::new(Recorder, base, \"model\"),\n    FileCheckpointer::new(Recorder, base, \"optim\"),\n    FileCheckpointer::new(Recorder, base, \"scheduler\"),\n);\nlearner::load_checkpoint(learner, epoch);","handlingStrategy":"validation","validationCode":"let sched_path = Path::new(&checkpoint_dir).join(format!(\"scheduler-{epoch}\"));\nif !sched_path.exists() {\n    eprintln!(\"scheduler checkpoint missing for epoch {epoch}; configure the scheduler checkpointer or restart LR schedule\");\n}\nassert_eq!(current_scheduler_cfg, saved_scheduler_cfg);","typeGuard":"fn scheduler_checkpoint_exists(dir: &str, epoch: usize) -> bool {\n    Path::new(dir).join(format!(\"scheduler-{epoch}\")).exists()\n}","tryCatchPattern":"let result = std::panic::catch_unwind(AssertUnwindSafe(|| learner::load_checkpoint(learner, epoch)));\nif result.is_err() { eprintln!(\"scheduler restore failed; restarting LR schedule from scratch\"); }","preventionTips":["Always configure all three checkpointers (model, optim, scheduler) identically on save and resume.","Keep the LR scheduler configuration stable across save/resume; a changed scheduler can't restore its record meaningfully.","Verify all three files exist for the resume epoch before calling load_checkpoint.","Avoid editing scheduler config mid-run; restart the run instead."],"tags":["rust","panic","checkpoint","learning-rate-scheduler","resume-training"],"backgroundTag":"checkpoint-not-found","analyzedSha":"d16f7ba2ed0d41408189384044cc886fb4c8f957","analyzedAt":"2026-09-05T13:19:14.260Z","contentChangedAt":"2026-09-05T13:19:14.260Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}