DeepNude_NoWatermark_withModel icon indicating copy to clipboard operation
DeepNude_NoWatermark_withModel copied to clipboard

AssertionError: Torch not compiled with CUDA enabled

Open Mr41Die opened this issue 2 years ago • 2 comments

Processing input.png libpng warning: iCCP: known incorrect sRGB profile Executing phase: dress_to_correct Executing phase: correct_to_mask Traceback (most recent call last): File "C:\Users\Aldy\deepnude\main.py", line 56, in main(inputpath, outputpath, show) File "C:\Users\Aldy\deepnude\main.py", line 35, in main watermark = deep_nude_process(inputpath) File "C:\Users\Aldy\deepnude\main.py", line 46, in deep_nude_process watermark = process(dress) File "C:\Users\Aldy\deepnude\run.py", line 115, in process model.initialize(opt) File "C:\Users\Aldy\deepnude\gan.py", line 66, in initialize self.netG = self.__define_G(opt.input_nc, opt.output_nc, opt.ngf, opt.netG, File "C:\Users\Aldy\deepnude\gan.py", line 117, in __define_G netG.cuda(gpu_ids[0]) File "C:\Users\Aldy\anaconda3\lib\site-packages\torch\nn\modules\module.py", line 688, in cuda return self._apply(lambda t: t.cuda(device)) File "C:\Users\Aldy\anaconda3\lib\site-packages\torch\nn\modules\module.py", line 578, in _apply module._apply(fn) File "C:\Users\Aldy\anaconda3\lib\site-packages\torch\nn\modules\module.py", line 578, in _apply module._apply(fn) File "C:\Users\Aldy\anaconda3\lib\site-packages\torch\nn\modules\module.py", line 601, in _apply param_applied = fn(param) File "C:\Users\Aldy\anaconda3\lib\site-packages\torch\nn\modules\module.py", line 688, in return self.apply(lambda t: t.cuda(device)) File "C:\Users\Aldy\anaconda3\lib\site-packages\torch\cuda_init.py", line 210, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled

When i executing python main.py this error appear what should i do?

Mr41Die avatar May 07 '22 10:05 Mr41Die

Ok i managed to get rid of this error, go to gan.py and go to line 117 then change netg.cuda(cpu[0]) to netg.cpu()

Tom-Sumner avatar Aug 06 '22 23:08 Tom-Sumner

This is because you've most likely installed torch without CUDA enabled, in the readme.md package instillation segment it does not install Torch with CUDA enabled, you have to use the command line they recommend via the PyTorch website:

If you're using Windows and have PIP installed: pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116

Alternatively, go to their website and tailor the configuration accordingly: https://pytorch.org/get-started/locally/

Note: You also need to do pip3 uninstall torch torchvision torchaudio before installing the packages, as it will return you already having the package if you've installed the package previously without CUDA enabled.

Xikly avatar Sep 19 '22 08:09 Xikly