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

Can you take ‘device‘ as a parameter? #18

Open
yizhangliu opened this issue Jul 1, 2022 · 2 comments
Open

Can you take ‘device‘ as a parameter? #18

yizhangliu opened this issue Jul 1, 2022 · 2 comments

Comments

@yizhangliu
Copy link

Thank you for perfect work.
But like this: "device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')",
Sometimes, I will use 'cuda:1'.
Please fix it.

@Vargol
Copy link

Vargol commented Sep 24, 2022

Also there more than just the choice between CUDA and CPU these days, there's MPS too for example

@wzxu
Copy link

wzxu commented Jul 8, 2023

For myself I manually changed the line to the following to use mps on Apple Silicon Mac.

device = torch.device('mps:0' if torch.backends.mps.is_available() else '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