jiupinjia / stylized-neural-painting

Official Pytorch implementation of the preprint paper "Stylized Neural Painting", in CVPR 2021.
https://jiupinjia.github.io/neuralpainter/
Creative Commons Zero v1.0 Universal
1.56k stars 261 forks source link

i can not use GPU #14

Closed z-spider closed 3 years ago

z-spider commented 3 years ago

hello I tested this project on both win10 powershell and WSL, but it always uses my poor cpu, but I don't know how to check the cause of this problem. I tried to execute the following statement in python: "import torch" "print(torch.cuda.is_available())" It returns true in Powershell and false in WSL. Of course, I managed to execute the example, but it took quite a while.

So I need some help, thank you. please forgive my terrible english.

jiupinjia commented 3 years ago

Hi @z-spider, if you got true from torch.cuda.is_available(), then the code will be running right on your GPU. Have you checked the GPU status like memory usage while running the code?

whuxxie commented 3 years ago

me.too when i run ,i says Traceback (most recent call last): File "demo.py", line 4, in torch.cuda.current_device() File "C:\Users\xxiew\AppData\Roaming\Python\Python37\site-packages\torch\cuda__init__.py", line 384, in current_device _lazy_init() File "C:\Users\xxiew\AppData\Roaming\Python\Python37\site-packages\torch\cuda__init.py", line 186, in _lazy_init _check_driver() File "C:\Users\xxiew\AppData\Roaming\Python\Python37\site-packages\torch\cuda\init__.py", line 61, in _check_driver raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled


i got false from torch.cuda.is_available()

jiupinjia commented 3 years ago

Hi @whuxxie, thanks for your feedback. Can you try to clone this repo again and replace those py files in your local directory? I made an update yesterday where I have removed those torch.cuda.current_device() code lines.

z-spider commented 3 years ago

Hi @z-spider, if you got true from torch.cuda.is_available(), then the code will be running right on your GPU. Have you checked the GPU status like memory usage while running the code?

I got true from the torch, but it still doesn't work. This is my GPU, and I'm having no problems with memory usage. Or is there anything else you'd recommend checking? image

jiupinjia commented 3 years ago

Hi @z-spider, did you receive any error report while running? How long does it take to process one image?

whuxxie commented 3 years ago

Hi @whuxxie, thanks for your feedback. Can you try to clone this repo again and replace those py files in your local directory? I made an update yesterday where I have removed those torch.cuda.current_device() code lines.

hi,i try just now ,it's ok,thank u very much. without GPU,i find it very very slow.

z-spider commented 3 years ago

Hi @z-spider, did you receive any error report while running? How long does it take to process one image?

I reinstalled the environment with conda and it now works, taking about thirteen minutes to process an image. Before that, it took about several hours, which is too long. I don't know why, but thanks again.

jiupinjia commented 3 years ago

Yes it should be very slow on CPU. You can try to switch to lightweight renderers or using less strokes and see if there is any speed up.