code: def get_polynomial_decay_schedule_with_warmup(
      optimizer,
      num_warmup_steps,
      num_training_steps,
      lr_end=1e-7,
      power=1.0,
      last_epoch=-1,
  ):
      """
      Create a schedule with a learning rate that decreases as a polynomial decay from the initial lr set in the
      optimizer to end lr defined by `lr_end`, after a warmup period during which it increases linearly from 0 to the
      initial lr set in the optimizer.
  
      Args:
          optimizer (:class:`~torch.optim.Optimizer`):
              The optimizer for which to schedule the learning rate.
          num_warmup_steps (:obj:`int`):
              The number of steps for the warmup phase.
          num_training_steps (:obj:`int`):
              The total number of training steps.
          lr_end (:obj:`float`, `optional`, defaults to 1e-7):
              The end LR.
          power (:obj:`float`, `optional`, defaults to 1.0):
              Power factor.
          last_epoch (:obj:`int`, `optional`, defaults to -1):
              The index of the last epoch when resuming training.
  
      Note: `power` defaults to 1.0 as in the fairseq implementation, which in turn is based on the original BERT
      implementation at
      https://github.com/google-research/bert/blob/f39e881b169b9d53bea03d2d341b31707a6c052b/optimization.py#L37
  
      Return:
          :obj:`torch.optim.lr_scheduler.LambdaLR` with the appropriate schedule.
  
      """
  
      lr_init = optimizer.defaults["lr"]
      if lr_init <= lr_end:
          raise ValueError(
              f"lr_end ({lr_end}) must be be smaller than initial lr ({lr_init})"
          )
  
      def lr_lambda(current_step: int):
          if current_step < num_warmup_steps:
              return float(current_step) / float(
                  max(1, num_warmup_steps)
              )
          elif current_step > num_training_steps:
              return (
                  lr_end / lr_init
              )  # as LambdaLR multiplies by lr_init
          else:
              lr_range = lr_init - lr_end
              decay_steps = num_training_steps - num_warmup_steps
              pct_remaining = (
                  1 - (current_step - num_warmup_steps) / decay_steps
              )
              decay = lr_range * pct_remaining**power + lr_end
              return (
                  decay / lr_init
              )  # as LambdaLR multiplies by lr_init
  
      return LambdaLR(optimizer, lr_lambda, last_epoch)
  
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 6 for calling a global function with example usage: get_polynomial_decay_schedule_with_warmup(optimizer, num_warmup_steps, num_training_steps, lr_end, power, last_epoch) and returns: LambdaLR, unknown, unknown, unknown