facexlib icon indicating copy to clipboard operation
facexlib copied to clipboard

Can you take ‘device‘ as a parameter?

Open yizhangliu opened this issue 2 years ago • 2 comments

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.

yizhangliu avatar Jul 01 '22 02:07 yizhangliu

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

Vargol avatar Sep 24 '22 09:09 Vargol

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')

wzxu avatar Jul 08 '23 15:07 wzxu