Pytorch multiple GPU count error: UserWarning: CUDA initialization: Unexpected error from cudaGetDeviceCount()

Changing the CUDA_VISIBLE_DEVICES environment variable after importing PyTorch seems suspicious e.g., Os.environ [“CUDA_VISIBLE_DEVICES”] not functioning - PyTorch Forums

Could you check if setting it before running your script helps?

1 Like