facebookresearch/detectron2 · error · ValueError
Milestones should be a list of increasing integers. Got {}
Error message
Milestones should be a list of increasing integers. Got {} What it means
WarmupMultiStepLR (deprecated) requires milestones to be a strictly increasing list of ints; an unsorted or duplicated list fails the sorted() equality check in __init__.
Source
Thrown at detectron2/solver/lr_scheduler.py:156
# MultiStepLR with WarmupLR but the current LRScheduler design doesn't allow it.
class WarmupMultiStepLR(LRScheduler):
def __init__(
self,
optimizer: torch.optim.Optimizer,
milestones: List[int],
gamma: float = 0.1,
warmup_factor: float = 0.001,
warmup_iters: int = 1000,
warmup_method: str = "linear",
last_epoch: int = -1,
):
logger.warning(
"WarmupMultiStepLR is deprecated! Use LRMultipilier with fvcore ParamScheduler instead!"
)
if not list(milestones) == sorted(milestones):
raise ValueError(
"Milestones should be a list of" " increasing integers. Got {}", milestones
)
self.milestones = milestones
self.gamma = gamma
self.warmup_factor = warmup_factor
self.warmup_iters = warmup_iters
self.warmup_method = warmup_method
super().__init__(optimizer, last_epoch)
def get_lr(self) -> List[float]:
warmup_factor = _get_warmup_factor_at_iter(
self.warmup_method, self.last_epoch, self.warmup_iters, self.warmup_factor
)
return [
base_lr * warmup_factor * self.gamma ** bisect_right(self.milestones, self.last_epoch)
for base_lr in self.base_lrs
]
View on GitHub (pinned to a2f4a8771a)
Solutions
- Sort milestones ascending and remove duplicates before constructing
- Fix cfg.SOLVER.STEPS = [10000, 30000] ordering in the config
- Migrate to LRMultiplier with fvcore MultiStepParamScheduler
Example fix
# before cfg.SOLVER.STEPS = (30000, 10000) # after cfg.SOLVER.STEPS = (10000, 30000)
Defensive patterns
Strategy: validation
Validate before calling
steps = list(cfg.SOLVER.STEPS) assert steps == sorted(steps) and len(set(steps)) == len(steps), 'SOLVER.STEPS must be increasing, unique'
Prevention
- Keep SOLVER.STEPS sorted in YAML
- Validate milestones before constructing schedulers
When it happens
Trigger: Passing milestones=[30000, 10000] or [1000, 1000, 20000] to WarmupMultiStepLR, typically via cfg.SOLVER.STEPS in wrong order.
Common situations: Hand-edited YAML configs where steps were appended out of order; merging config files that reorder SOLVER.STEPS.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Unknown LR scheduler: {}
- Unknown warmup method: {}
- 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/d2fbdba6a678f45f.
Report an issue: GitHub.