[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Fooocus and AUTOMATIC1111 on AMD GPUs and SDNEXT



Hello,


I was also bored with the incompatibility with python and finally choose to build a 3.10 version which is not so difficult, I wounder if it wouldn't be worth to have that as a package to be used in virtualenv when required

Maybe would be interesting to make some Debian Wiki pages, about this but on the other hand these instructions are moving rapidly ...


>
>         To run AUTOMATIC1111:
>
> # use spack to install a compatible version of python
> sudo apt install bzip2 ca-certificates g++ gcc gfortran git gzip lsb-
> release patch python3 tar unzip xz-utils zstd build-essential cmake
> git clone -c feature.manyFiles=true https://github.com/spack/spack.git
> cd spack
> git checkout v0.23.1
> . share/spack/setup-env.sh
> spack spec zlib
> spack external find
> spack spec python@3.11
> spack install python@3.11
> spack load python@3.11
> cd ..
> git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
> cd stable-diffusion-webui
> git checkout v1.10.1
> python -m venv venv3
> . venv3/bin/activate
> python -m pip install --upgrade pip wheel
> TORCH_COMMAND='pip install torch torchvision torchaudio --index-url
> https://download.pytorch.org/whl/rocm6.2' python launch.py
>
> This is probably quite boring stuff for most of you, but the
> AUTOMATIC1111 incompatibility with Python 3.12 was a pain. Their install
> guide recommends using conda, but as someone unfamiliar with that
> ecosystem, I found the setup to be complex. I'm a big fan of the Spack
> package manager, so my instructions use that tool instead [2].


Then To run I used the small makefile with rocm 5.7 since 6.x is/was buggy on my RX7600XT :

cat Makefile:
---------------------------
run:
export python_cmd=${HOME}/git/github.com/vladmandic/automatic/python/3.10/usr/local/bin/python3.10 ; \ export TORCH_COMMAND="pip install torch torchvision --index-url https://download.pytorch.org/whl/rocm5.7"; ; \
        export HSA_OVERRIDE_GFX_VERSION=11.0.0 ; \
        ./webui.sh
----------------------------

My note about building python :

# See https://cloudcone.com/docs/article/how-to-install-python-3-10-on-debian-11/
# TODO
# wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz
# tar -xvf Python-3.10.0.tgz
# cd Python-3.10.0
# ./configure --enable-optimizations
# make -j $(nproc)
# make altinstall DESTDIR=../3.10
#
# Also more recent
# https://www.python.org/downloads/release/python-3106/
# https://www.python.org/ftp/python/3.10.6/Python-3.10.6.tgz

I think you don't even have to set the virtualenv, as webuild.sh is doing this for you
This script have a bunch of interesting config depending on your board
https://github.com/cbayle/stable-diffusion-webui/blob/rx76xx-support/webui.sh around line 130 I submitted a pull request for my board bug, have to ckeck if the nightly build fix the RX7600 issue ;-)
https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/16780




        To run SDNEXT (Beautifull interface)


This also allow to run SDNEXT https://github.com/vladmandic/sdnext
which seems to use similar starting code with this kind of config file

cat webui-user.sh
---------------------------------
PYTHON="$(pwd)/python/3.10/usr/local/bin/python3.10"
PYTORCH_HIP_ALLOC_CONF="expandable_segments:True"
export PYTORCH_HIP_ALLOC_CONF
HSA_OVERRIDE_GFX_VERSION=11.0.0
export HSA_OVERRIDE_GFX_VERSION
---------------------------------

then

./webui.sh --debug --use-rocm




      To run InvokeAI (even more Beautifull and easy to use)


I also have some more complex stuffs for InvokeAI
and some code at
https://github.com/cbayle/InvokeAI/tree/uv/uv
this use uv, that is is ITP, but not packaged on trixie



I haven't mastered the art of configuring container port permissions, so I didn't test these instructions in an isolated environment. If you have any troubles, please let me know.


For docker and build AMD Rocm Is use this, but docker requires often heavy adaptation

Makefile:
-----------------------------------
run:
	docker run --rm -it --device /dev/kfd --device /dev/dri \
		-e CCACHE_DIR=/home/debian/.ccache \
		-e CCACHE_ENABLED=true \
		-e DOCK_WORK_FOLD=/src \
		--security-opt seccomp=unconfined \
		--group-add $(shell getent group video | cut -d: -f3) \
		--group-add $(shell getent group render | cut -d: -f3) \
		-v ${HOME}/.ccache:/home/debian/.ccache \
		-v $(CURDIR)/../..:/src \
		--user=1000:1000 \
		-w /src \
		--name rocm-build-debian-13 \
		rocm/rocm-build-debian-13:latest \
		/bin/bash
------------------------------------

I pushed a merge request for debian Dockefile build there
https://github.com/ROCm/ROCm/pull/4427

Cheers

Christian B.



Reply to: