code: def save_model(model, optimizer, epoch, cfg):
      # pylint: disable=line-too-long
      """
      Save trained model weights.
      """
      model_save_dir = os.path.join(
          cfg.CONFIG.LOG.BASE_PATH,
          cfg.CONFIG.LOG.EXP_NAME,
          cfg.CONFIG.LOG.SAVE_DIR,
      )
      if not os.path.exists(model_save_dir):
          os.makedirs(model_save_dir, exist_ok=True)
      ckpt_name = "f{}_s{}_ckpt_epoch{}.pth".format(
          cfg.CONFIG.DATA.CLIP_LEN, cfg.CONFIG.DATA.FRAME_RATE, epoch
      )
      checkpoint = os.path.join(model_save_dir, ckpt_name)
      save_checkpoint(
          {
              "epoch": epoch + 1,
              "state_dict": model.state_dict(),
              "best_acc1": None,
              "optimizer": optimizer.state_dict(),
          },
          filename=checkpoint,
      )
  
file_path: gluon-cv/gluoncv/torch/utils/model_utils.py
imports: import os
  import hashlib
  import requests
  from tqdm import tqdm
  import torch
label_desc: Use image node_id 3 for calling a global function with example usage: save_model(model, optimizer, epoch, cfg) without return types