text: import torch
  OPTIMIZER = dict(sgd=torch.optim.SGD,
                   )
  
  def create_optimizer(model, cfg):
      return OPTIMIZER[cfg.optimizer](model.parameters(), **cfg.optimizer_kwargs)
  
  def create_fp16_scaler(cfg):
      fp16_scaler = None
      if cfg.use_fp16:
          fp16_scaler = torch.cuda.amp.GradScaler()
      return fp16_scaler