1adrianb / face-alignment

:fire: 2D and 3D Face alignment library build using pytorch
https://www.adrianbulat.com
BSD 3-Clause "New" or "Revised" License
6.88k stars 1.33k forks source link

Can not change device to 'cuda:1' for faceAlignment #314

Closed ZhenyanSun closed 1 year ago

ZhenyanSun commented 2 years ago

for I have cuda 0,1,2,3 but it specifies to 0 always.

1adrianb commented 2 years ago

You should be able to change this by passing the device explicitly: e.g.: device = 'cuda:1' when constructing the model. Alternatively, if you are running this as a separate script you can export the CUDA_VISIBLE_DEVICES=3 (for the 4th gpu) before calling you script.

ZhenyanSun commented 2 years ago

You should be able to change this by passing the device explicitly: e.g.: device = 'cuda:1' when constructing the model. Alternatively, if you are running this as a separate script you can export the CUDA_VISIBLE_DEVICES=3 (for the 4th gpu) before calling you script.

Thanks very much for your reply. Before I specify the os.environ["CUDA_VISIBLE_DEVICES"]="3" and also specify the device = 'cuda:3', then there was cuda error.