Skip to content
Merged

Test #32

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7e964ce
Merge pull request #24 from grokuku/main
grokuku Feb 10, 2024
62f2a24
simplify entry.sh + move to IOPaint
grokuku Feb 10, 2024
07eff66
fix entry.sh
grokuku Feb 10, 2024
8ef5690
adjust IOPaint parameters
grokuku Feb 10, 2024
3bbfbb6
fix IOPaint parameters
grokuku Feb 10, 2024
12147c1
fix parameters again
grokuku Feb 10, 2024
764a82d
fix dockerfile
grokuku Feb 10, 2024
8aca5d3
change install mode for IOPaint
grokuku Feb 10, 2024
bafe1cb
fix parameters not copied for IOPaint
grokuku Feb 10, 2024
7800873
change IOPaint default parameters
grokuku Feb 10, 2024
a8777bc
Merge pull request #26 from grokuku/main
grokuku Feb 25, 2024
c119269
Merge pull request #25 from grokuku/Holaf_tests
grokuku Feb 25, 2024
e6828fc
add forge fork + add use of common folders
grokuku Feb 25, 2024
7f0ae3c
don't use python venv for forge
grokuku Feb 25, 2024
5c81714
add conda init
grokuku Feb 25, 2024
5afcff8
fix conda activate
grokuku Feb 25, 2024
166ba54
remove python venv for 02 + 02.forge
grokuku Feb 25, 2024
ec5dbd3
add onxx path
grokuku Feb 25, 2024
73cd222
fix typo
grokuku Feb 25, 2024
88137c0
update onxx for cuda 12.x
grokuku Feb 25, 2024
a60614c
fix path onxx
grokuku Feb 25, 2024
254b24e
onxx fix for auto1111
grokuku Feb 25, 2024
a3b2103
dedicated parameters for forge + fix auto1111 parameters
grokuku Feb 25, 2024
06463e5
final fixes sdwebui+forge
grokuku Feb 25, 2024
c4ca5e8
Merge pull request #27 from grokuku/Holaf_tests
grokuku Feb 25, 2024
bcd08f2
Update 02.forge.sh
grokuku Feb 27, 2024
afc65ae
Merge pull request #28 from grokuku/Holaf_tests
grokuku Feb 27, 2024
a7af65e
Update Dockerfile (add bc command)
grokuku Feb 27, 2024
3da371e
Merge pull request #29 from grokuku/Holaf_tests
grokuku Feb 27, 2024
40e2b66
Update 02.forge.sh
grokuku Feb 27, 2024
d21060b
Merge pull request #30 from grokuku/Holaf_tests
grokuku Feb 28, 2024
b9569a5
update onxx for cuda 12 (auto1111 + forge)
grokuku Mar 3, 2024
43e7101
upgrade to onxx for cuda12
grokuku Mar 3, 2024
bea170e
Merge pull request #31 from grokuku/Holaf_tests
grokuku Mar 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions 02.forge.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#!/bin/bash
source /sl_folder.sh

export PATH="/home/abc/miniconda3/bin:$PATH"
export active_clean=0

# disable the use of a python venv
export venv_dir="-"

# Install or update Stable-Diffusion-WebUI
mkdir -p ${SD02_DIR}

if [ ! -d ${SD02_DIR}/conda-env ]; then
conda create -p ${SD02_DIR}/conda-env -y
fi

source activate ${SD02_DIR}/conda-env
conda install -n base conda-libmamba-solver -y
conda install -c git python=3.11 pip --solver=libmamba -y

if [ ! -d ${SD02_DIR}/forge ]; then
git clone https://github.com/lllyasviel/stable-diffusion-webui-forge.git ${SD02_DIR}/forge
fi

cd ${SD02_DIR}/forge

