code: def on_epoch_end(self, epoch:int, **kwargs:Any)->None:
          "Compare the value monitored to its best score and maybe save the model."
          if self.every=="epoch": self.learn.save(f'{self.name}_{epoch}')
          else: #every="improvement"
              current = self.get_monitor_value()
              if current is not None and self.operator(current, self.best):
                  print(f'Better model found at epoch {epoch} with {self.monitor} value: {current}.')
                  self.best = current
                  self.learn.save(f'{self.name}'f on_epoch_end(self, epoch:int, **kwargs:Any)->None:
          "Compare the value monitored to its best score and maybe save the model."
          if self.every=="epoch": self.learn.save(f'{self.name}_{epoch}')
          else: #every="improvement"
              current = self.get_monitor_value()
              if current is not None and self.operator(current, self.best):
                  print(f'Better model found at epoch {epoch} with {self.monitor} value: {current}.')
                  self.best = current
                  self.learn.save(f'{self.name}')
docs: Compare the value monitored to its best score and maybe save the model.