class_docstr: Class for LR Schedulers.
  
  Includes some basic functionality by default - setting up the warmup
  scheduler, passing the correct number of steps to train_step, loading and
  saving states.
  Subclasses must implement abstract methods train_step() and valid_step().
  Schedulers should be initialized with lr_scheduler_factory().
  __init__() should not be called directly.
docstr: :param optimizer optimizer:
      Optimizer being used for training. May be wrapped in
      fp16_optimizer_wrapper depending on whether fp16 is used.
  :param states:
      A dict containing loaded states
docstr_tok: [":","param","optimizer","optimizer",":","Optimizer","being","used","for","training",".","May","be","wrapped","in","fp16_optimizer_wrapper","depending","on","whether","fp16","is","used",".",":","param","states",":","A","dict","containing","loaded","states"]
code: def _init_warmup_scheduler(self, optimizer, states, hard_reset):
      """
      :param optimizer optimizer:
          Optimizer being used for training. May be wrapped in
          fp16_optimizer_wrapper depending on whether fp16 is used.
      :param states:
          A dict containing loaded states
      """
      updates_so_far = states.get("number_training_updates", 0)
      if self.warmup_updates > 0 and (
          updates_so_far < self.warmup_updates or hard_reset
      ):
          # initializing LambdaLR scheduler can mess up learning rates,
          # so try to avoid it, when warmup is already done
          last_epoch = (
              -1
              if updates_so_far == 0 or hard_reset
              else updates_so_far
          )
          self.warmup_scheduler = optim.lr_scheduler.LambdaLR(
              optimizer, self._warmup_lr, last_epoch=last_epoch
          )
  
imports: import math
  from typing import Optional
  from parlai.core.params import ParlaiParser
  from parlai.core.opt import Opt
  from abc import abstractmethod
  from torch import optim
  import numpy
  from parlai.core.exceptions import StopTrainException
  from parlai.utils.misc import warn_once
label_desc: Use image node_id 2 for calling the ParlAILRScheduler obj's underlying member method code with example usage: obj._init_warmup_scheduler(optimizer, states, hard_reset) without return types