Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dataloader prefetch batch #28484

Closed
wants to merge 8 commits into from
Closed

Dataloader prefetch batch #28484

wants to merge 8 commits into from

Conversation

qmeeus
Copy link
Contributor

@qmeeus qmeeus commented Jan 12, 2024

What does this PR do?

I added an option to the trainer to prefetch batches during data loading.

When training a model with heavy transformations and an iterable dataset, the dataloader might struggle to deliver fast enough for the GPU. I've found that prefetching batches helps to solve this issue.
The option is implemented in torch.utils.data.DataLoader but not in HF Trainer.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

LysandreJik and others added 8 commits December 11, 2023 12:52
…#27099)

* nits

* nits

* actual fix

* style

* ze fix

* fix fix fix style
* fix loss computation

* compute on GPU if possible
…7973)

* fix sdpa with non-contiguous inputs for gpt_bigcode

* fix other archs

* add currently comment

* format
* Fix bug

* Write test

* Keep back old modification for grad accum steps

* Whitespace...

* Whitespace again

* Race condition

* Wait for everyone
@amyeroberts
Copy link
Collaborator

Hi @qmeeus - thanks for opening a PR!

At the moment, there's a very large diff including unrelated changes to those in the PR description. Could you make sure to resolve all conflicts and include the latest updates in main using rebase or merge into this branch?

@qmeeus
Copy link
Contributor Author

qmeeus commented Jan 14, 2024

ed changes to those in the PR description. Could you make sure to resolve all conflicts and include the latest updates in m

Yes, this is a work in progress, I was not aware that this was available yet for reviewing. I will sort it out, thank you :)

@qmeeus qmeeus closed this Jan 14, 2024
@qmeeus qmeeus deleted the patch-4 branch January 14, 2024 10:15
@qmeeus
Copy link
Contributor Author

qmeeus commented Jan 14, 2024

@amyeroberts I closed this one and created a new one available here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants