-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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] wrap deprecated function/class with typing_extensions.deprecated
#126898
Conversation
0d8e8d4
to
447ffdc
Compare
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 don't think we should use DeprecationWarning in general.
These warnings types are hidden by default and we explicitly want users to see these warnings so they update their code.
So we would need to update the calls using deprecated() to use UserWarning and continue to use that for all other warnings.
27c7de3
to
8fab07a
Compare
After referring to the Python documentation, I noticed that
I update
Based on the documentation, I'd prefer
|
e88aa54
to
584cd49
Compare
…d` (pytorch#126898) Use `typing_extensions.deprecated` for deprecation annotation if possible. Otherwise, add `category=FutureWarning` to `warnings.warn("message")` if the category is missing. Note that only warnings that their messages contain `[Dd]eprecat(ed|ion)` are updated in this PR. UPDATE: Use `FutureWarning` instead of `DeprecationWarning`. Resolves pytorch#126888 - pytorch#126888 Pull Request resolved: pytorch#126898 Approved by: https://github.com/albanD
…127433)" This reverts commit 6e0eeec. Reverted #127433 on behalf of https://github.com/fbgheith due to depends on #126898 which is failing internally and needs to be reverted ([comment](#127433 (comment)))
This is unfortunately used in a few places in the wild: https://github.com/search?q=torch.cuda.amp.autocast_mode._cast&type=code Pull Request resolved: #127433 Approved by: https://github.com/zou3519, https://github.com/guangyey
@pytorchbot revert -m "switching typing-extensions=4.3.0 to 4.9.0 causes internal failure" -c ghfirst Here is the failures:
Will require some internal shepherding. |
@pytorchbot successfully started a revert job. Check the current status here. |
…eprecated` (#126898)" This reverts commit 749a132. Reverted #126898 on behalf of https://github.com/fbgheith due to switching typing-extensions=4.3.0 to 4.9.0 causes internal failure ([comment](#126898 (comment)))
@XuehaiPan your PR has been successfully reverted. |
…d` (#127689) Use `typing_extensions.deprecated` for deprecation annotation if possible. Otherwise, add `category=FutureWarning` to `warnings.warn("message")` if the category is missing. Note that only warnings that their messages contain `[Dd]eprecat(ed|ion)` are updated in this PR. Resolves #126888 - #126888 This PR is split from PR #126898. - #126898 ------ Pull Request resolved: #127689 Approved by: https://github.com/Skylion007
…d` (#126898) Use `typing_extensions.deprecated` for deprecation annotation if possible. Otherwise, add `category=FutureWarning` to `warnings.warn("message")` if the category is missing. Note that only warnings that their messages contain `[Dd]eprecat(ed|ion)` are updated in this PR. UPDATE: Use `FutureWarning` instead of `DeprecationWarning`. Resolves #126888 - #126888 Pull Request resolved: #126898 Approved by: https://github.com/albanD (cherry picked from commit 749a132)
…eprecated` (#126898)" This reverts commit 749a132. Reverted #126898 on behalf of https://github.com/fbgheith due to switching typing-extensions=4.3.0 to 4.9.0 causes internal failure ([comment](#126898 (comment))) (cherry picked from commit 033e733)
…d` (#127689) Use `typing_extensions.deprecated` for deprecation annotation if possible. Otherwise, add `category=FutureWarning` to `warnings.warn("message")` if the category is missing. Note that only warnings that their messages contain `[Dd]eprecat(ed|ion)` are updated in this PR. Resolves #126888 - #126888 This PR is split from PR #126898. - #126898 ------ Pull Request resolved: #127689 Approved by: https://github.com/Skylion007 (cherry picked from commit 67ef268)
…ytorch#127433)" This reverts commit 6e0eeec. Reverted pytorch#127433 on behalf of https://github.com/fbgheith due to depends on pytorch#126898 which is failing internally and needs to be reverted ([comment](pytorch#127433 (comment)))
…eprecated` (pytorch#126898)" This reverts commit 749a132. Reverted pytorch#126898 on behalf of https://github.com/fbgheith due to switching typing-extensions=4.3.0 to 4.9.0 causes internal failure ([comment](pytorch#126898 (comment)))
…d` (pytorch#127689) Use `typing_extensions.deprecated` for deprecation annotation if possible. Otherwise, add `category=FutureWarning` to `warnings.warn("message")` if the category is missing. Note that only warnings that their messages contain `[Dd]eprecat(ed|ion)` are updated in this PR. Resolves pytorch#126888 - pytorch#126888 This PR is split from PR pytorch#126898. - pytorch#126898 ------ Pull Request resolved: pytorch#127689 Approved by: https://github.com/Skylion007
…tils.is_compiling()` (#127690) This PR is split from PR #126898. - #126898 ------ Pull Request resolved: #127690 Approved by: https://github.com/Skylion007
…ternal_utils.is_compiling()` (#127690)" This reverts commit 348b181. Reverted #127690 on behalf of https://github.com/clee2000 due to sorry I think #126898 (comment) is still relevant, I will reach out to them to see what needs to be done in internal to get this remerged ([comment](#127690 (comment)))
…tils.is_compiling()` (pytorch#127690) This PR is split from PR pytorch#126898. - pytorch#126898 ------ Pull Request resolved: pytorch#127690 Approved by: https://github.com/Skylion007
…ternal_utils.is_compiling()` (pytorch#127690)" This reverts commit 348b181. Reverted pytorch#127690 on behalf of https://github.com/clee2000 due to sorry I think pytorch#126898 (comment) is still relevant, I will reach out to them to see what needs to be done in internal to get this remerged ([comment](pytorch#127690 (comment)))
Use
typing_extensions.deprecated
for deprecation annotation if possible. Otherwise, addcategory=FutureWarning
towarnings.warn("message")
if the category is missing.Note that only warnings that their messages contain
[Dd]eprecat(ed|ion)
are updated in this PR.UPDATE: Use
FutureWarning
instead ofDeprecationWarning
.Resolves #126888
typing_extensions.deprecated
for better IDE integration #126888cc @mrshenli @pritamdamania87 @zhaojuanmao @satgera @gqchen @aazzolini @osalpekar @jiayisuse @H-Huang @kwen2501 @awgu @penguinwu @fegin @XilunWu @wanchaol @fduwjj @wz337 @tianyu-l @wconstab @yf225 @chauhang @d4l3k @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @ezyang @malfet @xuzhao9 @gramster @mcarilli @ptrblck @leslie-fang-intel @voznesenskym @EikanWang @Guobing-Chen @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @peterbell10 @ipiszy @chenyang78 @kadeng @muchulee8 @ColinPeppler @amjames @desertfire @LucasLLC