Can I execute it with only run.py file
samTheHacke opened this issue · comments
Basically you have installed torch without CUDA maybe because you do not have a GPU.
Either you reinstall torch with CUDA or you change the code to run in CPU.
Basically you have installed torch without CUDA maybe because you do not have a GPU.
Either you reinstall torch with CUDA or you change the code to run in CPU.
Thank you sooo much brother,can I known how to change code to run on cpu
You have to change the variable gpu_id
in the code to 'cpu'.
Here an easy example so you can understand:
#To GPU with the device number 0
tensor = torch.randn(2, 2).to('cuda:0')
# To CPU
tensor = torch.randn(2,2).to('cpu')
You can read more:
https://pytorch.org/docs/master/generated/torch.Tensor.to.html
You have to change the variable
gpu_id
in the code to 'cpu'.
Here an easy example so you can understand:#To GPU with the device number 0 tensor = torch.randn(2, 2).to('cuda:0') # To CPU tensor = torch.randn(2,2).to('cpu')
You can read more:
https://pytorch.org/docs/master/generated/torch.Tensor.to.html
You have to change the variable
gpu_id
in the code to 'cpu'.
Here an easy example so you can understand:#To GPU with the device number 0 tensor = torch.randn(2, 2).to('cuda:0') # To CPU tensor = torch.randn(2,2).to('cpu')
You can read more:
https://pytorch.org/docs/master/generated/torch.Tensor.to.html
Sir even after replacing from GPU to cpu I am getting errors sir
@samTheHacke The error says that could not found NVIDIA Driver which means that still the code is checking for GPU instead of CPU. Did you install the CPU version of Torch?
From https://pytorch.org/get-started/locally/
pip3 install torch==1.8.1+cpu torchvision==0.9.1+cpu torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
@samTheHacke The error says that could not found NVIDIA Driver which means that still the code is checking for GPU instead of CPU. Did you install the CPU version of Torch?
From https://pytorch.org/get-started/locally/
pip3 install torch==1.8.1+cpu torchvision==0.9.1+cpu torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
No I don't have cuda supported GPU,so I want code to execute to cpu ,but as you said I changed every gpu_id to cpu but I am getting soo many errors .
if I want to execute this project in cpu what things I have to change in this code.