tracel-ai/burn · error
Should have at least one learning rate.
Error message
Should have at least one learning rate.
What it means
Panics in ModuleLearningRate::base when the groups list is empty. base() reads groups.first() to return the learning rate of the catch-all group that matches every parameter, so an optimizer or learning-rate group set constructed without any entries violates the type's invariant that at least one (typically default) group exists. Construct ModuleLearningRate with one or more groups to avoid it.
Source
Thrown at crates/burn-optim/src/lr_scheduler/module_lr_scheduler.rs:48
}
}
}
impl ModuleLearningRate {
/// Get the effective learning rate for the given parameter.
pub fn lr_from_param(&self, id: ParamId, path: Option<&str>) -> LearningRate {
self.groups
.iter()
.filter_map(|val| val.group.matches(&id, path).then_some(val.lr))
.next_back()
.expect("Should match at least one parameter group.")
}
/// Get the base learning rate value which's group matches all parameters.
pub fn base(&self) -> LearningRate {
self.groups
.first()
.expect("Should have at least one learning rate.")
.lr
}
}
#[derive(Config, Debug)]
struct LrSchedulerGroupConfig {
group: ParamGroup,
scheduler: LrSchedulerConfig,
}
#[derive(new, Clone)]
struct LrSchedulerGroup {
group: ParamGroup,
scheduler: DynLrScheduler,
}
/// Configuration for a [ModuleLrScheduler].
#[derive(Config, Debug)]View on GitHub (pinned to d16f7ba2ed)
Solutions
- Construct ModuleLearningRate with at least one learning-rate group
- Check for logic that clears or skips populating `groups`
- Use `ModuleLearningRate::from(lr)` to create a single catch-all group
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/burn-optim/src/lr_scheduler/module_lr_scheduler.rs:48 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05).
Data as JSON: /api/errors/3775380cd493d30c.
Report an issue: GitHub.