code: def test_linear_with_warmup_works_properly(self):
      scheduler = LearningRateScheduler.from_params(
          optimizer=Optimizer.from_params(
              model_parameters=self.model.named_parameters(),
              params=Params({"type": "sgd", "lr": 1.0}),
          ),
          params=Params(
              {
                  "type": "linear_with_warmup",
                  "warmup_steps": 2,
                  "num_epochs": 2,
                  "num_steps_per_epoch": 3,
              }
          ),
      )
      optimizer = scheduler.optimizer
  
      # Linear warmup for 2 steps.
      scheduler.step_batch()
      assert optimizer.param_groups[0]["lr"] == 0.5  # 1.0 * 1/2
      scheduler.step_batch()
      assert optimizer.param_groups[0]["lr"] == 1.0  # 1.0 * 2/2
  
      # Linear decay for 4 steps.
      scheduler.step_batch()
      assert optimizer.param_groups[0]["lr"] == 0.75
      scheduler.step_batch()
      assert optimizer.param_groups[0]["lr"] == 0.5
      scheduler.step_batch()
      assert optimizer.param_groups[0]["lr"] == 0.25
      scheduler.step_batch()
      assert optimizer.param_groups[0]["lr"] == 0.0
  
file_path: allennlp/tests/training/learning_rate_schedulers/learning_rate_scheduler_test.py
imports: import torch
  import pytest
  from allennlp.common.checks import ConfigurationError
  from allennlp.training.optimizers import Optimizer
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.training.learning_rate_schedulers import LearningRateScheduler
  from allennlp.common.params import Params
label_desc: Use image node_id 7 for calling the LearningRateSchedulersTest obj's underlying member method code with example usage: obj.test_linear_with_warmup_works_properly() without return types