composer icon indicating copy to clipboard operation
composer copied to clipboard

Call `set_epoch` on `Dataloader.batch_sampler` if defined

Open Ghelfi opened this issue 11 months ago • 1 comments

What does this PR do?

Proposes a technical implementation to set_epoch on either DataLoader.sampler or DataLoader.batch_sampler if it is defined.

What issue(s) does this change relate to?

  • Related to #3123

Ghelfi avatar Mar 18 '24 13:03 Ghelfi

Thanks for the PR!

Would you mind adding a unit test too please? You can extend test_checkpoint.py with class TestCheckpointResumption:. I would add an arg to get_trainer to add a batch dist sampler and add a new fn that tests that path instead.

If you need help, I'm happy to provide assistance for this!

When you are ready, please request review from mvpatel2000!

mvpatel2000 avatar Mar 19 '24 18:03 mvpatel2000

@mvpatel2000 cannot add you as reviewer to ask for a review. I added a test and ready for a review. I put the test where you suggested. Will it be better to put it in test_trainer.py?

Ghelfi avatar Mar 26 '24 14:03 Ghelfi

@Ghelfi do you mind if I push directly to this branch? there's a few lint things and refactor in test I would prefer. I'm happy to leave as comments if you'd like, but I figure it's faster for me to directly apply. I don't want to delay you further :)

mvpatel2000 avatar Apr 01 '24 17:04 mvpatel2000

@mvpatel2000 fine by me. Thanks for handling it.

Ghelfi avatar Apr 01 '24 18:04 Ghelfi