class_docstr: Callback that save the model at the end of every epoch.
  
  Args:
      filepath: the where to save the mode.
      monitor: the name of the value to track.
  
  **Usage example:**
  
  .. code:: python
  
      model_checkpoint = ModelCheckpoint(
          filepath="./outputs", monitor="top5",
      )
  
      trainer = ImageClassifierTrainer(...,
          callbacks={"on_checkpoint", model_checkpoint}
      )
class_docstr_tok: ["Callback","that","save","the","model","at","the","end","of","every","epoch",".","Args",":","filepath",":","the","where","to","save","the","mode",".","monitor",":","the","name","of","the","value","to","track",".","*","*","Usage","example",":","*","*","..","code",":",":","python","model_checkpoint","=","ModelCheckpoint","(","filepath=","''",".\/outputs","''",",","monitor=","''","top5","''",",",")","trainer","=","ImageClassifierTrainer","(","...",",","callbacks=","{","``","on_checkpoint","''",",","model_checkpoint","}",")"]
code: def __call__(
      self,
      model: Module,
      epoch: int,
      valid_metric: Dict[str, AverageMeter],
  ) -> None:
      valid_metric_value: float = valid_metric[self.monitor].avg
      if valid_metric_value > self.best_metric:
          self.best_metric = valid_metric_value
          # store old metric and save new model
          filename = Path(self.filepath) / self._filename_fcn(epoch)
          torch.save(model, filename)
  
file_path: kornia/kornia/x/callbacks.py
imports: from pathlib import Path
  from typing import Callable, Dict, Optional, Union
  import torch
  from kornia.core import Module
  from kornia.metrics import AverageMeter
  from .utils import TrainerState
label_desc: Use image node_id 2 for calling the ModelCheckpoint obj's underlying member method code with example usage: obj.__call__(model, epoch, valid_metric) without return types