From cd4d637722b244e552acbfa3da42932ba795e495 Mon Sep 17 00:00:00 2001 From: Thai Chau Truong Date: Sun, 19 Nov 2023 14:27:15 -0500 Subject: [PATCH] Fix error to load data at the correct position when resuming from a checkpoint --- onmt/trainer.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/onmt/trainer.py b/onmt/trainer.py index a570039707..1f10a92533 100644 --- a/onmt/trainer.py +++ b/onmt/trainer.py @@ -308,6 +308,10 @@ def train( for i, (batches, normalization) in enumerate(self._accum_batches(train_iter)): step = self.optim.training_step + # Check if the iterator is at the same step as the optimizer + if (i + 1 != step): + continue + # UPDATE DROPOUT self._maybe_update_dropout(step)