code: def save_model(
      model, model_name_path=None, protocol=pickle.HIGHEST_PROTOCOL
  ):
      """Save a trained model to disk.
  
      Example
      -------
      >>> import numpy as np
      >>> from ampligraph.latent_features import ComplEx
      >>> from ampligraph.utils import save_model
      >>> model = ComplEx(batches_count=2, seed=555, epochs=20, k=10)
      >>> X = np.array([['a', 'y', 'b'],
      >>>               ['b', 'y', 'a'],
      >>>               ['a', 'y', 'c'],
      >>>               ['c', 'y', 'a'],
      >>>               ['a', 'y', 'd'],
      >>>               ['c', 'y', 'd'],
      >>>               ['b', 'y', 'c'],
      >>>               ['f', 'y', 'e']])
      >>> model.fit(X)
      >>> y_pred_before = model.predict(np.array([['f', 'y', 'e'], ['b', 'y', 'd']]))
      >>> example_name = 'helloworld.pkl'
      >>> save_model(model, model_name_path=example_name)
      >>> print(y_pred_before)
      [-0.29721245, 0.07865551]
  
      Parameters
      ----------
      model: EmbeddingModel
          A trained neural knowledge graph embedding model.
          The model must be an instance of TransE, DistMult, ComplEx, or HolE.
      model_name_path: str
          The name of the model to be saved.
          If not specified, a default name with current datetime is selected and the model is saved
          to the working directory.
  
      """
      if model_name_path is None:
          model_name_path = "{0}".format(
              strftime("%Y_%m_%d-%H_%M_%S", gmtime())
          )
      if os.path.exists(model_name_path):
          print(
              "The path {} already exists. This save operation will overwrite the model \
                  at the specified path.".format(
                  model_name_path
              )
          )
          shutil.rmtree(model_name_path)
      if model.is_backward:
          model = model.model
      tf.keras.models.save_model(model, model_name_path)
      model.save_metadata(filedir=model_name_path)
  
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 1 for calling a global function with example usage: save_model(model, model_name_path, protocol) without return types