mseitzer / pytorch-fid

Compute FID scores with PyTorch.

Repository from Github https://github.commseitzer/pytorch-fidRepository from Github https://github.commseitzer/pytorch-fid

from gpu to device

xml94 opened this issue · comments

it is seems that the gpu is changed to device, but how to use the device?

I tried to use this: cuda:0.

But gpu is not used.

How can we do for this? Thanks.

It should automatically use the GPU by default if available. You can explicitly specify the device using the --device argument, e.g. --device cuda. You can put anything that is accepted by torch.device here (see https://pytorch.org/docs/stable/tensor_attributes.html#torch.torch.device).

If it does not work anyways, I would guess that the problem is on your side. Check the output of torch.cuda.is_available()) if Pytorch recognizes your GPU.

Thanks for your reply.

Before we can use --gpu 0 to let the code use the first GPU.
now can we assign the number of GPU for the 'device'?

--device cuda:0 should select the first GPU. If this does not work, you can also set CUDA_VISIBLE_DEVICES=0.

For example: CUDA_VISIBLE_DEVICES=0 python -m pytorch_fid path1 path2