add support for custom function for reducing the batch size - #3071
Conversation
|
blah, not quite correct, let me fix and get back to you |
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
| def find_executable_batch_size(function: callable = None, starting_batch_size: int = 128, reduce_batch_size_fn: callable = None): | ||
| """ | ||
| A basic decorator that will try to execute `function`. If it fails from exceptions related to out-of-memory or | ||
| CUDNN, the batch size is cut in half and passed to `function` |
There was a problem hiding this comment.
Let's make sure to add reduce_batch_size_fn to the docstring, describing what it should take in and return (a batch size and return a modified batch size?)
|
@winglian can you do a |
|
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
|
gentle ping @winglian |
|
@bot /style |
|
Style fixes have been applied. View the workflow run here. |
What does this PR do?
when using auto_find_batch_size in transformers, there is no way to compensate with gradient_accumulation_steps or learning rate when a new batch size is tried. This adds the ability to use a callable function that transformers can set to manage updating the TrainingArgs.
Fixes # (issue)
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@muellerzr
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.