code: def restore_model(model_name_path=None):
      """Restore a trained model from disk.
  
      Parameters
      ----------
      model_name_path : str
          Name of the path to the model.
      """
      from ampligraph.compat.models import BACK_COMPAT_MODELS
      from ampligraph.latent_features import ScoringBasedEmbeddingModel
      from ampligraph.latent_features.layers.encoding import (
          EmbeddingLookupLayer,
      )
      from ampligraph.latent_features.loss_functions import (
          LOSS_REGISTRY,
      )
      from ampligraph.latent_features.optimizers import OptimizerWrapper
  
      if model_name_path is None:
          logger.warning(
              "There is no model name specified. \
                          We will try to lookup \
                          the latest default saved model..."
          )
          default_models = glob.glob("*.ampkl")
          if len(default_models) == 0:
              raise Exception(
                  "No default model found. Please specify \
                               model_name_path..."
              )
  
      try:
          custom_objects = {
              "ScoringBasedEmbeddingModel": ScoringBasedEmbeddingModel,
              "OptimizerWrapper": OptimizerWrapper,
              "embedding_lookup_layer": EmbeddingLookupLayer,
          }
          custom_objects.update(LOSS_REGISTRY)
  
          model = tf.keras.models.load_model(
              model_name_path, custom_objects=custom_objects
          )
          model.load_metadata(filedir=model_name_path)
          if model.is_backward:
              model = BACK_COMPAT_MODELS.get(model.scoring_type)(model)
      except pickle.UnpicklingError as e:
          msg = "Error loading model {} : {}.".format(
              model_name_path, e
          )
          logger.debug(msg)
          raise Exception(msg)
      except (IOError, FileNotFoundError):
          msg = "No model found: {}.".format(model_name_path)
          logger.debug(msg)
          raise FileNotFoundError(msg)
      return model
  
file_path: AmpliGraph/ampligraph/utils/model_utils.py
imports: import glob
  import logging
  import os
  import pickle
  import shutil
  from time import gmtime, strftime
  import numpy
  import pandas
  import tensorflow
  from tensorboard.plugins import projector
label_desc: Use image node_id 2 for calling a global function with example usage: restore_model(model_name_path) and returns: model