Acly / krita-ai-diffusion

Streamlined interface for generating images with AI in Krita. Inpaint and outpaint with optional text prompt, no tweaking required.
https://www.interstice.cloud
GNU General Public License v3.0
6.09k stars 284 forks source link

Amd acceleration in linux #76

Open leiserfg opened 9 months ago

leiserfg commented 9 months ago

ComfyUI in linux can use rocm, why is it labeled as "windows only" here?

Acly commented 9 months ago

The automated installer only supports DirectML. That's because I don't have an AMD GPU to test RocM (but I can test DirectML with Nvidia). If you're installing and setting up ComfyUI yourself you can make it work.

I can update the readme to reflect that a bit more precisely.

drjarno commented 9 months ago

You should be able to convert the automatically installed environment to one that supports ROCm by doing the following:

source .local/share/krita/pykrita/ai_diffusion/.server/venv
pip install --force-reinstall torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm5.6

For some reason, I had to follow up that command with:

pip install "fsspec>=2023.5.0"

I guess --force-reinstall does something funny with the dependencies.

Anyway, after that I could run the plugin from Krita using my GPU. My AMD GPU is a wimpy Radeon RX 5700 XT though so using CPU was actually faster. I also had to set HSA_OVERRIDE_GFX_VERSION=10.3.0, but that's GPU specific.

x0r13 commented 8 months ago

@drjarno I can confim it works that way (you have to start the server yourself), and then connect via the plugin. Using a RX6800 it takes around 2-3mins for a 512x512 image.

palko444 commented 4 months ago

@x0r13 can you please tell me how to start server yourself. I was using button in krita UI. I reinstalled packages as stated by @drjarno in venv, but it did not helped. I still can see only 2 options CPU or GPU (cuda). My card is same as @drjarno Radeon RX 5700 XT. Thank you in advance

0chroma commented 1 month ago

hello! I have an AMD GPU and would love to work on this. It'd be my first issue, so lmk if there's anywhere specific I should look to get started.

Acly commented 1 month ago

You mean adding a RocM option for the installer?

Basically you

Ideally you can then select RocM from the installer UI and it works. Not sure if you need to pass extra arguments to ComfyUI, it can be done in server.py/start. The annoying part is testing and making sure it really works since install takes a while. See the notes in contributing to speed it up if you have to do it repeatedly.