DeepImageBlending icon indicating copy to clipboard operation
DeepImageBlending copied to clipboard

Can I execute it with only run.py file

Open samTheHacke opened this issue 4 years ago • 7 comments

Can anyone explain why we are using twopass.py and utils.py? Can't we run this only with code of run.py
And I am getting error while executing run.py at line of Canvas_mask =numpy2tensor(canvas_mask,gpu_id) Please help me bros 16213573728603563816958091638982

samTheHacke avatar May 18 '21 17:05 samTheHacke

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.

alvarogonjim avatar May 20 '21 10:05 alvarogonjim

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

samTheHacke avatar May 20 '21 11:05 samTheHacke

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

alvarogonjim avatar May 20 '21 11:05 alvarogonjim

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

IMG20210520225546_00.jpg

samTheHacke avatar May 20 '21 17:05 samTheHacke

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 avatar May 20 '21 19:05 samTheHacke

@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

alvarogonjim avatar May 22 '21 11:05 alvarogonjim

@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.

samTheHacke avatar May 22 '21 11:05 samTheHacke