Skip to content

Commit fe1ffc4

Browse files
committed
fix resume from epoch >= 1
1 parent dd4e048 commit fe1ffc4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/transformers/trainer.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2410,6 +2410,9 @@ def _inner_training_loop(
24102410
if epoch == epochs_trained and resume_from_checkpoint is not None:
24112411
if steps_trained_in_current_epoch > 0 and not args.ignore_data_skip:
24122412
epoch_dataloader = skip_first_batches(epoch_dataloader, steps_trained_in_current_epoch)
2413+
if hasattr(epoch_dataloader, "set_epoch"):
2414+
epoch_dataloader.set_epoch(epoch)
2415+
24132416
step = steps_trained_in_current_epoch - 1
24142417
rng_to_sync = True
24152418
elif steps_trained_in_current_epoch == 0:

0 commit comments

Comments
 (0)