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

Improve pytorch examples for fp16 #9796

Merged

Conversation

ak314
Copy link
Contributor

@ak314 ak314 commented Jan 25, 2021

What does this PR do?

When fp16 is True in pytorch training examples, use padding to multiple of 8, if the currently used data collator allows, to speed up training. If no collator was used, add one using the padding option.
Fixes #9752

Who can review?

Trainer: @sgugger

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR, that's great! One last thing is to adapt the template example here if you don't mind.

@sgugger sgugger requested a review from LysandreJik January 26, 2021 00:56
@sgugger
Copy link
Collaborator

sgugger commented Jan 26, 2021

Thanks for addressing the comments, this is good to go IMO.
Pro-tip, if you edit your description to replace Issue #9752 by Fixes #9752, the issue will be automatically closed when we merge this PR.

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool! LGTM!

@LysandreJik LysandreJik merged commit 10e5f28 into huggingface:master Jan 26, 2021
@ak314 ak314 deleted the improve-pytorch-examples-for-fp16 branch January 30, 2021 18:35
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.

Improve PyTorch examples for FP16
3 participants