Skip to content
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

Please replace .cuda() with to(device) in Stanza #1032

Closed
SGombert opened this issue May 19, 2022 · 5 comments
Closed

Please replace .cuda() with to(device) in Stanza #1032

SGombert opened this issue May 19, 2022 · 5 comments

Comments

@SGombert
Copy link

I wanted to test Stanza on the recently released MPS backend for the M1 macs. However, I noticed looking in the code that Stanza consistently uses the .cuda() method instead of the more flexible .to(device), and .cuda() does not seem to be overwritten by the MPS backend. While I get that it is convenient for most users to just set use_gpu=True, I miss the option to alternatively set a specific device which would make the framework much more flexible.

@AngledLuffa
Copy link
Collaborator

AngledLuffa commented May 19, 2022 via email

@AngledLuffa
Copy link
Collaborator

I did in fact replace cuda() with to(device) everywhere:

#1159

You can now theoretically set device=... to anything on a Pipeline when you create one. However, the MPS backend has several bugs, including one which makes it completely unusable for our project:

pytorch/pytorch#80306
https://discuss.pytorch.org/t/lstm-output-transposed/154820/5

So technically I've done exactly what you wanted, while at the same time I've accomplished absolutely nothing

@AngledLuffa
Copy link
Collaborator

This is now part of Stanza 1.5. As mentioned above, the current torch version is buggy for MPS. The next version is supposed to have a fix for that, though

@venkatasg
Copy link

Once this is fixed in PyTorch, I assume device='ops' should be enough for Stanza to use MPS during inference?

@AngledLuffa
Copy link
Collaborator

mps but otherwise yes

i tried a couple weeks ago, and it didn't work with the nightly build of pytorch.

pytorch/pytorch#97552

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants