this post was submitted on 25 Sep 2023
10 points (100.0% liked)

Stable Diffusion

4316 readers
16 users here now

Discuss matters related to our favourite AI Art generation technology

Also see

Other communities

founded 1 year ago
MODERATORS
 

I have been running Stable Diffusion in a separate partition with Ubuntu 22.04 because my OpenSUSE Tumbleweed installation does not support the ROCm kernels out of the box. I have seen some sporadic attempts on the web from folks looking to get something running on their rolling release distros, like the Arch Linux community.

Just wanna know if anyone else around here has tried something that works with their favourite rolling-release distros?

top 12 comments
sorted by: hot top controversial new old
[–] Contend6248@feddit.de 4 points 1 year ago (1 children)

The Arch User Repository is offering ROCm and yes, i tried it, it works

[–] rewarp 1 points 1 year ago

Nice. I am partial towards the rolling-release model so once my new hard drive arrives, I might take the plunge and just do an Arch install. What's the latest no-frills way to go from installation to a working system for Arch Linux derivatives?

[–] meteokr@community.adiquaints.moe 2 points 1 year ago* (last edited 1 year ago) (1 children)

I run automatic webui on Nixos with podman since I don't yet know how to set it up with flakes and python dependancy managment is pretty finicky. Default kernel out of the box. Nixos isn't technically a rolling release, but it is very up to date similar to tumbleweed. Recently got animatediff working which is pretty neat.

Edit: I used Debian:sid as the base image if that helps.

[–] rewarp 1 points 1 year ago (1 children)

Oh yeah. I like Nix. I have nixpkgs running on Tumbleweed too. But yeah, the base OS needs to be stable to be compatible with ROCm stuff, so that's why I have Ubuntu installed in a separate partition.

[–] meteokr@community.adiquaints.moe 2 points 1 year ago (1 children)

ROCm is userspace isn't it though? AMDGPU is the kernel driver. My container host doesn't have any ROCm pkgs installed. Everything is in the container with default kernel setup. I'm sure tumbleweeds kernel is up to date to be able to run it, I just don't know their runtime pkgs needed.

[–] rewarp 1 points 1 year ago (1 children)

I may be at a loss as to how everything fits together. I was trying to get SD running for months on TW before I gave up. Then just booted Ubuntu and it worked. So I always assumed it was something kernel related since upstream only supports the non-rolling distros.

What I need is probably an up-to-date write-up that is distro specific to TW. Meanwhile, I will probably try to compile ROCm and follow the suggestion in https://slrpnk.net/comment/2780338 and try to get rocm-opencl-runtime working.

[–] meteokr@community.adiquaints.moe 2 points 1 year ago* (last edited 1 year ago) (1 children)

As long as you have a somewhat recent kernel with the opensource AMD driver it should work. Here's the Containerfile I use:

FROM docker.io/debian:unstable
RUN DEBIAN_FRONTEND="noninteractive" apt update && \
        apt upgrade -y && \
        apt install -y git python3.10 python3-venv python3-pip rocminfo libgl1-mesa-glx libcairo2-dev libtcmalloc-minimal4

RUN useradd -m sduser
RUN git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui /dockerx/stable-diffusion-webui && \
        chown -R sduser:sduser /dockerx/stable-diffusion-webui

WORKDIR /dockerx/stable-diffusion-webui
USER sduser
ENV PATH="$PATH:/home/sduser/.local/bin"
RUN python3 -m venv venv
ENV REQS_FILE='requirements_versions.txt'
RUN sed -i 's/#python_cmd="python3"/python_cmd="python3.10"/g' webui-user.sh
RUN bash -c "source venv/bin/activate && pip install -r requirements_versions.txt"
EXPOSE 7860/tcp
VOLUME /dockerx/stable-diffusion-webui/extensions
VOLUME /dockerx/stable-diffusion-webui/repositories
VOLUME /dockerx/stable-diffusion-webui/models
CMD ./webui.sh

Then I just start it with this script.

sudo podman run -it --rm --name stablediffusion -p 7860:7860 -e COMMANDLINE_ARGS="--api --listen --port 7860 --enable-insecure-extension-access --reinstall-torch --device /dev/dri:dev/dri --privileged --device /dev/kfd:/dev/kfd stablediffweb:latest

Mount your volumes as needed depending on how you prefer to manage those. This is by no means the best way to do it, but I've been running it fine for months now, just rebuilding the container every so often when there's a big update. The ROCm nerds have settings for running it without sudo but I haven't swapped over to that yet.

[–] rewarp 1 points 1 year ago

Whoa this is awesome! Thanks!

[–] beigeoat@110010.win 2 points 1 year ago (1 children)

You can get it to work on arch, rocm is in the repos.

I suggest you use a container if you proceed though.

[–] rewarp 1 points 1 year ago (1 children)

Thanks for the suggestion. The problem is getting the ROCm kernels running. I looked into containers for ROCm support and unsurprisingly, my host OS needs it first.

[–] beigeoat@110010.win 2 points 1 year ago (1 children)

I think you are misunderstanding something, you don't need a rocm kernel. What you need is the rocm-opencl-runtime.

This video is a year old, but should be enough to get you started: https://www.youtube.com/watch?v=d_CgaHyA_n4

[–] rewarp 1 points 1 year ago

Oh neat. Thanks for the clarification. Maybe that's all I need to do to patch my TW system to get it working!