Skip to content

Commit 874efcc

Browse files
author
Thai Chau Truong
committed
Fix error to load data at the correct position when resuming from a checkpoint
1 parent 39c984f commit 874efcc

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)