class_docstr: Experimental class that wraps keepsake.init() and
  experiment.checkpoint() in a PyTorch Lightning callback.
  API is mostly consistent with keras_callback.KeepsakeCallback.
  
  This integration is subject to change, we'll probably
  try to get it into Pytorch Lightning itself as a logger.
  See https://github.com/replicate/keepsake/issues/432
  
  The KeepsakeCallback instantiates a new Keepsake experiment with
  keepsake.init on_pretrain_routine_start, using the parameters
  that are passed to the KeepsakeCallback constructor.
  
  Checkpoints are saved on_validation_end if validation is defined,
  otherwise on_epoch_end.
  
  For an example of how to use this callback, see the guide at
  https://keepsake.ai/docs/guides/pytorch-lightning-integration
docstr: Create a new Pytorch Lightning Keepsake callback.
  
  Parameters
  ----------
  filepath : str, default "model.pth"
      The name of the model artifact to save. To disable
      saving model artifacts, set filepath=None
  params : dict, default None
      Hyperparameters and other metadata to save in the
      experiment.
  primary_metric : tuple (name, goal), default None
      Name and optimization goal of the primary metric.
      Goal must be either "minimize" or "maximize".
      The metric must be logged some time during the
      training process.
  save_weights_only : bool, default False
      if True, then only the model’s weights will be saved,
      else the full model is saved.
docstr_tok: ["Create","a","new","Pytorch","Lightning","Keepsake","callback",".","Parameters","--","--","--","--","--","filepath",":","str",",","default","``","model.pth","''","The","name","of","the","model","artifact","to","save",".","To","disable","saving","model","artifacts",",","set","filepath=None","params",":","dict",",","default","None","Hyperparameters","and","other","metadata","to","save","in","the","experiment",".","primary_metric",":","tuple","(","name",",","goal",")",",","default","None","Name","and","optimization","goal","of","the","primary","metric",".","Goal","must","be","either","``","minimize","''","or","``","maximize","''",".","The","metric","must","be","logged","some","time","during","the","training","process",".","save_weights_only",":","bool",",","default","False","if","True",",","then","only","the","model","\u2019","s","weights","will","be","saved",",","else","the","full","model","is","saved","."]
code: def __init__(
      self,
      filepath="model.pth",
      params: Optional[Dict[str, Any]] = None,
      primary_metric: Optional[Tuple[str, str]] = None,
      period: Optional[int] = 1,
      save_weights_only: Optional[bool] = False,
  ):
      """
      Create a new Pytorch Lightning Keepsake callback.
  
      Parameters
      ----------
      filepath : str, default "model.pth"
          The name of the model artifact to save. To disable
          saving model artifacts, set filepath=None
      params : dict, default None
          Hyperparameters and other metadata to save in the
          experiment.
      primary_metric : tuple (name, goal), default None
          Name and optimization goal of the primary metric.
          Goal must be either "minimize" or "maximize".
          The metric must be logged some time during the
          training process.
      save_weights_only : bool, default False
          if True, then only the model’s weights will be saved,
          else the full model is saved.
      """
  
      super().__init__()
      self.filepath = filepath
      self.params = params
      self.primary_metric = primary_metric
      self.period = period
      self.save_weights_only = save_weights_only
      self.last_global_step_saved = -1
  
file_path: keepsake/python/keepsake/pl_callback.py
imports: from copy import deepcopy
  from typing import Optional, Dict, Tuple, Any
  import keepsake
  from pytorch_lightning.callbacks.base import Callback
label_desc: Use image node_id 1 to create a new KeepsakeCallback object from inherited base classes: Callback with example: obj = KeepsakeCallback(filepath, params, primary_metric, period, save_weights_only)