class_docstr: Registered as a `LearningRateScheduler` with name "cosine_with_warmup".  The "optimizer" argument does
  not get an entry in a configuration file for the object.
  
  # Parameters
  
  optimizer : `torch.optim.Optimizer`
      This argument does not get an entry in a configuration file for the
      object.
  num_warmup_steps : `int`, required
      The number of steps to linearly increase the learning rate.
  
  # Example
  
  Config for using the `CosineWithWarmupLearningRateScheduler` Learning Rate
   Scheduler with `num_warmup_steps` set `100`.
  
  ```json
  {
      ...
     "trainer":{
          ...
          "learning_rate_scheduler": {
              "type": "cosine_with_warmup",
              "num_warmup_steps": 100
          },
          ...
     }
  }
class_docstr_tok: ["Registered","as","a","`","LearningRateScheduler","`","with","name","``","cosine_with_warmup","''",".","The","``","optimizer","''","argument","does","not","get","an","entry","in","a","configuration","file","for","the","object",".","#","Parameters","optimizer",":","`","torch.optim.Optimizer","`","This","argument","does","not","get","an","entry","in","a","configuration","file","for","the","object",".","num_warmup_steps",":","`","int","`",",","required","The","number","of","steps","to","linearly","increase","the","learning","rate",".","#","Example","Config","for","using","the","`","CosineWithWarmupLearningRateScheduler","`","Learning","Rate","Scheduler","with","`","num_warmup_steps","`","set","`","100","`",".","``","`","json","{","...","``","trainer","''",":","{","...","``","learning_rate_scheduler","''",":","{","``","type","''",":","``","cosine_with_warmup","''",",","``","num_warmup_steps","''",":","100","}",",","...","}","}"]
code: def __init__(
      self,
      optimizer: Optimizer,
      num_warmup_steps: int,
      num_training_steps: int,
      num_cycles: float = 0.5,
      last_epoch: int = -1,
  ) -> None:
      lr_scheduler = get_cosine_schedule_with_warmup(
          optimizer=optimizer,
          num_warmup_steps=num_warmup_steps,
          num_training_steps=num_training_steps,
          num_cycles=num_cycles,
          last_epoch=last_epoch,
      )
      super().__init__(lr_scheduler)
  
imports: from typing import Any, Dict
  import torch
  from allennlp.common.checks import ConfigurationError
  from allennlp.common.registrable import Registrable
  from allennlp.training.optimizers import Optimizer
  from allennlp.training.scheduler import Scheduler
  from transformers.optimization import get_constant_schedule, get_constant_schedule_with_warmup, get_cosine_schedule_with_warmup, get_cosine_with_hard_restarts_schedule_with_warmup
label_desc: Use image node_id 1 to create a new CosineWithWarmupLearningRateScheduler object from inherited base classes: _PyTorchLearningRateSchedulerWrapper with example: obj = CosineWithWarmupLearningRateScheduler(optimizer, num_warmup_steps, num_training_steps, num_cycles, last_epoch)