code: def load_checkpoint(
      model, checkpoint_path, amp=None, use_cuda=False, eval=False
  ):
      """Load ```TTS.tts.models``` checkpoints.
  
      Args:
          model (TTS.tts.models): model object to load the weights for.
          checkpoint_path (string): checkpoint file path.
          amp (apex.amp, optional): Apex amp abject to load apex related state vars. Defaults to None.
          use_cuda (bool, optional): load model to GPU if True. Defaults to False.
  
      Returns:
          [type]: [description]
      """
      try:
          state = torch.load(
              checkpoint_path, map_location=torch.device("cpu")
          )
      except ModuleNotFoundError:
          pickle_tts.Unpickler = RenamingUnpickler
          state = torch.load(
              checkpoint_path,
              map_location=torch.device("cpu"),
              pickle_module=pickle_tts,
          )
      model.load_state_dict(state["model"])
      if amp and "amp" in state:
          amp.load_state_dict(state["amp"])
      if use_cuda:
          model.cuda()
      # set model stepsize
      if hasattr(model.decoder, "r"):
          model.decoder.set_r(state["r"])
          print(" > Model r: ", state["r"])
      if eval:
          model.eval()
      return model, state
  
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 1 for calling a global function with example usage: load_checkpoint(model, checkpoint_path, amp, use_cuda, eval) and returns: model,  state