-
Notifications
You must be signed in to change notification settings - Fork 24.8k
[BE][Ez]: Fully type nn.utils.clip_grad #154801
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
[BE][Ez]: Fully type nn.utils.clip_grad #154801
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/154801
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit f302434 with merge base f88d7a7 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
torch/nn/utils/clip_grad.py
Outdated
@@ -23,19 +21,22 @@ | |||
] | |||
|
|||
|
|||
_tensor_or_tensors = Union[ | |||
_TensorOrTensors: TypeAlias = Union[ |
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.
ruff complained about the name of this once I exposed it as a TypeAlias, and it's an internal only TypeAlias
@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 |
Full types clip_grad and exposed typing annotations that were hidden by a bad decorator Pull Request resolved: pytorch#154801 Approved by: https://github.com/jansel
@pytorchbot revert -m="Diff reverted internally" -c="ghfirst" This Pull Request has been reverted by a revert inside Meta. To re-land this change, please open another pull request, assign the same reviewers, fix the CI failures that caused the revert and make sure that the failing CI runs on the PR by applying the proper ciflow label (e.g., ciflow/trunk).) |
@pytorchbot successfully started a revert job. Check the current status here. |
This reverts commit 9ce2732. Reverted #154801 on behalf of https://github.com/facebook-github-bot due to Diff reverted internally ([comment](#154801 (comment)))
@Skylion007 your PR has been successfully reverted. |
Full types clip_grad and exposed typing annotations that were hidden by a bad decorator Pull Request resolved: pytorch#154801 Approved by: https://github.com/jansel
This reverts commit 9ce2732. Reverted pytorch#154801 on behalf of https://github.com/facebook-github-bot due to Diff reverted internally ([comment](pytorch#154801 (comment)))
@aorenste Looks like this uncovered more typing errors inside of Meta. Not sure if the input args need to be more flexible or if the private type alias was actually used somewhere else or what, but if you could help land, that would be super helpful. |
Looking at torch_tune, it looks like the alias is actually used... |
@nathan-az If the internal issue is just the internal typing, feel free to revert that change and keep the decorator typing. |
I can help - but I have to wait for our internal tooling to be fixed. Without that there's no way to run all the tests that could have fallout - so it lands and then tests start failing. |
This reverts commit 9ce2732. Reverted pytorch#154801 on behalf of https://github.com/facebook-github-bot due to Diff reverted internally ([comment](pytorch#154801 (comment)))
@pytorchbot rebase |
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
Rebase failed due to Command
Raised by https://github.com/pytorch/pytorch/actions/runs/15519092514 |
This reverts commit 9ce2732. Reverted pytorch#154801 on behalf of https://github.com/facebook-github-bot due to Diff reverted internally ([comment](pytorch#154801 (comment)))
@pytorchbot rebase |
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
Rebase failed due to Command
Raised by https://github.com/pytorch/pytorch/actions/runs/16126456689 |
e17cc87
to
77976cc
Compare
@aorenste Rebased |
42e535d
to
f302434
Compare
Imported internally and it passes all tests. |
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 |
This reverts commit 9ce2732. Reverted pytorch#154801 on behalf of https://github.com/facebook-github-bot due to Diff reverted internally ([comment](pytorch#154801 (comment)))
Full types clip_grad and exposed typing annotations that were hidden by a bad decorator
cc @ezyang @malfet @xuzhao9 @gramster @albanD