-
Notifications
You must be signed in to change notification settings - Fork 26.3k
add typing in torch.optim.lr_scheduler #125556
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
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/125556
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit b4780da with merge base 23e71ff ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
| ) | ||
| self.total_steps = total_steps | ||
| else: | ||
| elif epochs is not None and steps_per_epoch is not None: |
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.
| elif epochs is not None and steps_per_epoch is not None: | |
| elif epochs is not None or steps_per_epoch is not None: |
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.
I think this condition should be and because both epochs and steps_per_epoch must have available value (also, the lint failed here), otherwise it will fallback to the warning at line 1986. And maybe we should check epochos is an int before positive because it will raise an exception if epochos is not comparable?
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.
@janeyx99, could you please review this again? I believe there may be some errors (as described above) in your suggested change.
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.
Ah yes, I was going off the DeMorgan law of not epochs is None and steps_per_epoch is None but you're right the code actually intends for both of these to be defined together.
Co-authored-by: Jane (Yuan) Xu <[email protected]>
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: 3 mandatory check(s) failed. The first few are: Dig deeper by viewing the failures on hud |
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge torch/optim/lr_scheduler.pyi into torch/optim/lr_scheduler.py Co-authored-by: Jane (Yuan) Xu <[email protected]> Pull Request resolved: pytorch#125556 Approved by: https://github.com/janeyx99
#136185) When stub files (`*.pyi`) were removed from `optim` (#125556, #125452), some types that existed are no longer available. This pull request adds them back. Just for reference, these types are used in `pytorch-lightning`'s `LightningCLI`. Command line interfaces are created automatically, and having type hints make them nicer. Pull Request resolved: #136185 Approved by: https://github.com/janeyx99
pytorch#136185) When stub files (`*.pyi`) were removed from `optim` (pytorch#125556, pytorch#125452), some types that existed are no longer available. This pull request adds them back. Just for reference, these types are used in `pytorch-lightning`'s `LightningCLI`. Command line interfaces are created automatically, and having type hints make them nicer. Pull Request resolved: pytorch#136185 Approved by: https://github.com/janeyx99
Merge torch/optim/lr_scheduler.pyi into torch/optim/lr_scheduler.py