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

Running on CPU #9

Open
rkruegs123 opened this issue Apr 8, 2022 · 2 comments
Open

Running on CPU #9

rkruegs123 opened this issue Apr 8, 2022 · 2 comments

Comments

@rkruegs123
Copy link

Hi, when running the test code on a CPU I got the following error: AttributeError: module 'torch._C' has no attribute '_cuda_setDevice'

I am guessing that the code assumes that one has a GPU, but I don't see much reason for this if I am just using a pre-trained model for inference.

@sperfu
Copy link
Contributor

sperfu commented Apr 10, 2022

Hi,

I guess it's because you only run the code on CPU. In that case, you can alter the code:

device = torch.device("cuda:1" if torch.cuda.is_available() else "cpu")

to:

  device = torch.device("cpu")

to avoid this issue.

Please have a try.

Thanks

@IseultLeahy
Copy link

Hey,
I've been getting the same error message and tried your solution but unfortunately it didn't change anything...

device = torch.device("cuda:1" if torch.cuda.is_available() else "cpu")

to:

  device = torch.device("cpu")

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

No branches or pull requests

3 participants