kritiksoman / GIMP-ML

AI for GNU Image Manipulation Program
https://kritiksoman.github.io/GIMP-ML-Docs/index.html
MIT License
1.39k stars 127 forks source link

Please let us choose to work with CPU when CUDA is detected. #22

Closed YAFU closed 3 years ago

YAFU commented 3 years ago

Hi. Currently plugins autodetect CUDA and they do not allow us to choose to work with CPU. The problem is that plugins make excessive use of vRAM, and most of them fail with out of memory problems even with small images (400x400px) on 4GB vRAM card. Some of them like super-resolution plugin return an error message when out of memory. But other plugins like "deep-denoising" don't return an error message but they don't work unless you are working with very small images. Thank you.

kritiksoman commented 3 years ago

check now

YAFU commented 3 years ago

check now

Thank you very much. CPU works in most plugins. But apparently deep-denoising plugin is still trying to use GPU no matter I choose to force CPU (I get CUDA error) EDIT: OK. I get two errors with deep-denoising plugin. *Error 1 forcing CPU: An error occurred running python-fu-deep-denoising RuntimeError: CUDA out of memory. Tried to allocate 62.00 MiB (GPU 0; 3.94 GiB total capacity; 3.20 GiB already allocated; 8.62 MiB free; 3.21 GiB reserved in total by PyTorch)

*Error 2 with GPU in very small image: An error occurred running python-fu-deep-denoising ZeroDivisionError: float division by zero

Traceback (most recent call last): File "/usr/lib/gimp/2.0/python/gimpfu.py", line 740, in response dialog.res = run_script(params) File "/usr/lib/gimp/2.0/python/gimpfu.py", line 361, in run_script return apply(function, params) File "/home/yafu/GIMP-ML/gimp-plugins/deepdenoise.py", line 105, in deepdenoise cpy = clrImg(imgmat,cFlag) File "/home/yafu/GIMP-ML/gimp-plugins/deepdenoise.py", line 72, in clrImg gimp.progress_update(float(idx)/float(t)) ZeroDivisionError: float division by zero

kritiksoman commented 3 years ago

check now

YAFU commented 3 years ago

Thanks, it works.