docstr: ModelCheckpoint callback is used in conjunction with training using estimator.fit() to save
  a model or weights (in a checkpoint file) at some interval, so the model or weights can be
  loaded later to continue the training from the state saved.
  Example:
      >>> checkpoint_callback = ModelCheckpoint(
      ...     filepath='my/path/sample-mnist-{epoch:02d}',
      ... )
  And checkpoints will be saved as file with path like 'my/path/sample-mnist-epoch=1.ckpt'
  with different epoch values.
  :param filepath: path to save the model file.
  :param by_epoch: save chekpoint by epoch or by iteration
  :param interval: The saving period. If ``by_epoch=True``, interval
      indicates epochs, otherwise it indicates iterations. Default: -1, which means "never".
docstr_tok: ["ModelCheckpoint","callback","is","used","in","conjunction","with","training","using","estimator.fit","(",")","to","save","a","model","or","weights","(","in","a","checkpoint","file",")","at","some","interval",",","so","the","model","or","weights","can","be","loaded","later","to","continue","the","training","from","the","state","saved",".","Example",":",">",">",">","checkpoint_callback","=","ModelCheckpoint","(","...","filepath='my\/path\/sample-mnist-","{","epoch:02d","}","'",",","...",")","And","checkpoints","will","be","saved","as","file","with","path","like","'my\/path\/sample-mnist-epoch=1.ckpt'","with","different","epoch","values",".",":","param","filepath",":","path","to","save","the","model","file",".",":","param","by_epoch",":","save","chekpoint","by","epoch","or","by","iteration",":","param","interval",":","The","saving","period",".","If","``","by_epoch=True","``",",","interval","indicates","epochs",",","otherwise","it","indicates","iterations",".","Default",":","-1",",","which","means","``","never","''","."]
code: def __init__(
      self,
      filepath: str = "",
      save_weights_only: bool = False,
      by_epoch: bool = True,
      interval: int = -1,
  ):
      """
      ModelCheckpoint callback is used in conjunction with training using estimator.fit() to save
      a model or weights (in a checkpoint file) at some interval, so the model or weights can be
      loaded later to continue the training from the state saved.
      Example:
          >>> checkpoint_callback = ModelCheckpoint(
          ...     filepath='my/path/sample-mnist-{epoch:02d}',
          ... )
      And checkpoints will be saved as file with path like 'my/path/sample-mnist-epoch=1.ckpt'
      with different epoch values.
      :param filepath: path to save the model file.
      :param by_epoch: save chekpoint by epoch or by iteration
      :param interval: The saving period. If ``by_epoch=True``, interval
          indicates epochs, otherwise it indicates iterations. Default: -1, which means "never".
      """
      super().__init__()
      self.filepath = filepath
      self.save_weights_only = save_weights_only
      self.by_epoch = by_epoch
      self.interval = interval
      self.last_ckpt_path = ""
      self.filename = os.path.basename(self.filepath)
      self.dirname = os.path.dirname(self.filepath)
  
file_path: BigDL/python/orca/src/bigdl/orca/learn/pytorch/callbacks/model_checkpoint.py
imports: from bigdl.orca.learn.pytorch.callbacks import Callback
  import os
  import re
  import warnings
  from bigdl.dllib.utils.log4Error import invalidInputError
label_desc: Use image node_id 1 to create a new ModelCheckpoint object from inherited base classes: Callback with example: obj = ModelCheckpoint(filepath, save_weights_only, by_epoch, interval)