Skip to content

Commit 7f1a6da

Browse files
committed
fix resume from epoch >= 1
1 parent afdc40d commit 7f1a6da

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
@@ -2414,6 +2414,9 @@ def _inner_training_loop(
24142414
if epoch == epochs_trained and resume_from_checkpoint is not None:
24152415
if steps_trained_in_current_epoch > 0 and not args.ignore_data_skip:
24162416
epoch_dataloader = skip_first_batches(epoch_dataloader, steps_trained_in_current_epoch)
2417+
if hasattr(epoch_dataloader, "set_epoch"):
2418+
epoch_dataloader.set_epoch(epoch)
2419+
24172420
step = steps_trained_in_current_epoch - 1
24182421
rng_to_sync = True
24192422
elif steps_trained_in_current_epoch == 0:

0 commit comments

Comments
 (0)