{"record":{"id":"d2fbdba6a678f45f","repo":"facebookresearch/detectron2","slug":"milestones-should-be-a-list-of-increasing-integers","errorCode":null,"errorMessage":"Milestones should be a list of increasing integers. Got {}","messagePattern":"Milestones should be a list of increasing integers\\. Got (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"detectron2/solver/lr_scheduler.py","lineNumber":156,"sourceCode":"# MultiStepLR with WarmupLR but the current LRScheduler design doesn't allow it.\n\n\nclass WarmupMultiStepLR(LRScheduler):\n    def __init__(\n        self,\n        optimizer: torch.optim.Optimizer,\n        milestones: List[int],\n        gamma: float = 0.1,\n        warmup_factor: float = 0.001,\n        warmup_iters: int = 1000,\n        warmup_method: str = \"linear\",\n        last_epoch: int = -1,\n    ):\n        logger.warning(\n            \"WarmupMultiStepLR is deprecated! Use LRMultipilier with fvcore ParamScheduler instead!\"\n        )\n        if not list(milestones) == sorted(milestones):\n            raise ValueError(\n                \"Milestones should be a list of\" \" increasing integers. Got {}\", milestones\n            )\n        self.milestones = milestones\n        self.gamma = gamma\n        self.warmup_factor = warmup_factor\n        self.warmup_iters = warmup_iters\n        self.warmup_method = warmup_method\n        super().__init__(optimizer, last_epoch)\n\n    def get_lr(self) -> List[float]:\n        warmup_factor = _get_warmup_factor_at_iter(\n            self.warmup_method, self.last_epoch, self.warmup_iters, self.warmup_factor\n        )\n        return [\n            base_lr * warmup_factor * self.gamma ** bisect_right(self.milestones, self.last_epoch)\n            for base_lr in self.base_lrs\n        ]\n","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/facebookresearch/detectron2/blob/a2f4a8771ab77e8411c26b27f24f9489a28a2453/detectron2/solver/lr_scheduler.py#L138-L174","documentation":"WarmupMultiStepLR (deprecated) requires milestones to be a strictly increasing list of ints; an unsorted or duplicated list fails the sorted() equality check in __init__.","triggerScenarios":"Passing milestones=[30000, 10000] or [1000, 1000, 20000] to WarmupMultiStepLR, typically via cfg.SOLVER.STEPS in wrong order.","commonSituations":"Hand-edited YAML configs where steps were appended out of order; merging config files that reorder SOLVER.STEPS.","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"],"exampleFix":"# before\ncfg.SOLVER.STEPS = (30000, 10000)\n# after\ncfg.SOLVER.STEPS = (10000, 30000)","handlingStrategy":"validation","validationCode":"steps = list(cfg.SOLVER.STEPS)\nassert steps == sorted(steps) and len(set(steps)) == len(steps), 'SOLVER.STEPS must be increasing, unique'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep SOLVER.STEPS sorted in YAML","Validate milestones before constructing schedulers"],"tags":["detectron2","lr-scheduler","milestones","config"],"backgroundTag":"invalid-config-value","analyzedSha":"a2f4a8771ab77e8411c26b27f24f9489a28a2453","analyzedAt":"2026-08-27T12:08:21.260Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}