class_docstr: Decay learning rate every k updates by a fixed factor
class_docstr_tok: ["Decay","learning","rate","every","k","updates","by","a","fixed","factor"]
code: def __init__(self, cfg: StepLRScheduleConfig, fairseq_optimizer):
      super().__init__(cfg, fairseq_optimizer)
      self.max_lr = (
          cfg.lr[0] if isinstance(cfg.lr, Collection) else cfg.lr
      )
      self.min_lr = cfg.min_lr
      self.lr_deacy_period = cfg.lr_deacy_period
      self.lr_decay = cfg.lr_decay
      self.warmup_updates = cfg.warmup_updates
      self.warmup_init_lr = (
          cfg.warmup_init_lr if cfg.warmup_init_lr >= 0 else self.min_lr
      )
  
      assert self.lr_deacy_period > 0
      assert self.lr_decay <= 1
      assert self.min_lr >= 0
      assert self.max_lr > self.min_lr
  
      if cfg.warmup_updates > 0:
          # linearly warmup for the first cfg.warmup_updates
          self.warmup_lr_step = (
              self.max_lr - self.warmup_init_lr
          ) / self.warmup_updates
      else:
          self.warmup_lr_step = 1
  
      # initial learning rate
      self.lr = self.warmup_init_lr
      self.optimizer.set_lr(self.lr)
  
file_path: fairseq/fairseq/optim/lr_scheduler/step_lr_scheduler.py
imports: from collections.abc import Collection
  from dataclasses import dataclass, field
  from typing import List
  from omegaconf import II
  from fairseq.dataclass import FairseqDataclass
  from fairseq.optim.lr_scheduler import FairseqLRScheduler, register_lr_scheduler
label_desc: Use image node_id 1 to create a new StepLRSchedule object from inherited base classes: FairseqLRScheduler with example: obj = StepLRSchedule(cfg, fairseq_optimizer)