code: def load_checkpoint(model, checkpoint_path):
      checkpoint = pickle.load(open(checkpoint_path, "rb"))
      chkp_var_dict = {
          var.name: var.numpy() for var in checkpoint["model"]
      }
      tf_vars = model.weights
      for tf_var in tf_vars:
          layer_name = tf_var.name
          try:
              chkp_var_value = chkp_var_dict[layer_name]
          except KeyError:
              class_name = list(chkp_var_dict.keys())[0].split("/")[0]
              layer_name = f"{class_name}/{layer_name}"
              chkp_var_value = chkp_var_dict[layer_name]
  
          tf.keras.backend.set_value(tf_var, chkp_var_value)
      if "r" in checkpoint.keys():
          model.decoder.set_r(checkpoint["r"])
      return model
  
file_path: TTS/TTS/tts/tf/utils/generic_utils.py
imports: import datetime
  import importlib
  import pickle
  import numpy
  import tensorflow
label_desc: Use image node_id 2 for calling a global function with example usage: load_checkpoint(model, checkpoint_path) and returns: model