in src/helpers.py [0:0]
def step(self, score: float, model: nn.Module) -> bool:
if (self.best_score is None) or (score > self.best_score):
self.best_score = score
self.save_checkpoint(model)
self.counter = 0
else:
self.counter += 1
print(
"EarlyStopping counter: {:d} out of {:d}".format(
self.counter, self.patience
)
)
if self.counter >= self.patience:
self.early_stop = True
return self.early_stop