code: def save_model(
      model,
      optimizer,
      current_step,
      epoch,
      r,
      output_path,
      amp_state_dict=None,
      **kwargs,
  ):
      """Save ```TTS.tts.models``` states with extra fields.
  
      Args:
          model (TTS.tts.models.Model): models object to be saved.
          optimizer (torch.optim.optimizers.Optimizer): model optimizer used for training.
          current_step (int): current number of training steps.
          epoch (int): current number of training epochs.
          r (int): model reduction rate for Tacotron models.
          output_path (str): output path to save the model file.
          amp_state_dict (state_dict, optional): Apex.amp state dict if Apex is enabled. Defaults to None.
      """
      if hasattr(model, "module"):
          model_state = model.module.state_dict()
      else:
          model_state = model.state_dict()
      state = {
          "model": model_state,
          "optimizer": optimizer.state_dict()
          if optimizer is not None
          else None,
          "step": current_step,
          "epoch": epoch,
          "date": datetime.date.today().strftime("%B %d, %Y"),
          "r": r,
      }
      if amp_state_dict:
          state["amp"] = amp_state_dict
      state.update(kwargs)
      torch.save(state, output_path)
  
file_path: TTS/TTS/tts/utils/io.py
imports: import os
  import torch
  import datetime
  import pickle
  from TTS.utils.io import RenamingUnpickler
label_desc: Use image node_id 2 for calling a global function with example usage: save_model(model, optimizer, current_step, epoch, r, output_path, amp_state_dict) without return types