Skip to content

Commit cd4d637

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

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

onmt/trainer.py

+4
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,10 @@ def train(
308308
for i, (batches, normalization) in enumerate(self._accum_batches(train_iter)):
309309

310310
step = self.optim.training_step
311+
# Check if the iterator is at the same step as the optimizer
312+
if (i + 1 != step):
313+
continue
314+
311315
# UPDATE DROPOUT
312316
self._maybe_update_dropout(step)
313317

0 commit comments

Comments
 (0)