code: def get_warmup_steps(
      num_training_steps: int, warmup_steps: int, warmup_ratio: float
  ) -> int:
      """
      Get number of steps used for a linear warmup.
  
      Args:
          num_training_steps (`int`):
              All training steps when training.
          warmup_steps (`int`):
              Warmup steps. If > 0, `warmup_ratio` will not work.
          warmup_ratio (`float`):
              Ratio of num training steps to warmup.
      Returns:
          Warmup steps.
      """
      warmup_steps = (
          warmup_steps
          if warmup_steps > 0
          else math.ceil(num_training_steps * warmup_ratio)
      )
      return warmup_steps
  
file_path: towhee/towhee/trainer/optimization/optimization.py
imports: import math
  from typing import Optional, Union
  from torch.optim import Optimizer
  from torch.optim.lr_scheduler import LambdaLR
  from towhee.trainer.utils.trainer_utils import SchedulerType
label_desc: Use image node_id 8 for calling a global function with example usage: get_warmup_steps(num_training_steps, warmup_steps, warmup_ratio) and returns: warmup_steps