class_docstr: A `TrackerCallback` that saves the model's best during training and loads it at the end.
class_docstr_tok: ["A","`","TrackerCallback","`","that","saves","the","model","'s","best","during","training","and","loads","it","at","the","end","."]
code: def __init__(
      self,
      monitor="valid_loss",  # value (usually loss or metric) being monitored.
      comp=None,  # numpy comparison operator; np.less if monitor is loss, np.greater if monitor is metric.
      min_delta=0.0,  # minimum delta between the last monitor value and the best monitor value.
      fname="model",  # model name to be used when saving model.
      every_epoch=False,  # if true, save model after every epoch; else save only when model is better than existing best.
      at_end=False,  # if true, save model when training ends; else load best model if there is only one saved model.
      with_opt=False,  # if true, save optimizer state (if any available) when saving model.
      reset_on_fit=True,  # before model fitting, reset value being monitored to -infinity (if monitor is metric) or +infinity (if monitor is loss).
  ):
      super().__init__(
          monitor=monitor,
          comp=comp,
          min_delta=min_delta,
          reset_on_fit=reset_on_fit,
      )
      assert not (
          every_epoch and at_end
      ), "every_epoch and at_end cannot both be set to True"
      # keep track of file path for loggers
      self.last_saved_path = None
      store_attr("fname,every_epoch,at_end,with_opt")
  
imports: from __future__ import annotations
  from ..basics import *
  from .progress import *
  from .fp16 import MixedPrecision
label_desc: Use image node_id 1 to create a new SaveModelCallback object from inherited base classes: TrackerCallback with example: obj = SaveModelCallback(monitor, comp, min_delta, fname, every_epoch, at_end, with_opt, reset_on_fit)