Artix Linux Forum

Artix Linux => Applications & Software => Topic started by: hd_scania on 27 July 2024, 07:06:51

Title: [Howto] Install & run Stable Diffusion (SDiff) AI app on no-systemd
Post by: hd_scania on 27 July 2024, 07:06:51
:) Requirements
Code: [Select]
doas pacman -Syu --noconfirm --overwrite=* --needed git trizen
trizen -Syu --noconfirm --overwrite=* --needed --noedit opencl-amd py311 microsoft-edge-dev-bin plasma-systemmonitor radeontop
:) Hardware environments
Code: [Select]
ASRock AMD X300 DeskMini (NVidia DGPU’s are much less space efficient, and mine is however compact :) )
AMD R4750G APU (Zen2 Lucienne-G)
14.9GiB UMA (Unified graphics memories) (To be explicitly set on BIOS)
3.63TiB Samsung 990PRO NVMe SSD
3.63TiB Kingston NV2 NVMe SSD
3.63TiB Samsung 870QVO 2.5’’ SSD
1.82TiB Transcend 220Q 2.5’’ SSD
:) Artix environments
Code: [Select]
BtrFS root
Linux Hardened kernel
KDE Plasma 6
Lots of OpenZFS and ext2 guests
(trizen -Syu --noconfirm --overwrite=* --needed --noedit dkms linux-hardened-headers zfs-dkms-staging-git)
:) Actual commands i run to start ComfyUI, run everything below
Code: [Select]
mv -ffvv .ComfyUI_legacy .ComfyUI_$(date +%H%M%S%m%d%y)
    mv -ffvv ComfyUI .ComfyUI_legacy
    mkdir -pp ComfyUI
    git clone https://github.com/comfyanonymous/ComfyUI.git ComfyUI
    cd ComfyUI
    git pull
    doas rm -rrff ~/.local/lib/py*
    mkdir -pp /opt/local/ComfyUI_SDiffXL/pyenv/bin
    curl https://bootstrap.pypa.io/get-pip.py -o /opt/local/ComfyUI_SDiffXL/pyenv/pip.py
    python3.11 -m venv /opt/local/ComfyUI_SDiffXL/pyenv
    source /opt/local/ComfyUI_SDiffXL/pyenv/bin/activate
    python3.11 /opt/local/ComfyUI_SDiffXL/pyenv/pip.py
    PIP_REQUIRE_VIRTUALENV=true python3.11 -m pip install -U --pre --require-virtualenv --break-system-packages --force-reinstall \
                                            -f https://repo.radeon.com/rocm/manylinux/rocm-rel-6.2 \
                                            -i https://download.pytorch.org/whl/nightly/rocm6.2 \
                                            --extra-index-url https://pypi.org/simple \
                                            'torch==2.2.1' 'torchvision==0.17.1' \
                                            pip memory_profiler accelerate scipy psutil packaging transformers opencv-python pipdeptree pip-tools 'requests~=2.22' 'urllib3~=1.26' wheel
    mkdir -pp models
    cd models
    mkdir -pp checkpoints vae loras
    cd checkpoints
    ln -ffss ../../../models/checkpoints/* .
    cd ../vae
    ln -ffss ../../../models/vae/* .
    cd ../loras
    ln -ffss ../../../models/loras/* .
    cd ../.. && mkdir -pp custom_nodes && cd custom_nodes
    git clone https://github.com/Extraltodeus/ComfyUI-AutomaticCFG.git AutoCFG
    cd AutoCFG && git pull
    cd ..
    git clone https://github.com/ltdrdata/ComfyUI-Manager.git ComfyMgt
    cd ComfyMgt && git pull
    cd ..
    git clone https://github.com/yolain/ComfyUI-Easy-Use EASyUSe
    cd EASyUSe && git pull
    cd ..
    git clone https://github.com/Extraltodeus/Stable-Diffusion-temperature-settings TEMp
    cd TEMp && git pull
    cd ../..
    PIP_REQUIRE_VIRTUALENV=true python3.11 -m pip install -U --pre --require-virtualenv --break-system-packages --force-reinstall \
                                            -f https://repo.radeon.com/rocm/manylinux/rocm-rel-6.2 \
                                            -i https://download.pytorch.org/whl/nightly/rocm6.2 \
                                            --extra-index-url https://pypi.org/simple \
                                            'torch==2.2.1' 'torchvision==0.17.1' \
                                            -r requirements.txt \
                                            -r custom_nodes/ComfyMgt/requirements.txt \
                                            -r custom_nodes/AutoCFG/requirements.txt \
                                            -r custom_nodes/EASyUSe/requirements.txt
    git pull
    git pull
    git pull
mkdir -pp /opt/local/.8A/terminal/SDiffXL/Downloads/11132024 /opt/local/.8A/terminal/SDiffXL/Downloads/.JSOn
while true
      do
        HSA_OVERRIDE_GFX_VERSION=9.0.0 HIP_PLATFORM=amd PYTORCH_HIP_FALLBACK=1 \
        PYTORCH_HIP_ALLOC_CONF=garbage_collection_threshold:0.83,max_split_size_mb:48 \
        PYTORCH_NO_HIP_MEMORY_CACHING=1 \
        python3.11 main.py \
        --highvram --disable-smart-memory --disable-cuda-malloc \
        --force-fp32 --force-upcast-attention --use-split-cross-attention --disable-xformers \
        --auto-launch --listen --preview-method latent2rgb --dont-print-server \
        --output-directory /opt/local/.8A/terminal/SDiffXL/Downloads/11132024
done

Models download (requires logins sometimes :) ) — https://CivitAI.com https://HuggingFace.co :)