rent_val_loss is not None and current_val_loss &lt;= 0.0
        ):
            self.model.stop_training = True
            if crf and self.best_weights is not None:
                if self.verbose &gt; 0:
                    print(
                        &#34;Restoring model weights from the end of &#34; &#34;the best epoch&#34;
                    )
                self.model.set_weights(self.best_weights)
            return

    if self.patience:
        current = logs.get(self.monitor)
        if curre