facebookresearch/detectron2 · error · ValueError
Unknown LR scheduler: {}
Error message
Unknown LR scheduler: {} What it means
build_lr_scheduler only supports a fixed set of scheduler names (WarmupMultiStepLR, WarmupCosineLR, WarmupPolyLR, and fvcore-based composite names). Any other cfg.SOLVER.LR_SCHEDULER_NAME string is rejected.
Source
Thrown at detectron2/solver/build.py:314
)
sched = MultiStepParamScheduler(
values=[cfg.SOLVER.GAMMA**k for k in range(len(steps) + 1)],
milestones=steps,
num_updates=cfg.SOLVER.MAX_ITER,
)
elif name == "WarmupCosineLR":
end_value = cfg.SOLVER.BASE_LR_END / cfg.SOLVER.BASE_LR
assert end_value >= 0.0 and end_value <= 1.0, end_value
sched = CosineParamScheduler(1, end_value)
elif name == "WarmupStepWithFixedGammaLR":
sched = StepWithFixedGammaParamScheduler(
base_value=1.0,
gamma=cfg.SOLVER.GAMMA,
num_decays=cfg.SOLVER.NUM_DECAYS,
num_updates=cfg.SOLVER.MAX_ITER,
)
else:
raise ValueError("Unknown LR scheduler: {}".format(name))
sched = WarmupParamScheduler(
sched,
cfg.SOLVER.WARMUP_FACTOR,
min(cfg.SOLVER.WARMUP_ITERS / cfg.SOLVER.MAX_ITER, 1.0),
cfg.SOLVER.WARMUP_METHOD,
cfg.SOLVER.RESCALE_INTERVAL,
)
return LRMultiplier(optimizer, multiplier=sched, max_iter=cfg.SOLVER.MAX_ITER)
View on GitHub (pinned to a2f4a8771a)
Solutions
- Use one of: 'WarmupMultiStepLR', 'WarmupCosineLR', 'WarmupPolyLR', or an fvcore composite like 'WarmupCosineLR' variants / 'MultiStepLR'
- Check the spelling against detectron2/solver/build.py's if/elif chain
- Implement a custom scheduler and register it in your own build path
Example fix
# before cfg.SOLVER.LR_SCHEDULER_NAME = 'cosine' # after cfg.SOLVER.LR_SCHEDULER_NAME = 'WarmupCosineLR'
Defensive patterns
Strategy: validation
Validate before calling
supported = {'WarmupMultiStepLR', 'WarmupCosineLR', 'WarmupPolyLR'}
assert cfg.SOLVER.LR_SCHEDULER_NAME in supported or '+' in cfg.SOLVER.LR_SCHEDULER_NAME Prevention
- Copy scheduler names verbatim from detectron2 configs
- Validate config keys before build_lr_scheduler
When it happens
Trigger: Setting cfg.SOLVER.LR_SCHEDULER_NAME to an unsupported/misspelled value such as 'cosine', 'step', or a custom name, then calling build_lr_scheduler(cfg, optimizer).
Common situations: Porting configs from other frameworks (mmdetection, torchvision) whose scheduler names differ; typos like 'WarmupCosine' without the LR suffix.
Related errors
- Unknown warmup method: {}
- Milestones should be a list of increasing integers. Got {}
- Class with @configurable must have a 'from_config' classmeth
- {name} must take 'cfg' as the first argument!
- total_batch_size and single_gpu_batch_size are mutually inco
AI-assisted analysis of facebookresearch/detectron2@a2f4a8771a (2026-08-27).
Data as JSON: /api/errors/b46c6a2a88326182.
Report an issue: GitHub.