# check if remote is ahead of local
# https://stackoverflow.com/a/25109122/1469797
if [ "$CLEAN_ENV" != "true" ] && [ $(git rev-parse HEAD) = $(git ls-remote $(git rev-parse --abbrev-ref @{u} | \
sed 's/\// /g') | cut -f1) ]; then
echo "Local branch up-to-date, keeping existing venv"
else
if [ "$CLEAN_ENV" = "true" ]; then
echo "Forced wiping venv for clean packages install"
else
echo "Remote branch is ahead. Wiping venv for clean packages install"
fi
export active_clean=1
git pull -X ours
fi

#clean conda env
if [ "$active_clean" = "1" ]; then
conda deactivate
conda remove -p ${SD02_DIR}/conda-env --all -y
conda create -p ${SD02_DIR}/conda-env -y
source activate ${SD02_DIR}/conda-env
fi
conda install -c conda-forge git python=3.11 pip gcc gxx libcurand --solver=libmamba -y

if [ ! -f "$SD02_DIR/parameters.forge.txt" ]; then
cp -v "/opt/sd-install/parameters/02.forge.txt" "$SD02_DIR/parameters.forge.txt"
fi

pip install --upgrade pip
pip install packaging
pip install onnxruntime-gpu --extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/
pip install insightface
pip install basicsr
#pip install protobuf==3.20.3

# Merge Models, vae, lora, and hypernetworks, and outputs
# Ignore move errors if they occur
sl_folder ${SD02_DIR}/forge/models Stable-diffusion ${BASE_DIR}/models stable-diffusion
sl_folder ${SD02_DIR}/forge/models hypernetworks ${BASE_DIR}/models hypernetwork
sl_folder ${SD02_DIR}/forge/models Lora ${BASE_DIR}/models lora
sl_folder ${SD02_DIR}/forge/models VAE ${BASE_DIR}/models vae
sl_folder ${SD02_DIR}/forge embeddings ${BASE_DIR}/models embeddings
sl_folder ${SD02_DIR}/forge/models ESRGAN ${BASE_DIR}/models upscale
sl_folder ${SD02_DIR}/forge/models BLIP ${BASE_DIR}/models blip
sl_folder ${SD02_DIR}/forge/models Codeformer ${BASE_DIR}/models codeformer
sl_folder ${SD02_DIR}/forge/models GFPGAN ${BASE_DIR}/models gfpgan
sl_folder ${SD02_DIR}/forge/models LDSR ${BASE_DIR}/models ldsr
sl_folder ${SD02_DIR}/forge/models ControlNet ${BASE_DIR}/models controlnet

sl_folder ${SD02_DIR}/forge output ${BASE_DIR}/outputs 02-sd-webui

