code: def ModelCheckpoint(
      filepath="model.{epoch:02d}-{val_loss:.2f}.pt",
      save_model_params_only=False,
      monitor="val_loss",
      save_best_only=False,
      mode="auto",
      period=1,
      min_delta=0,
  ):
      """Save the model after every epoch. `filepath` can contain named formatting options, which will be filled any
      values from state. For example: if `filepath` is `weights.{epoch:02d}-{val_loss:.2f}`, then the model checkpoints
      will be saved with the epoch number and the validation loss in the filename. The torch :class:`.Trial` will be
      saved to filename.
  
  
      Example: ::
  
          >>> from torchbearer.callbacks import ModelCheckpoint
          >>> from torchbearer import Trial
          >>> import torch
  
          # Example Trial (without optimiser or loss criterion) which uses this checkpointer
          >>> model = torch.nn.Linear(1,1)
          >>> checkpoint = ModelCheckpoint('my_path.pt', monitor='val_acc', mode='max')
          >>> trial = Trial(model, callbacks=[checkpoint], metrics=['acc'])
  
      Args:
          filepath (str): Path to save the model file
          save_model_params_only (bool): If `save_model_params_only=True`, only model parameters will be saved so that
              the results can be loaded into a PyTorch nn.Module. The other option, `save_model_params_only=False`,
              should be used only if the results will be loaded into a Torchbearer Trial object later.
          monitor (str): Quantity to monitor
          save_best_only (bool): If `save_best_only=True`, the latest best model according to the quantity
              monitored will not be overwritten
          mode (str): One of {auto, min, max}. If `save_best_only=True`, the decision to overwrite the current
              save file is made based on either the maximization or the minimization of the monitored quantity. For
              `val_acc`, this should be `max`, for `val_loss` this should be `min`, etc. In `auto` mode, the direction is
              automatically inferred from the name of the monitored quantity.
          period (int): Interval (number of epochs) between checkpoints
          min_delta (float): If `save_best_only=True`, this is the minimum improvement required to trigger a save
  
      State Requirements:
          - :attr:`torchbearer.state.MODEL`: Model should have the `state_dict` method
          - :attr:`torchbearer.state.METRICS`: Metrics dictionary should exist
          - :attr:`torchbearer.state.SELF`: Self should be the :attr:`torchbearer.Trial` which is running this callback
      """
      if save_best_only:
          check = Best(
              filepath,
              save_model_params_only,
              monitor,
              mode,
              period,
              min_delta,
          )
      else:
          check = Interval(filepath, save_model_params_only, period)
  
      return check
  
imports: import torchbearer
  import torch
  from torchbearer.callbacks.callbacks import Callback
  import os
  import warnings
  from torchbearer.bases import get_metric
label_desc: Use image node_id 1 for calling a global function with example usage: ModelCheckpoint(filepath, save_model_params_only, monitor, save_best_only, mode, period, min_delta) and returns: check