-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Fix type hints of tuner/batch_size_scaling.py #13518
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
Fix type hints of tuner/batch_size_scaling.py #13518
Conversation
aac9127
to
3f1d70c
Compare
ec01aea
to
ab9bcba
Compare
Co-authored-by: Adrian Wälchli <[email protected]>
for more information, see https://pre-commit.ci
To fix type check issue, add None check explicitly. This early return dons't change the behabior of _is_valid_batch_size. Because has_len_all_ranks always return True if dataloader is None.
…r-batch_size_scaling.py
Head branch was pushed to by a user without write access
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
@@ -31,6 +31,8 @@ | |||
class BatchSizeFinder(Callback): | |||
SUPPORTED_MODES = ("power", "binsearch") | |||
|
|||
optimal_batch_size: Optional[int] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this annotated in the class definition instead of in the __init__
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@carmocca
This is my mistake. And my modification wasn't in time.
In the head of my fork branch, this annotation is moved into init.
May I create a new PR to move this annotation into init ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please. Thank you 💜
What does this PR do?
If wrong parameters are given as arguments,
_adjust_batch_size
cannot adjust batch size correctly. So this PR add some codes to raise ValueErrors in that cases.Fixes part of #13445
Does your PR introduce any breaking changes? If yes, please list them.
Before submitting
PR review
Anyone in the community is welcome to review the PR.
Before you start reviewing, make sure you have read the review guidelines. In short, see the following bullet-list:
Did you have fun?
Make sure you had fun coding 🙃