code: def get_scheduler(opt, cfg):
      if cfg.lr_func is not None:
          scheduler = torch.optim.lr_scheduler.LambdaLR(
              optimizer=opt, lr_lambda=cfg.lr_func
          )
      else:
          # total_batch_size = cfg.batch_size * cfg.world_size
          # warmup_steps = cfg.num_images // total_batch_size * cfg.warmup_epochs
          # total_steps = cfg.num_images // total_batch_size * cfg.num_epochs
  
          if cfg.lr_steps is None:
              scheduler = PolyScheduler(
                  optimizer=opt,
                  base_lr=cfg.lr,
                  max_steps=cfg.total_steps,
                  warmup_steps=cfg.warmup_steps,
              )
          else:
              scheduler = StepScheduler(
                  optimizer=opt,
                  base_lr=cfg.lr,
                  lr_steps=cfg.lr_steps,
                  warmup_steps=cfg.warmup_steps,
              )
  
      return scheduler
  
file_path: insightface/reconstruction/jmlr/lr_scheduler.py
imports: import torch
  from torch.optim.lr_scheduler import _LRScheduler
label_desc: Use image node_id 1 for calling a global function with example usage: get_scheduler(opt, cfg) and returns: scheduler