-
Notifications
You must be signed in to change notification settings - Fork 337
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
[PyTorch] Fix autocast deprecation warnings #1277
base: main
Are you sure you want to change the base?
Conversation
1420ea6
to
0987833
Compare
/te-ci pytorch |
35d7a31
to
a2212c0
Compare
/te-ci pytorch |
35ca876
to
39a9fe6
Compare
/te-ci pytorch |
/te-ci pytorch |
transformer_engine/pytorch/utils.py
Outdated
"""Get PyTorch autocast GPU dtype.""" | ||
TORCH_MAJOR = int(torch.__version__.split(".")[0]) | ||
TORCH_MINOR = int(torch.__version__.split(".")[1]) | ||
if TORCH_MAJOR == 2 and TORCH_MINOR >= 4: |
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.
Could we do a simpler >= "2.4" similar to the one currently in jit.py. This method isn't future proof and will break for 3+
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'm good with it.
Furthermore, since we now have packaging
as a dependency, how about using packaging.version
for a more robust version comparison?
Signed-off-by: Xin Yao <[email protected]>
Signed-off-by: Xin Yao <[email protected]>
Signed-off-by: Xin Yao <[email protected]>
Signed-off-by: Xin Yao <[email protected]>
Signed-off-by: Xin Yao <[email protected]>
f43bdad
to
6ba412f
Compare
Signed-off-by: Xin Yao <[email protected]>
6ba412f
to
30f8cae
Compare
TORCH_MAJOR = int(torch.__version__.split(".")[0]) | ||
TORCH_MINOR = int(torch.__version__.split(".")[1]) | ||
use_nvfuser = TORCH_MAJOR > 1 or (TORCH_MAJOR == 1 and TORCH_MINOR >= 10) | ||
use_nvfuser = is_torch_min_version("1.10.0a0") and not is_torch_min_version("2.2.0a0") |
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.
We stop using nvfuser starting from torch 2.2, so I think this update is needed. Tell me if you have other concerns.
Signed-off-by: Xin Yao <[email protected]>
@ksivaman Can you review again? |
Does this look good to you? @ksivaman |
Description
Fix
autocast
deprecation warnings.Starting from PyTorch 2.4, use
instead of device-specific APIs.
Closes #1167.
Type of change
Checklist: