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.
code: def add_cmdline_args(
      cls, parser: ParlaiParser, partial_opt: Optional[Opt] = None
  ) -> ParlaiParser:
      lr_group = parser.add_argument_group("Learning Rate Scheduler")
      lr_group.add_argument(
          "--lr-scheduler",
          type=str,
          default="reduceonplateau",
          choices=[
              "reduceonplateau",
              "none",
              "fixed",
              "invsqrt",
              "cosine",
              "linear",
          ],
          help="Learning rate scheduler.",
      )
      lr_group.add_argument(
          "--lr-scheduler-patience",
          type=int,
          default=3,
          help="LR scheduler patience. In number of validation runs. If using "
          "fixed scheduler, LR is decayed every <patience> validations.",
      )
      lr_group.add_argument(
          "--lr-scheduler-decay",
          type=float,
          default=0.5,
          help="Decay factor for LR scheduler, or how much LR is multiplied by "
          "when it is lowered.",
      )
      lr_group.add_argument(
          "--invsqrt-lr-decay-gamma",
          type=int,
          default=-1,
          help="Constant used only to find the lr multiplier for the invsqrt "
          "scheduler. Must be set for --lr-scheduler invsqrt",
      )
      lr_group.add_argument(
          "--warmup-updates",
          type=int,
          default=-1,
          hidden=True,
          help="Learning rate warmup period, in number of SGD updates. "
          "Linearly scales up LR over period. Only enabled if > 0.",
      )
      lr_group.add_argument(
          "--warmup-rate",
          type=float,
          default=1e-4,
          hidden=True,
          help="Warmup learning rate *multiplier*. Initial LR is multiplied by "
          "this value. Linearly adjusted up to 1.0 across --warmup-updates "
          "steps.",
      )
      lr_group.add_argument(
          "--update-freq",
          type=int,
          default=1,
          hidden=True,
          help="Accumulate gradients N times before performing an optimizer.step().",
      )
      return parser
  
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 10 for calling the ParlAILRScheduler obj's underlying member method code with example usage: obj.add_cmdline_args(cls, parser, partial_opt) and returns: parser