class_docstr: Multi-step learning rate scheduler with optional linear warm-up strategy
code: def __init__(self, opts, **kwargs) -> None:
      is_iter_based = getattr(
          opts, "scheduler.is_iteration_based", True
      )
      super().__init__(opts=opts)
  
      max_iterations = getattr(opts, "scheduler.max_iterations", 150000)
  
      self.lr = getattr(opts, "scheduler.multi_step.lr", None)
      assert self.lr is not None
  
      if self.warmup_iterations > 0:
          self.warmup_step = (
              self.lr - self.warmup_init_lr
          ) / self.warmup_iterations
  
      milestones = getattr(
          opts, "scheduler.multi_step.milestones", None
      )
      if milestones is None:
          milestones = [-1]
      elif isinstance(milestones, int):
          milestones = [milestones]
  
      self.milestones = sorted(
          list(set(milestones))
      )  # remove duplicates and sort them
      self.gamma = getattr(opts, "scheduler.multi_step.gamma", 1.0)
  
      self.period = (
          max_iterations - self.warmup_iterations + 1
          if is_iter_based
          else getattr(opts, "scheduler.max_epochs", 350)
      )
  
      self.is_iter_based = is_iter_based
  
file_path: ml-cvnets/optim/scheduler/multi_step.py
imports: import argparse
  from optim.scheduler import SCHEDULER_REGISTRY
  from optim.scheduler.base_scheduler import BaseLRScheduler
label_desc: Use image node_id 1 to create a new MultiStepLRScheduler object from inherited base classes: BaseLRScheduler with example: obj = MultiStepLRScheduler(opts)