code: def test_torch_warmup_callback(warmup, schedule, accumulation_steps):
      kwargs = get_trainer_args(lr=0.1, bsz=4)
      callback = TorchWarmupCallback(warmup, schedule)
      r_callback = RecordLrCallback()
      kwargs["callbacks"] = [callback, r_callback]
      trainer = Trainer(**kwargs, accumulation_steps=accumulation_steps)
      trainer.run()
  
      if schedule == "linear":
          assert kwargs["optimizers"].param_groups[0]["lr"] <= 0.01
      elif schedule == "constant":
          assert np.allclose(
              0.1, kwargs["optimizers"].param_groups[0]["lr"]
          )
  
      assert (
          len(r_callback.lrs)
          <= trainer.n_batches // accumulation_steps + 1
      )
  
file_path: fastNLP/tests/core/callbacks/torch_callbacks/test_torch_warmup_callback.py
imports: import pytest
  import numpy
  from fastNLP.core.callbacks import TorchWarmupCallback, Callback
  from fastNLP import Trainer
  from tests.helpers.callbacks.prepare_trainer_args_for_torch_test import get_trainer_args
label_desc: Use image node_id 1 for calling a global function with example usage: test_torch_warmup_callback(warmup, schedule, accumulation_steps) without return types