-
Notifications
You must be signed in to change notification settings - Fork 22.6k
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
[PrivateUse1 Backend] Unable to register backend to PrivateUse1 dispatch key: ModuleNotFoundError: No module named 'torch.privateuseone' #134293
[PrivateUse1 Backend] Unable to register backend to PrivateUse1 dispatch key: ModuleNotFoundError: No module named 'torch.privateuseone' #134293
Comments
error occurred when lazily initializing the privateuse1 device, I guess pytorch/torch/csrc/utils/device_lazy_init.cpp Lines 36 to 40 in 25b2e46
CC: @FFFrog |
As the @shink stated above, the lazy initializaion of custom device was supported by #121379. First of all ,this is a new optimization rather than a bug, so you may need to create a new device module which name can be everything you want and alse need to provide some required apis in this module, finally you can call By the way, We will improve the tutorial of Privatuse1 to make it more comprehensive and easy to read, hoping it will be helpful to you |
Gotcha, looks like adding this works: |
@FFFrog , regarding your note on documentation. This section should be reworded a bit. At least for me, it sounds like doing |
I've finished verifying this fix with our test cases. I'll leave the decision to close this ticket to you guys, given that a PR has been made regarding the lazy_init of the |
Thank you a lot for your advice, we will update the doc later. |
🐛 Describe the bug
As of
torch==2.4
, we're unable to register an out-of-tree backend using thePrivateUse1
mechanism described in this documentation using C++. We've verified the backend is successfully registered fromtorch==1.13
totorch==2.3
, using the below code:For
torch==2.4
we see the last line fail with:ModuleNotFoundError: No module named 'torch.privateuseone'
Furthermore, if we simply do:
We see differing behavior in the two mentioned torch version groups. For the non pt2.4 versions, we see the below error:
This makes sense, because nothing is registered to the
PrivateUseOne
dispatcher.However for pt2.4, we only see the
ModuleNotFoundError: No module named 'torch.privateuseone'
. This makes me think that there's a change in pt2.4 that hasn't been documented or there's a bug.Please let me know if more details are required. We'd like to get this issue resolved, as we'd like to have pt2.4 support with the PrivateUseOne backend registration feature. Thanks!
Versions
cc @NmomoN @mengpenghui @fwenguang @cdzhan @1274085042 @PHLens
The text was updated successfully, but these errors were encountered: