code: def _create_scheduler_from_config(
      configs: TrainingConfig,
      num_training_steps: int,
      optimizer: torch.optim.Optimizer = None,
  ):
      assert isinstance(configs.lr_scheduler_type, (str, dict))
      lr_scheduler = None
      if isinstance(configs.lr_scheduler_type, str):
          lr_scheduler = get_scheduler(
              configs.lr_scheduler_type,
              optimizer=optimizer if optimizer is None else optimizer,
              num_warmup_steps=get_warmup_steps(
                  num_training_steps,
                  configs.warmup_steps,
                  configs.warmup_ratio,
              ),
              num_training_steps=num_training_steps,
          )
      elif isinstance(configs.lr_scheduler_type, dict):
          lr_scheduler = _construct_scheduler_from_config(
              optimizer,
              torch.optim.lr_scheduler,
              configs.lr_scheduler_type,
          )
      return lr_scheduler
  
imports: from typing import Optional, List, Any, Tuple
  from torchvision import transforms
  from torchvision.io import read_image
  from pathlib import Path
  from torch import nn
  from towhee.utils.pil_utils import PILImage
  from towhee.trainer.optimization.optimization import get_scheduler, get_warmup_steps
  from towhee.trainer.utils.trainer_utils import _construct_scheduler_from_config
  from towhee.trainer.training_config import TrainingConfig
  from towhee.trainer.utils.file_utils import is_captum_available, is_matplotlib_available
  from towhee.utils.log import trainer_log
  import torch
  import torch.nn.functional
  import numpy
  import random
  import os
  import copy
label_desc: Use image node_id 7 for calling a global function with example usage: _create_scheduler_from_config(configs, num_training_steps, optimizer) and returns: lr_scheduler