Skip to content

Commit 0a06542

Browse files
Thai Chau TruongPC91
Thai Chau Truong
authored andcommitted
Fix error to load data at the correct position when resuming from a checkpoint
1 parent a987e7d commit 0a06542

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

onmt/trainer.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,11 @@ def train(
306306
torch.cuda.empty_cache()
307307

308308
for i, (batches, normalization) in enumerate(self._accum_batches(train_iter)):
309-
310309
step = self.optim.training_step
310+
# Check if the iterator is at the same step as the optimizer
311+
if i + 1 != step:
312+
continue
313+
311314
# UPDATE DROPOUT
312315
self._maybe_update_dropout(step)
313316

0 commit comments

Comments
 (0)