echo "Run Stable-Diffusion-WebUI-forge"
cd ${SD02_DIR}/forge
CMD="bash webui.sh"
while IFS= read -r param; do
if [[ $param != \#* ]]; then
CMD+=" ${param}"
fi
done < "${SD02_DIR}/parameters.forge.txt"
eval $CMD
69 changes: 33 additions & 36 deletions 02.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,62 @@
source /sl_folder.sh

export PATH="/home/abc/miniconda3/bin:$PATH"
export active_clean=0

export use_venv=1
# disable the use of a python venv
export venv_dir="-"

# Install or update Stable-Diffusion-WebUI
mkdir -p ${SD02_DIR}

if [ ! -d ${SD02_DIR}/env ]; then
conda create -p ${SD02_DIR}/env -y
if [ ! -d ${SD02_DIR}/conda-env ]; then
conda create -p ${SD02_DIR}/conda-env -y
fi

source activate ${SD02_DIR}/env
source activate ${SD02_DIR}/conda-env
conda install -n base conda-libmamba-solver -y
conda install -c conda-forge git python=3.11 pip gcc gxx libcurand --solver=libmamba -y


conda install -c git python=3.11 pip --solver=libmamba -y

if [ ! -d ${SD02_DIR}/webui ]; then
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui ${SD02_DIR}/webui
fi

cd ${SD02_DIR}/webui

if [ -d "${SD02_DIR}/webui/venv" ]; then
# check if remote is ahead of local
# https://stackoverflow.com/a/25109122/1469797
if [ "$CLEAN_ENV" != "true" ] && [ $(git rev-parse HEAD) = $(git ls-remote $(git rev-parse --abbrev-ref @{u} | \
sed 's/\// /g') | cut -f1) ]; then
echo "Local branch up-to-date, keeping existing venv"
else
# check if remote is ahead of local
# https://stackoverflow.com/a/25109122/1469797
if [ "$CLEAN_ENV" != "true" ] && [ $(git rev-parse HEAD) = $(git ls-remote $(git rev-parse --abbrev-ref @{u} | \
sed 's/\// /g') | cut -f1) ]; then
echo "Local branch up-to-date, keeping existing venv"
else
if [ "$CLEAN_ENV" = "true" ]; then
echo "Forced wiping venv for clean packages install"
echo "Forced wiping venv for clean packages install"
else
echo "Remote branch is ahead. Wiping venv for clean packages install"
echo "Remote branch is ahead. Wiping venv for clean packages install"
fi
rm -rf ${SD02_DIR}/webui/venv
git pull -X ours
fi
export active_clean=1
git pull -X ours
fi

#clean conda env
if [ "$active_clean" = "1" ]; then
conda deactivate
conda remove -p ${SD02_DIR}/conda-env --all -y
conda create -p ${SD02_DIR}/conda-env -y
source activate ${SD02_DIR}/conda-env
fi
conda install -c conda-forge git python=3.11 pip gcc gxx libcurand --solver=libmamba -y

if [ ! -f "$SD02_DIR/parameters.txt" ]; then
cp -v "/opt/sd-install/parameters/02.txt" "$SD02_DIR/parameters.txt"
fi

# Create venv
if [ ! -d ${SD02_DIR}/webui/venv ]; then
cd ${SD02_DIR}/webui
python -m venv venv
cd ${SD02_DIR}/webui
source venv/bin/activate
pip install --upgrade pip
pip install packaging
pip install onnxruntime-gpu
pip install insightface
pip install protobuf==3.20.3
deactivate
fi
pip install --upgrade pip
pip install packaging
pip install onnxruntime-gpu --extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/
pip install insightface
pip install basicsr
#pip install protobuf==3.20.3

# Merge Models, vae, lora, and hypernetworks, and outputs
# Ignore move errors if they occur
Expand All @@ -71,15 +71,12 @@ sl_folder ${SD02_DIR}/webui/models BLIP ${BASE_DIR}/models blip
sl_folder ${SD02_DIR}/webui/models Codeformer ${BASE_DIR}/models codeformer
sl_folder ${SD02_DIR}/webui/models GFPGAN ${BASE_DIR}/models gfpgan
sl_folder ${SD02_DIR}/webui/models LDSR ${BASE_DIR}/models ldsr
sl_folder ${SD02_DIR}/webui/models ControlNet ${BASE_DIR}/models controlnet

sl_folder ${SD02_DIR}/webui outputs ${BASE_DIR}/outputs 02-sd-webui

echo "Run Stable-Diffusion-WebUI"
cd ${SD02_DIR}/webui
source venv/bin/activate
export PATH="/config/02-sd-webui/webui/venv/lib/python3.11/site-packages/onnxruntime/capi:$PATH"
pip install --upgrade pip

CMD="bash webui.sh"
while IFS= read -r param; do
if [[ $param != \#* ]]; then
Expand Down
26 changes: 15 additions & 11 deletions 50.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ source /sl_folder.sh

export PATH="/home/abc/miniconda3/bin:$PATH"

mkdir -p "${SD50_DIR}"
mkdir -p /config/outputs/50-Lama-cleaner
mkdir -p "${SD50_DIR}/IOPaint"
mkdir -p /config/outputs/50-IOPaint

if [ ! -d ${SD50_DIR}/env ]; then
conda create -p ${SD50_DIR}/env -y
Expand All @@ -18,24 +18,28 @@ if [ ! -f "$SD50_DIR/parameters.txt" ]; then
cp -v "${SD_INSTALL_DIR}/parameters/50.txt" "$SD50_DIR/parameters.txt"
fi

if [ ! -d ${SD50_DIR}/lama-cleaner ]; then
cd "${SD50_DIR}" && git clone https://github.com/Sanster/lama-cleaner
fi
#if [ ! -d ${SD50_DIR}/IOPaint ]; then
# cd "${SD50_DIR}" && git clone https://github.com/Sanster/IOPaint
#fi

cd ${SD50_DIR}/lama-cleaner
git config --global --add safe.directory ${SD50_DIR}/lama_cleaner
git pull -X ours
#cd ${SD50_DIR}/IOPaint
#git config --global --add safe.directory ${SD50_DIR}/lama_cleaner
#git pull -X ours

# chown -R diffusion:users ${BASE_DIR}

# if [ ! -d ${SD50_DIR}/venv ]; then
# su -w SD50_DIR - diffusion -c 'cd ${SD50_DIR} && python3 -m venv venv'
# fi

cd ${SD50_DIR}/lama-cleaner
pip install -r requirements.txt

CMD="python main.py"
cd ${SD50_DIR}/IOPaint
#pip install -r requirements.txt

pip3 install iopaint


CMD="iopaint start"
while IFS= read -r param; do
if [[ $param != \#* ]]; then
CMD+=" ${param}"
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ENV BASE_DIR=/config \
SD07_DIR=/config/07-StableSwarm \
SD08_DIR=/config/08-voltaML \
SD20_DIR=/config/20-kubin \
SD50_DIR=/config/50-lama-cleaner \
SD50_DIR=/config/50-IOPaint \
SD51_DIR=/config/51-facefusion \
SD70_DIR=/config/70-kohya \
XDG_CACHE_HOME=/config/temp
Expand All @@ -24,6 +24,7 @@ RUN apt-get update -y -q=2 && \
apt-get install -y -q=2 curl \
wget \
mc \
bc \
nano \
rsync \
libgl1-mesa-glx \
Expand Down
47 changes: 5 additions & 42 deletions entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,8 @@ if [ ! -f "$BASE_DIR/scripts/custom-sample.sh" ]; then
cp -v "/custom-sample.sh" "$BASE_DIR/scripts/custom-sample.sh"
fi

case $WEBUI_VERSION in
01)
. /01.sh
;;
02)
. /02.sh
;;
03)
. /03.sh
;;
04)
. /04.sh
;;
05)
. /05.sh
;;
06)
. /06.sh
;;
07)
. /07.sh
;;
08)
. /08.sh
;;
20)
. /20.sh
;;
50)
. /50.sh
;;
51)
. /51.sh
;;
70)
. /70.sh
;;
*)
. $BASE_DIR/scripts/$WEBUI_VERSION
echo error in webui selection variable
;;
esac
. /$WEBUI_VERSION.sh
. /$WEBUI_VERSION
. $BASE_DIR/scripts/$WEBUI_VERSION
. $BASE_DIR/scripts/$WEBUI_VERSION.sh
echo error in webui selection variable
16 changes: 16 additions & 0 deletions parameters/02.forge.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Web + Network
--listen
--port 9000

# options
--enable-insecure-extension-access
--xformers
--api
--cuda-malloc
--cuda-stream

#--no-half-vae
#--disable-nan-check
#--update-all-extensions
#--reinstall-xformers
#--reinstall-torch
2 changes: 1 addition & 1 deletion parameters/02.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
#--disable-nan-check
#--update-all-extensions
#--reinstall-xformers
#--reinstall-torch
#--reinstall-torch
9 changes: 4 additions & 5 deletions parameters/50.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
##### Web + Network #####
--host 0.0.0.0
--port 9000
--host=0.0.0.0
--port=9000

##### Directories #####
#--output-dir /config/outputs/50-Lama-Cleaner

##### Options #####
--device cuda
--enable-xformers
--device=cuda
--model=lama