-
Notifications
You must be signed in to change notification settings - Fork 967
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
Set correct NPU backend and distributed_type when using transfer_to_npu #3021
Conversation
Let's add a comment that NPU has to be checked before CUDA and why (a reference to the issue). Also, any idea if the same can also happen with other devices, i.e. CUDA should always be the last check? |
Sure, I will add a brief description to my fix. Also I've already open an issue here #3020 :) |
Thanks. Yeah, I meant that the comment can reference said issue. |
elif is_npu_available(): | ||
backend = "hccl" | ||
distributed_type = DistributedType.MULTI_NPU |
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.
agreed with @BenjaminBossan, let's add a comment here and during torch.device("npu")
that clarifies (in the code) that these must be done before the cuda check
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
All right I got it! Thanks :) |
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.
Great! Thanks for fixing this!
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.
Thanks!
What does this PR do?
When running
from torch_npu.contrib import transfer_to_npu
, we will findtorch.cuda.is_available()
is True which leads to incorrect backend and distributed_type. This PR fixes the problem to make sure npu envs check is before CUDA.Fixes #3020
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
@muellerzr