Skip to content

Commit c7c478b

Browse files
000Justin000Junteng Jia
andauthored
fix iterator when loading from checkpoint (#5344)
Co-authored-by: Junteng Jia <[email protected]>
1 parent 7409af7 commit c7c478b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fairseq/data/iterators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ def _get_iterator_for_epoch(
524524
# TODO: Below is a lazy implementation which discard the final batch regardless
525525
# of whether it is a full batch or not.
526526

527-
total_num_itrs = len(self.epoch_batch_sampler) - 1
527+
total_num_itrs = len(itr) - 1
528528
itr.take(total_num_itrs)
529529
logger.info(f"skip final residual batch, total_num_itrs = {total_num_itrs}")
530530

0 commit comments

Comments
 (0)