facebookresearch/detectron2 · error · ValueError

Unknown warmup method: {}

Error message

Unknown warmup method: {}

What it means

WarmupParamScheduler only supports warmup_method of 'constant' or 'linear'. Any other string (e.g. 'exp' or a typo) raises ValueError when the composite scheduler is constructed.

Source

Thrown at detectron2/solver/lr_scheduler.py:53

        """
        Args:
            scheduler: warmup will be added at the beginning of this scheduler
            warmup_factor: the factor w.r.t the initial value of ``scheduler``, e.g. 0.001
            warmup_length: the relative length (in [0, 1]) of warmup steps w.r.t the entire
                training, e.g. 0.01
            warmup_method: one of "linear" or "constant"
            rescale_interval: whether we will rescale the interval of the scheduler after
                warmup
        """
        # the value to reach when warmup ends
        end_value = scheduler(0.0) if rescale_interval else scheduler(warmup_length)
        start_value = warmup_factor * scheduler(0.0)
        if warmup_method == "constant":
            warmup = ConstantParamScheduler(start_value)
        elif warmup_method == "linear":
            warmup = LinearParamScheduler(start_value, end_value)
        else:
            raise ValueError("Unknown warmup method: {}".format(warmup_method))
        super().__init__(
            [warmup, scheduler],
            interval_scaling=["rescaled", "rescaled" if rescale_interval else "fixed"],
            lengths=[warmup_length, 1 - warmup_length],
        )


class LRMultiplier(LRScheduler):
    """
    A LRScheduler which uses fvcore :class:`ParamScheduler` to multiply the
    learning rate of each param in the optimizer.
    Every step, the learning rate of each parameter becomes its initial value
    multiplied by the output of the given :class:`ParamScheduler`.

    The absolute learning rate value of each parameter can be different.
    This scheduler can be used as long as the relative scale among them do
    not change during training.

View on GitHub (pinned to a2f4a8771a)

Solutions

  1. Set cfg.SOLVER.WARMUP_METHOD = 'linear' or 'constant'
  2. Verify exact spelling/case against build_lr_scheduler's construction of WarmupParamScheduler

Example fix

# before
cfg.SOLVER.WARMUP_METHOD = 'exp'
# after
cfg.SOLVER.WARMUP_METHOD = 'linear'
Defensive patterns

Strategy: validation

Validate before calling

assert cfg.SOLVER.WARMUP_METHOD in ('constant', 'linear'), cfg.SOLVER.WARMUP_METHOD

Prevention

When it happens

Trigger: Building a scheduler whose warmup method is not exactly 'constant' or 'linear', typically via cfg.SOLVER.WARMUP_METHOD.

Common situations: Configs migrated from other toolkits expecting exponential warmup; typos like 'Constant' (case-sensitive).

Related errors


AI-assisted analysis of facebookresearch/detectron2@a2f4a8771a (2026-08-27). Data as JSON: /api/errors/96982cc4bf3cab63. Report an issue: GitHub.