tracel-ai/burn · error

Should match at least one parameter group.

Error message

Should match at least one parameter group.

What it means

Invariant check in `ModuleLearningRate::lr_from_param`: no learning-rate group matched the given parameter id/path, meaning the module LR scheduler was configured without a catch-all group covering this parameter, so lookup panics.

Source

Thrown at crates/burn-optim/src/lr_scheduler/module_lr_scheduler.rs:41

impl From<LearningRate> for ModuleLearningRate {
    fn from(value: LearningRate) -> Self {
        Self {
            groups: vec![LrGroup {
                group: ParamGroup::all(),
                lr: value,
            }],
        }
    }
}

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)]

View on GitHub (pinned to d16f7ba2ed)

Solutions

  1. Add a default group matching all parameters (`ParamGroup::all()`) to the ModuleLearningRate
  2. Check the parameter id/path spelling against the configured groups
  3. Ensure the module mapping covers every parameter of the model
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/burn-optim/src/lr_scheduler/module_lr_scheduler.rs:41 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/b74c5c5dc294f7b7. Report an issue: GitHub.