class_docstr: Experimental class that wraps keepsake.init() and
  experiment.checkpoint() in a Keras callback.
code: def _save_model(self, epoch, logs):
      logs = logs or {}
  
      filepath = None
      if self.filepath is not None:
          if not (
              isinstance(self.save_freq, int)
              or self.epochs_since_last_save >= self.period
          ):
              return
  
          self.epochs_since_last_save = 0
  
          filepath = self._get_file_path(epoch, logs)
  
          try:
              if self.save_weights_only:
                  self.model.save_weights(filepath, overwrite=True)
              else:
                  self.model.save(filepath, overwrite=True)
  
              self._maybe_remove_file()
          except IOError as e:
              # `e.errno` appears to be `None` so checking the content
              # of `e.args[0]`. This error check is from
              # keras.callbacks.ModelCheckpoint
              if "is a directory" in e.args[0]:
                  raise IOError(
                      "Please specify a non-directory filepath for "
                      "ModelCheckpoint. Filepath used is an existing "
                      "directory: {}".format(filepath)
                  )
  
      self.experiment.checkpoint(
          filepath,
          step=self.step,
          metrics=logs,
          primary_metric=self.primary_metric,
          # TODO(bfirsh): make this output information in a way that is compatible with keras's progress bar
          quiet=True,
      )
  
      # if save_freq is an integer, step = batch_number * save_freq
      # if save_freq is epoch, step = epoch_number
      self.step += 1
  
file_path: keepsake/python/keepsake/keras_callback.py
imports: from typing import Optional, Dict, Any, Tuple
  from .None import init
  from .experiment import Experiment
  from .project import Project
label_desc: Use image node_id 3 for calling the KeepsakeCallback obj's underlying member method code with example usage: obj._save_model(epoch, logs) without return types