Compare commits

..

3 Commits

Author SHA1 Message Date
c90ace69e8
update bitsandbytes build script 2024-08-19 18:43:30 +02:00
7417e9e5d1
update xtts-webui 2024-08-19 18:35:27 +02:00
2eac054623
add stablediffusion-forge 2024-08-19 18:34:52 +02:00
7 changed files with 84 additions and 13 deletions

View File

@ -1,33 +1,39 @@
FROM rocm/dev-ubuntu-22.04:6.1.2 FROM rocm/dev-ubuntu-22.04:6.1.2
ENV DEBIAN_FRONTEND=noninteractive \ ENV ROCM_ARCH="gfx1030" \
TORCH_VERSION="rocm6.1" \
DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \ PYTHONUNBUFFERED=1 \
PYTHONIOENCODING=UTF-8 \ PYTHONIOENCODING=UTF-8
ROCM_ARCH="gfx1030"
WORKDIR /tmp WORKDIR /tmp
RUN apt-get update -y RUN apt-get update -y
RUN apt-get install -y wget git cron cmake make RUN apt-get install -y wget git cron cmake make software-properties-common
# Install python3.10
RUN add-apt-repository ppa:deadsnakes/ppa -y && apt-get update -y
RUN apt-get install -y python3.10 python3.10-dev python3.10-venv
ENV VIRTUAL_ENV=/opt/venv
RUN python3.10 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Install python3
RUN apt-get install -y python3 python3-dev
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3
RUN pip3 install --upgrade pip wheel setuptools RUN pip3 install --upgrade pip wheel setuptools
# Install pytorch for rocm # Install pytorch for rocm
RUN pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm6.1 RUN pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/${TORCH_VERSION}
# ROCM bitsandbytes # ROCM bitsandbytes
RUN apt-get install -y hipblas hipblaslt hiprand hipsparse hipcub rocthrust-dev RUN apt-get install -y hipblas hipblaslt hiprand hipsparse hipcub rocthrust-dev
## Clone repo and install python requirements ## Clone repo and install python requirements
RUN git clone --recurse https://github.com/ROCm/bitsandbytes RUN git clone --depth 1 -b multi-backend-refactor https://github.com/bitsandbytes-foundation/bitsandbytes.git
WORKDIR /tmp/bitsandbytes WORKDIR /tmp/bitsandbytes
RUN git checkout rocm_enabled
RUN pip3 install -r requirements-dev.txt RUN pip3 install -r requirements-dev.txt
## Build ## Build
RUN cmake -DCOMPUTE_BACKEND=hip -S . -DBNB_ROCM_ARCH=${ROCM_ARCH} RUN cmake -DCOMPUTE_BACKEND=hip -S . -DBNB_ROCM_ARCH=${ROCM_ARCH}
RUN make RUN make
RUN python3 setup.py bdist_wheel --universal RUN python3.10 setup.py bdist_wheel --universal
# Cleanup # Cleanup
RUN apt-get clean && pip3 cache purge RUN apt-get clean && pip3 cache purge

4
stablediffusion-forge-rocm/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
venv/
webui/
models/
outputs/

View File

@ -0,0 +1,40 @@
#!/bin/bash
source ../utils.sh
python_exec=venv/bin/python3.10
# Function to install/update StableDiffusion
install_stablediffusionforge() {
if [ -d "webui" ]; then
echo "StableDiffusionForge repository already exists."
yes_or_no "Do you want to update StableDiffusionForge WebUI ?" && {
cd webui
git pull
echo "StableDiffusionForge WebUI successfully updated."
}
else
echo "Cloning StableDiffusionForge repository..."
git clone https://github.com/lllyasviel/stable-diffusion-webui-forge webui
echo "Running StableDiffusionForge setup..."
$python_exec webui/launch.py --skip-torch-cuda-test --exit
ln -s webui/models models
ln -s webui/outputs outputs
fi
}
# Main function
main() {
prepare_env
# Install StableDiffusionForge
install_stablediffusionforge
clean
echo "StableDiffusion installation/update complete. Use ./run.sh to start"
}
# Run main function
main

View File

@ -0,0 +1,18 @@
#!/bin/bash
source ../utils.sh
python_exec=venv/bin/python3.10
# Main function
main() {
# Create virtual environment
use_venv
# Prints ROCM info with available GPUs
rocm-smi
# Start SD
TORCH_BLAS_PREFER_HIPBLASLT=0 $python_exec webui/launch.py --listen --enable-insecure-extension-access # --opt-split-attention
}
main

View File

@ -26,8 +26,10 @@ install_xtts() {
sed -i 's/asr_model = WhisperModel(whisper_model, device=device, compute_type="float16")/asr_model = WhisperModel(whisper_model, device=device, compute_type="int8")/' webui/scripts/utils/formatter.py sed -i 's/asr_model = WhisperModel(whisper_model, device=device, compute_type="float16")/asr_model = WhisperModel(whisper_model, device=device, compute_type="int8")/' webui/scripts/utils/formatter.py
# Deepspeed and ninja (not working) # Deepspeed and ninja (not working)
$python_exec -m pip install ninja #deepspeed $python_exec -m pip install ninja deepspeed
# apt-get install -y ninja-build # apt-get install -y ninja-build
ln -S webui/models models
} }
# Main function # Main function

View File

@ -11,7 +11,8 @@ main() {
rocm-smi rocm-smi
# Start XTTS # Start XTTS
$python_exec webui/app.py --host 0.0.0.0 -v v2.0.3 cd webui/
TORCH_BLAS_PREFER_HIPBLASLT=0 ../$python_exec app.py --host 0.0.0.0 -v v2.0.3
} }
main main