From c72611ba480849efc8699768a78b1524fe6b0388 Mon Sep 17 00:00:00 2001 From: Mickus Timothee Date: Tue, 19 Sep 2023 21:55:42 +0300 Subject: [PATCH] plugging back early stopper --- onmt/trainer.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/onmt/trainer.py b/onmt/trainer.py index f0fa8efd..028753c0 100644 --- a/onmt/trainer.py +++ b/onmt/trainer.py @@ -380,12 +380,12 @@ def train( valid_stats=valid_stats, ) - # # Run patience mechanism - # if self.earlystopper is not None: - # self.earlystopper(valid_stats, step) - # # If the patience has reached the limit, stop training - # if self.earlystopper.has_stopped(): - # break + # Run patience mechanism + if self.earlystopper is not None: + self.earlystopper(valid_stats, step) + # If the patience has reached the limit, stop training + if self.earlystopper.has_stopped(): + break if self.model_saver is not None and (save_checkpoint_steps != 0 and step % save_checkpoint_steps == 0): self.model_saver.save(step, moving_average=self.moving_average)