stable-diffusion icon indicating copy to clipboard operation
stable-diffusion copied to clipboard

cpu support for txt2img and img2img

Open Ricardicus opened this issue 2 years ago • 3 comments

Hello,

I made this PR because this fix makes it possible to run txt2img and img2img on the CPU. It takes some time using the CPU, for sure, but it works. In the code, it is sometimes assumed that cuda is available and other times it isn't assumed. Since it isn't consistent, I figured this change might be interesting for you upstream.

Thanks!

Ricardicus avatar Feb 08 '23 18:02 Ricardicus

ring

Freedomlee1 avatar Apr 13 '23 07:04 Freedomlee1

Is there a way to force using the CPU even if the GPU is available? I've a few memory consumption changes I've made, but have been looking for a way to run img2img, but my memory changes don't work there.

chrisjohnson00 avatar Jul 20 '23 21:07 chrisjohnson00

Is there a way to force using the CPU even if the GPU is available? I've a few memory consumption changes I've made, but have been looking for a way to run img2img, but my memory changes don't work there.

Check the code, it has to do with a string specifying the device. If it is set to "cuda" that means it is using the gpu. One can fork, then set it to "cpu" everywhere regardless. There is no command line argument available that forces setting it to cpu unfortunately. But with this fork of mine, one can run it on cpu if there is no gpu available. Fork my fork, then write "cpu" everywhere then you are good :)

Ricardicus avatar Jul 21 '23 18:07 Ricardicus