From 97f4d596e3fd65b6d9cd60e1f05bc2eee517f91d Mon Sep 17 00:00:00 2001 From: nico Date: Sat, 16 Mar 2024 09:27:39 +0100 Subject: [PATCH 01/30] remove chown --- docker/root/etc/s6-overlay/s6-rc.d/init-chown/run | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/root/etc/s6-overlay/s6-rc.d/init-chown/run b/docker/root/etc/s6-overlay/s6-rc.d/init-chown/run index d932cef..0bd1d02 100755 --- a/docker/root/etc/s6-overlay/s6-rc.d/init-chown/run +++ b/docker/root/etc/s6-overlay/s6-rc.d/init-chown/run @@ -2,8 +2,8 @@ echo "-------------------------------------" # permissions -echo "chown'ing directory to ensure correct permissions." -chown -R abc:abc /home/abc -chown -R abc:abc /config -echo "Done!" +#echo "chown'ing directory to ensure correct permissions." +#chown -R abc:abc /home/abc +#chown -R abc:abc /config +#echo "Done!" echo -e "-------------------------------------\n" From 35c8179807427cffae3b7435a7b13e01c60c1507 Mon Sep 17 00:00:00 2001 From: nico Date: Sat, 16 Mar 2024 10:15:26 +0100 Subject: [PATCH 02/30] fix rights --- docker/root/etc/s6-overlay/s6-rc.d/init-chown/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/root/etc/s6-overlay/s6-rc.d/init-chown/run b/docker/root/etc/s6-overlay/s6-rc.d/init-chown/run index 0bd1d02..705c081 100755 --- a/docker/root/etc/s6-overlay/s6-rc.d/init-chown/run +++ b/docker/root/etc/s6-overlay/s6-rc.d/init-chown/run @@ -3,7 +3,7 @@ echo "-------------------------------------" # permissions #echo "chown'ing directory to ensure correct permissions." -#chown -R abc:abc /home/abc +chown -R abc:abc /home/abc #chown -R abc:abc /config #echo "Done!" echo -e "-------------------------------------\n" From 0608ae9135fa8b4771d0db3f65fb871bbdddcac7 Mon Sep 17 00:00:00 2001 From: nico Date: Sat, 23 Mar 2024 11:32:22 +0100 Subject: [PATCH 03/30] Change the way access rights are handled --- docker/root/etc/s6-overlay/s6-rc.d/init-chown/run | 3 +-- entry.sh | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/docker/root/etc/s6-overlay/s6-rc.d/init-chown/run b/docker/root/etc/s6-overlay/s6-rc.d/init-chown/run index 705c081..11fc379 100755 --- a/docker/root/etc/s6-overlay/s6-rc.d/init-chown/run +++ b/docker/root/etc/s6-overlay/s6-rc.d/init-chown/run @@ -2,8 +2,7 @@ echo "-------------------------------------" # permissions -#echo "chown'ing directory to ensure correct permissions." +#echo "chown'ing home directory to ensure correct permissions." chown -R abc:abc /home/abc -#chown -R abc:abc /config #echo "Done!" echo -e "-------------------------------------\n" diff --git a/entry.sh b/entry.sh index 5cd4093..8ac7de1 100644 --- a/entry.sh +++ b/entry.sh @@ -7,8 +7,21 @@ if [ ! -f "$BASE_DIR/scripts/custom-sample.sh" ]; then cp -v "/custom-sample.sh" "$BASE_DIR/scripts/custom-sample.sh" fi +# reset rights if file "Delete this file to reset access rights" isn't present +if [ ! -f "config/Delete this file to reset access rights" ]; then +echo "chown'ing directory to ensure correct permissions." +chown -R abc:users /config +chmod -R 774 /config +chmod -R 664 /config/models +chmod -R 664 /config/outputs +find /config -type d -exec chmod 777 {} + +echo Delete this file to reset access rights > "/config/Delete this file to reset access rights" +echo "Done!" +fi + + . /$WEBUI_VERSION.sh . /$WEBUI_VERSION . $BASE_DIR/scripts/$WEBUI_VERSION . $BASE_DIR/scripts/$WEBUI_VERSION.sh -echo error in webui selection variable \ No newline at end of file +echo error when launching WebUI \ No newline at end of file From 1aafd07e15537364d7c1e3413de2408a1d16fef7 Mon Sep 17 00:00:00 2001 From: nico Date: Sat, 23 Mar 2024 11:46:54 +0100 Subject: [PATCH 04/30] move access rights to the right place --- docker/root/etc/s6-overlay/s6-rc.d/init-chown/run | 12 ++++++++++++ entry.sh | 11 ----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/docker/root/etc/s6-overlay/s6-rc.d/init-chown/run b/docker/root/etc/s6-overlay/s6-rc.d/init-chown/run index 11fc379..ea78bf1 100755 --- a/docker/root/etc/s6-overlay/s6-rc.d/init-chown/run +++ b/docker/root/etc/s6-overlay/s6-rc.d/init-chown/run @@ -4,5 +4,17 @@ echo "-------------------------------------" # permissions #echo "chown'ing home directory to ensure correct permissions." chown -R abc:abc /home/abc + +if [ ! -f "$BASE_DIR/Delete this file to reset access rights" ]; then +echo "chown'ing directory to ensure correct permissions." +chown -R abc:users $BASE_DIR +chmod -R 774 $BASE_DIR +chmod -R 664 $BASE_DIR/models +chmod -R 664 $BASE_DIR/outputs +find $BASE_DIR -type d -exec chmod 777 {} + +echo Delete this file to reset access rights > $BASE_DIR/'Delete this file to reset access rights' +echo "Done!" +fi + #echo "Done!" echo -e "-------------------------------------\n" diff --git a/entry.sh b/entry.sh index 8ac7de1..8dffe3f 100644 --- a/entry.sh +++ b/entry.sh @@ -8,17 +8,6 @@ if [ ! -f "$BASE_DIR/scripts/custom-sample.sh" ]; then fi # reset rights if file "Delete this file to reset access rights" isn't present -if [ ! -f "config/Delete this file to reset access rights" ]; then -echo "chown'ing directory to ensure correct permissions." -chown -R abc:users /config -chmod -R 774 /config -chmod -R 664 /config/models -chmod -R 664 /config/outputs -find /config -type d -exec chmod 777 {} + -echo Delete this file to reset access rights > "/config/Delete this file to reset access rights" -echo "Done!" -fi - . /$WEBUI_VERSION.sh . /$WEBUI_VERSION From 2bfc58d5d5699f298ae50097e19f25b0b19acab6 Mon Sep 17 00:00:00 2001 From: nico Date: Sat, 23 Mar 2024 12:15:05 +0100 Subject: [PATCH 05/30] force update Fooocus --- 06.sh | 1 + docker/root/etc/s6-overlay/s6-rc.d/init-chown/run | 14 ++++++++------ entry.sh | 2 -- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/06.sh b/06.sh index efc1b8b..5e33cdd 100755 --- a/06.sh +++ b/06.sh @@ -24,6 +24,7 @@ if [ ! -d ${SD06_DIR}/Fooocus ]; then fi cd ${SD06_DIR}/Fooocus +git reset --hard HEAD git pull -X ours diff --git a/docker/root/etc/s6-overlay/s6-rc.d/init-chown/run b/docker/root/etc/s6-overlay/s6-rc.d/init-chown/run index ea78bf1..bb56287 100755 --- a/docker/root/etc/s6-overlay/s6-rc.d/init-chown/run +++ b/docker/root/etc/s6-overlay/s6-rc.d/init-chown/run @@ -1,20 +1,22 @@ #!/usr/bin/with-contenv bash -echo "-------------------------------------" +#echo "-------------------------------------" # permissions #echo "chown'ing home directory to ensure correct permissions." chown -R abc:abc /home/abc +#echo "Done!" +#echo -e "-------------------------------------\n" -if [ ! -f "$BASE_DIR/Delete this file to reset access rights" ]; then +# reset rights if file "Delete this file to reset access rights at next launch" isn't present +if [ ! -f "$BASE_DIR/Delete this file to reset access rights at next launch" ]; then +echo "-------------------------------------" echo "chown'ing directory to ensure correct permissions." chown -R abc:users $BASE_DIR chmod -R 774 $BASE_DIR chmod -R 664 $BASE_DIR/models chmod -R 664 $BASE_DIR/outputs find $BASE_DIR -type d -exec chmod 777 {} + -echo Delete this file to reset access rights > $BASE_DIR/'Delete this file to reset access rights' +echo Delete this file to reset access rights at next launch > $BASE_DIR/'Delete this file to reset access rights at next launch' echo "Done!" -fi - -#echo "Done!" echo -e "-------------------------------------\n" +fi \ No newline at end of file diff --git a/entry.sh b/entry.sh index 8dffe3f..5bc299d 100644 --- a/entry.sh +++ b/entry.sh @@ -7,8 +7,6 @@ if [ ! -f "$BASE_DIR/scripts/custom-sample.sh" ]; then cp -v "/custom-sample.sh" "$BASE_DIR/scripts/custom-sample.sh" fi -# reset rights if file "Delete this file to reset access rights" isn't present - . /$WEBUI_VERSION.sh . /$WEBUI_VERSION . $BASE_DIR/scripts/$WEBUI_VERSION From 8194fba5c7f34ac877905da27ddcd0ef78508bf3 Mon Sep 17 00:00:00 2001 From: nico Date: Sat, 23 Mar 2024 15:37:18 +0100 Subject: [PATCH 06/30] change clen venv method --- 06.sh | 3 +-- entry.sh | 8 ++++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/06.sh b/06.sh index 5e33cdd..7524c56 100755 --- a/06.sh +++ b/06.sh @@ -24,10 +24,9 @@ if [ ! -d ${SD06_DIR}/Fooocus ]; then fi cd ${SD06_DIR}/Fooocus -git reset --hard HEAD +#git reset --hard HEAD git pull -X ours - sl_folder ${SD06_DIR}/Fooocus/models checkpoints ${BASE_DIR}/models stable-diffusion sl_folder ${SD06_DIR}/Fooocus/models loras ${BASE_DIR}/models lora sl_folder ${SD06_DIR}/Fooocus/models vae ${BASE_DIR}/models vae diff --git a/entry.sh b/entry.sh index 5bc299d..6ae3aef 100644 --- a/entry.sh +++ b/entry.sh @@ -7,6 +7,14 @@ if [ ! -f "$BASE_DIR/scripts/custom-sample.sh" ]; then cp -v "/custom-sample.sh" "$BASE_DIR/scripts/custom-sample.sh" fi +# if file "Delete this file to clean virtual env and dependencies at next launch" isn't present +if [ -f "$BASE_DIR/Delete this file to clean virtual env and dependencies at next launch" ]; then +export active_clean=0 +else +export active_clean=1 +echo Delete this file to clean virtual env and dependencies at next launch > $BASE_DIR/'Delete this file to clean virtual env and dependencies at next launch' +fi + . /$WEBUI_VERSION.sh . /$WEBUI_VERSION . $BASE_DIR/scripts/$WEBUI_VERSION From 13c9f6d58f5fa8da11b1c7c14209f48deebe6af4 Mon Sep 17 00:00:00 2001 From: nico Date: Sat, 23 Mar 2024 16:01:18 +0100 Subject: [PATCH 07/30] update clean for 01/02/03 --- 01.sh | 10 ++++++++++ 02.forge.sh | 4 ++++ 02.sh | 4 ++++ 03.sh | 9 +++++++++ 4 files changed, 27 insertions(+) diff --git a/01.sh b/01.sh index 32f83a6..fb3f9d2 100755 --- a/01.sh +++ b/01.sh @@ -28,6 +28,16 @@ if [ ! -f "$SD01_DIR/config.yaml" ]; then cp -v "${SD_INSTALL_DIR}/parameters/01.txt" "$SD01_DIR/config.yaml" fi +#clean conda env +if [ "$active_clean" = "1" ]; then + echo "-------------------------------------" + echo "Cleaning venv" + rm -rf ${SD02_DIR}/installer_files + echo "Done!" + echo -e "-------------------------------------\n" +fi + + if [ ! -f "$SD01_DIR/start.sh" ]; then curl -L https://github.com/easydiffusion/easydiffusion/releases/download/v3.0.2/Easy-Diffusion-Linux.zip --output edui.zip unzip edui.zip diff --git a/02.forge.sh b/02.forge.sh index 1e51274..14994d4 100644 --- a/02.forge.sh +++ b/02.forge.sh @@ -41,10 +41,14 @@ fi #clean conda env if [ "$active_clean" = "1" ]; then + echo "-------------------------------------" + echo "Cleaning venv" 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 + echo "Done!" + echo -e "-------------------------------------\n" fi conda install -c conda-forge git python=3.11 pip gcc gxx libcurand --solver=libmamba -y diff --git a/02.sh b/02.sh index 35e1305..4fc8efb 100755 --- a/02.sh +++ b/02.sh @@ -41,10 +41,14 @@ fi #clean conda env if [ "$active_clean" = "1" ]; then + echo "-------------------------------------" + echo "Cleaning venv" 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 + echo "Done!" + echo -e "-------------------------------------\n" fi conda install -c conda-forge git python=3.11 pip gcc gxx libcurand --solver=libmamba -y diff --git a/03.sh b/03.sh index 3489e03..3ccd132 100755 --- a/03.sh +++ b/03.sh @@ -11,6 +11,15 @@ if [ ! -f "$SD03_DIR/parameters.txt" ]; then cp -v "${SD_INSTALL_DIR}/parameters/03.txt" "$SD03_DIR/parameters.txt" fi +#clean conda env +if [ "$active_clean" = "1" ]; then + echo "-------------------------------------" + echo "Cleaning venv" + rm -rf ${SD03_DIR}/env + echo "Done!" + echo -e "-------------------------------------\n" +fi + if [ ! -d ${SD03_DIR}/env ]; then conda create -p ${SD03_DIR}/env -y fi From fbbb7718c75b082e919b0f46d2cf142b93837b04 Mon Sep 17 00:00:00 2001 From: nico Date: Sat, 23 Mar 2024 17:22:41 +0100 Subject: [PATCH 08/30] update 01 installer --- 01.sh | 64 +++++++++++++++++++++++++++++++++++------------------- Dockerfile | 2 +- 2 files changed, 43 insertions(+), 23 deletions(-) diff --git a/01.sh b/01.sh index fb3f9d2..b4cc488 100755 --- a/01.sh +++ b/01.sh @@ -3,50 +3,70 @@ source /sl_folder.sh SD01_DIR="${BASE_DIR}/01-easy-diffusion" -mkdir -p ${SD01_DIR}/{models,version,plugins/ui,scripts} +#check if old install then move files +if [ -f "$SD01_DIR/start.sh" ]; then + mv ${SD01_DIR} ${BASE_DIR}/easy-diffusion + ${BASE_DIR}/easy-diffusion ${SD01_DIR}/easy-diffusion +fi + +#Create Conda Env +if [ ! -d ${SD01_DIR}/conda-env ]; then + conda create -p ${SD01_DIR}/conda-env -y +fi + +#create 'models' folders +mkdir -p ${SD01_DIR}/easy-diffusion/{models,version,plugins/ui,scripts} cd ${SD01_DIR} -if [ ! -f ${SD01_DIR}/plugins/ui/plugin-manager.plugin.js ]; then - mkdir -p ${SD01_DIR}/plugins/ui/ - curl -L https://raw.githubusercontent.com/patriceac/Easy-Diffusion-Plugins/main/plugin-manager.plugin.js --output ${SD01_DIR}/plugins/ui/plugin-manager.plugin.js +#install manager plugin +if [ ! -f ${SD01_DIR}/easy-diffusion/plugins/ui/plugin-manager.plugin.js ]; then + mkdir -p ${SD01_DIR}/easy-diffusion/plugins/ui/ + curl -L https://raw.githubusercontent.com/patriceac/Easy-Diffusion-Plugins/main/plugin-manager.plugin.js --output ${SD01_DIR}/easy-diffusion/plugins/ui/plugin-manager.plugin.js fi # Merge Models, vae, lora, hypernetworks, etc. -sl_folder ${SD01_DIR}/models stable-diffusion ${BASE_DIR}/models stable-diffusion -sl_folder ${SD01_DIR}/models hypernetwork ${BASE_DIR}/models hypernetwork -sl_folder ${SD01_DIR}/models lora ${BASE_DIR}/models lora -sl_folder ${SD01_DIR}/models vae ${BASE_DIR}/models vae -sl_folder ${SD01_DIR}/models controlnet ${BASE_DIR}/models controlnet -sl_folder ${SD01_DIR}/models realesrgan ${BASE_DIR}/models upscale -sl_folder ${SD01_DIR}/models codeformer ${BASE_DIR}/models codeformer -sl_folder ${SD01_DIR}/models embeddings ${BASE_DIR}/models embeddings -sl_folder ${SD01_DIR}/models gfpgan ${BASE_DIR}/models gfpgan +sl_folder ${SD01_DIR}/easy-diffusion/models stable-diffusion ${BASE_DIR}/models stable-diffusion +sl_folder ${SD01_DIR}/easy-diffusion/models hypernetwork ${BASE_DIR}/models hypernetwork +sl_folder ${SD01_DIR}/easy-diffusion/models lora ${BASE_DIR}/models lora +sl_folder ${SD01_DIR}/easy-diffusion/models vae ${BASE_DIR}/models vae +sl_folder ${SD01_DIR}/easy-diffusion/models controlnet ${BASE_DIR}/models controlnet +sl_folder ${SD01_DIR}/easy-diffusion/models realesrgan ${BASE_DIR}/models upscale +sl_folder ${SD01_DIR}/easy-diffusion/models codeformer ${BASE_DIR}/models codeformer +sl_folder ${SD01_DIR}/easy-diffusion/models embeddings ${BASE_DIR}/models embeddings +sl_folder ${SD01_DIR}/easy-diffusion/models gfpgan ${BASE_DIR}/models gfpgan sl_folder ${HOME} "Stable Diffusion UI" ${BASE_DIR}/outputs 01-Easy-Diffusion -if [ ! -f "$SD01_DIR/config.yaml" ]; then - cp -v "${SD_INSTALL_DIR}/parameters/01.txt" "$SD01_DIR/config.yaml" +#copy default parameters if they don't exists +if [ ! -f "$SD01_DIR/easy-diffusion/config.yaml" ]; then + cp -v "${SD_INSTALL_DIR}/parameters/01.txt" "$SD01_DIR/easy-diffusion/config.yaml" fi #clean conda env if [ "$active_clean" = "1" ]; then echo "-------------------------------------" echo "Cleaning venv" - rm -rf ${SD02_DIR}/installer_files + conda deactivate + conda remove -p ${SD01_DIR}/conda-env --all -y + conda create -p ${SD01_DIR}/conda-env -y echo "Done!" echo -e "-------------------------------------\n" fi +#active env and install git + python +source activate ${SD01_DIR}/conda-env +conda install -n base conda-libmamba-solver -y +conda install -c git python=3.11 pip --solver=libmamba -y -if [ ! -f "$SD01_DIR/start.sh" ]; then +#download installer if it isn't present +if [ ! -f "$SD01_DIR/easy-diffusion/start.sh" ]; then curl -L https://github.com/easydiffusion/easydiffusion/releases/download/v3.0.2/Easy-Diffusion-Linux.zip --output edui.zip unzip edui.zip - cp -rf easy-diffusion/* . - rm -rf easy-diffusion +# cp -rf easy-diffusion/* . +# rm -rf easy-diffusion rm -f edui.zip fi -#chown -R diffusion:users ${BASE_DIR} - -cd $SD01_DIR +#run easy-diffusion +cd $SD01_DIR/easy-diffusion bash start.sh diff --git a/Dockerfile b/Dockerfile index d2b7f99..4d027f1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ ENV DEBIAN_FRONTEND=noninteractive ENV WEBUI_VERSION=01 ENV BASE_DIR=/config \ SD_INSTALL_DIR=/opt/sd-install \ - SD01_DIR=/config/01-easy-diffusion \ +# SD01_DIR=/config/01-easy-diffusion \ SD02_DIR=/config/02-sd-webui \ SD03_DIR=/config/03-invokeai \ SD04_DIR=/config/04-SD-Next \ From e569e94fcee654d2b8f41eac2fb467a8f99e3e05 Mon Sep 17 00:00:00 2001 From: nico Date: Sat, 23 Mar 2024 23:25:45 +0100 Subject: [PATCH 09/30] fix move of old 01 install --- 01.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/01.sh b/01.sh index b4cc488..be1eeb9 100755 --- a/01.sh +++ b/01.sh @@ -6,7 +6,7 @@ SD01_DIR="${BASE_DIR}/01-easy-diffusion" #check if old install then move files if [ -f "$SD01_DIR/start.sh" ]; then mv ${SD01_DIR} ${BASE_DIR}/easy-diffusion - ${BASE_DIR}/easy-diffusion ${SD01_DIR}/easy-diffusion + mv ${BASE_DIR}/easy-diffusion ${SD01_DIR}/easy-diffusion fi #Create Conda Env From e8abb39972f89a81e739a1ae686a3c229c6ce7fb Mon Sep 17 00:00:00 2001 From: nico Date: Sat, 23 Mar 2024 23:35:30 +0100 Subject: [PATCH 10/30] fix 01 conda --- 01.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/01.sh b/01.sh index be1eeb9..5f6f57e 100755 --- a/01.sh +++ b/01.sh @@ -1,11 +1,15 @@ #!/bin/bash source /sl_folder.sh +export PATH="/home/abc/miniconda3/bin:$PATH" +export active_clean=0 + SD01_DIR="${BASE_DIR}/01-easy-diffusion" #check if old install then move files if [ -f "$SD01_DIR/start.sh" ]; then mv ${SD01_DIR} ${BASE_DIR}/easy-diffusion + mkdir -p ${SD01_DIR} mv ${BASE_DIR}/easy-diffusion ${SD01_DIR}/easy-diffusion fi From ea474a7d79cdb5319cec7e4fdb3dbfe8e69e0fc9 Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 24 Mar 2024 00:05:34 +0100 Subject: [PATCH 11/30] clean install scripts --- 01.sh | 6 +++--- 02.forge.sh | 14 ++++++++------ 02.sh | 18 +++++++++++------- 03.sh | 8 +++++--- Dockerfile | 32 ++++++++++++++++---------------- 5 files changed, 43 insertions(+), 35 deletions(-) diff --git a/01.sh b/01.sh index 5f6f57e..772adca 100755 --- a/01.sh +++ b/01.sh @@ -4,8 +4,6 @@ source /sl_folder.sh export PATH="/home/abc/miniconda3/bin:$PATH" export active_clean=0 -SD01_DIR="${BASE_DIR}/01-easy-diffusion" - #check if old install then move files if [ -f "$SD01_DIR/start.sh" ]; then mv ${SD01_DIR} ${BASE_DIR}/easy-diffusion @@ -43,8 +41,10 @@ sl_folder ${HOME} "Stable Diffusion UI" ${BASE_DIR}/outputs 01-Easy-Diffusion #copy default parameters if they don't exists if [ ! -f "$SD01_DIR/easy-diffusion/config.yaml" ]; then - cp -v "${SD_INSTALL_DIR}/parameters/01.txt" "$SD01_DIR/easy-diffusion/config.yaml" + cp -v "${SD_INSTALL_DIR}/parameters/01.txt" "$SD01_DIR/parameters.txt" fi +#apply parameters +cp -v "${SD01_DIR}/parameters.txt" "$SD01_DIR/easy-diffusion/config.yaml" #clean conda env if [ "$active_clean" = "1" ]; then diff --git a/02.forge.sh b/02.forge.sh index 14994d4..c3b398c 100644 --- a/02.forge.sh +++ b/02.forge.sh @@ -10,14 +10,11 @@ export venv_dir="-" # Install or update Stable-Diffusion-WebUI mkdir -p ${SD02_DIR} +# Create Conda virtual env 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 @@ -46,16 +43,20 @@ 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 echo "Done!" echo -e "-------------------------------------\n" fi -conda install -c conda-forge git python=3.11 pip gcc gxx libcurand --solver=libmamba -y + +#activate conda env + install base tools +source activate ${SD02_DIR}/conda-env +conda install -n base conda-libmamba-solver -y +conda install -c conda-forge 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 +#install dependencies pip install --upgrade pip pip install coloredlogs flatbuffers numpy packaging protobuf==3.20.3 sympy pip install packaging @@ -81,6 +82,7 @@ sl_folder ${SD02_DIR}/forge/models ControlNet ${BASE_DIR}/models controlnet sl_folder ${SD02_DIR}/forge output ${BASE_DIR}/outputs 02-sd-webui +# Run webUI echo "Run Stable-Diffusion-WebUI-forge" cd ${SD02_DIR}/forge CMD="bash webui.sh" diff --git a/02.sh b/02.sh index 4fc8efb..40ce372 100755 --- a/02.sh +++ b/02.sh @@ -10,16 +10,14 @@ export venv_dir="-" # Install or update Stable-Diffusion-WebUI mkdir -p ${SD02_DIR} +# create conda env if needed 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 - +# clone repository if [ ! -d ${SD02_DIR}/webui ]; then - git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui ${SD02_DIR}/webui + git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git ${SD02_DIR}/webui fi cd ${SD02_DIR}/webui @@ -46,16 +44,21 @@ 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 echo "Done!" echo -e "-------------------------------------\n" fi -conda install -c conda-forge git python=3.11 pip gcc gxx libcurand --solver=libmamba -y +# activate conda env and install base tools +source activate ${SD02_DIR}/conda-env +conda install -n base conda-libmamba-solver -y +conda install -c conda-forge python=3.11 pip gcc gxx libcurand --solver=libmamba -y + +#copy default parameters if absent if [ ! -f "$SD02_DIR/parameters.txt" ]; then cp -v "/opt/sd-install/parameters/02.txt" "$SD02_DIR/parameters.txt" fi +# install dependencies pip install --upgrade pip pip install coloredlogs flatbuffers numpy packaging protobuf==3.20.3 sympy pip install packaging @@ -82,6 +85,7 @@ sl_folder ${SD02_DIR}/webui/models ControlNet ${BASE_DIR}/models controlnet sl_folder ${SD02_DIR}/webui outputs ${BASE_DIR}/outputs 02-sd-webui +# run webUI echo "Run Stable-Diffusion-WebUI" cd ${SD02_DIR}/webui CMD="bash webui.sh" diff --git a/03.sh b/03.sh index 3ccd132..7a282ab 100755 --- a/03.sh +++ b/03.sh @@ -7,6 +7,7 @@ export use_venv=0 mkdir -p "$SD03_DIR" mkdir -p /config/outputs/03-InvokeAI +# copy default parameters if absent if [ ! -f "$SD03_DIR/parameters.txt" ]; then cp -v "${SD_INSTALL_DIR}/parameters/03.txt" "$SD03_DIR/parameters.txt" fi @@ -20,13 +21,15 @@ if [ "$active_clean" = "1" ]; then echo -e "-------------------------------------\n" fi +# create conda env if absent if [ ! -d ${SD03_DIR}/env ]; then conda create -p ${SD03_DIR}/env -y fi +# activate conda env and install basic tools source activate ${SD03_DIR}/env conda install -n base conda-libmamba-solver -y -conda install -c conda-forge git python=3.10 --solver=libmamba -y +conda install -c conda-forge python=3.10 --solver=libmamba -y cd ${SD03_DIR} @@ -40,8 +43,7 @@ fi pip install --use-pep517 --upgrade InvokeAI invokeai-configure --yes --root ${SD03_DIR}/invokeai --skip-sd-weights -# pip install ruamel.yaml==0.17.40 pillow==10.0.1 pypatchmatch - +# launch WebUI CMD="invokeai-web" while IFS= read -r param; do if [[ $param != \#* ]]; then diff --git a/Dockerfile b/Dockerfile index 4d027f1..ea208e3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,19 +6,19 @@ ENV DEBIAN_FRONTEND=noninteractive ENV WEBUI_VERSION=01 ENV BASE_DIR=/config \ SD_INSTALL_DIR=/opt/sd-install \ -# SD01_DIR=/config/01-easy-diffusion \ - SD02_DIR=/config/02-sd-webui \ - SD03_DIR=/config/03-invokeai \ - SD04_DIR=/config/04-SD-Next \ - SD05_DIR=/config/05-comfy-ui \ - SD06_DIR=/config/06-Fooocus \ - SD07_DIR=/config/07-StableSwarm \ - SD08_DIR=/config/08-voltaML \ - SD20_DIR=/config/20-kubin \ - SD50_DIR=/config/50-IOPaint \ - SD51_DIR=/config/51-facefusion \ - SD70_DIR=/config/70-kohya \ - XDG_CACHE_HOME=/config/temp + SD01_DIR=${BASE_DIR}/01-easy-diffusion \ + SD02_DIR=${BASE_DIR}/02-sd-webui \ + SD03_DIR=${BASE_DIR}/03-invokeai \ + SD04_DIR=${BASE_DIR}/04-SD-Next \ + SD05_DIR=${BASE_DIR}/05-comfy-ui \ + SD06_DIR=${BASE_DIR}/06-Fooocus \ + SD07_DIR=${BASE_DIR}/07-StableSwarm \ + SD08_DIR=${BASE_DIR}/08-voltaML \ + SD20_DIR=${BASE_DIR}/20-kubin \ + SD50_DIR=${BASE_DIR}/50-IOPaint \ + SD51_DIR=${BASE_DIR}/51-facefusion \ + SD70_DIR=${BASE_DIR}/70-kohya \ + XDG_CACHE_HOME=${BASE_DIR}/temp RUN apt-get update -y -q=2 && \ apt-get install -y -q=2 curl \ @@ -39,9 +39,9 @@ RUN apt-get update -y -q=2 && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -RUN mkdir -p ${BASE_DIR}\temp ${SD_INSTALL_DIR} /config/outputs +RUN mkdir -p ${BASE_DIR}\temp ${SD_INSTALL_DIR} ${BASE_DIR}/outputs -ADD parameters/* /opt/sd-install/parameters/ +ADD parameters/* ${SD_INSTALL_DIR}/parameters/ COPY --chown=abc:abc *.sh ./ @@ -57,7 +57,7 @@ RUN cd /tmp && \ bash Miniconda3-latest-Linux-x86_64.sh -b && \ rm Miniconda3-latest-Linux-x86_64.sh && \ chown -R abc:abc /root && \ - chown -R abc:abc /opt/sd-install + chown -R abc:abc ${SD_INSTALL_DIR} EXPOSE 9000/tcp From b67c3ea611dbacdd3a878d9660fca4865eac26d8 Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 24 Mar 2024 00:25:09 +0100 Subject: [PATCH 12/30] fix 01 install+clean --- 01.sh | 48 ++++++++++++++++++++---------------------------- 03.sh | 1 + 2 files changed, 21 insertions(+), 28 deletions(-) diff --git a/01.sh b/01.sh index 772adca..04d5220 100755 --- a/01.sh +++ b/01.sh @@ -4,47 +4,38 @@ source /sl_folder.sh export PATH="/home/abc/miniconda3/bin:$PATH" export active_clean=0 -#check if old install then move files -if [ -f "$SD01_DIR/start.sh" ]; then - mv ${SD01_DIR} ${BASE_DIR}/easy-diffusion - mkdir -p ${SD01_DIR} - mv ${BASE_DIR}/easy-diffusion ${SD01_DIR}/easy-diffusion -fi - #Create Conda Env if [ ! -d ${SD01_DIR}/conda-env ]; then conda create -p ${SD01_DIR}/conda-env -y fi #create 'models' folders -mkdir -p ${SD01_DIR}/easy-diffusion/{models,version,plugins/ui,scripts} +mkdir -p ${SD01_DIR}/{models,version,plugins/ui,scripts} cd ${SD01_DIR} #install manager plugin -if [ ! -f ${SD01_DIR}/easy-diffusion/plugins/ui/plugin-manager.plugin.js ]; then - mkdir -p ${SD01_DIR}/easy-diffusion/plugins/ui/ - curl -L https://raw.githubusercontent.com/patriceac/Easy-Diffusion-Plugins/main/plugin-manager.plugin.js --output ${SD01_DIR}/easy-diffusion/plugins/ui/plugin-manager.plugin.js +if [ ! -f ${SD01_DIR}/plugins/ui/plugin-manager.plugin.js ]; then + mkdir -p ${SD01_DIR}/plugins/ui/ + curl -L https://raw.githubusercontent.com/patriceac/Easy-Diffusion-Plugins/main/plugin-manager.plugin.js --output ${SD01_DIR}/plugins/ui/plugin-manager.plugin.js fi # Merge Models, vae, lora, hypernetworks, etc. -sl_folder ${SD01_DIR}/easy-diffusion/models stable-diffusion ${BASE_DIR}/models stable-diffusion -sl_folder ${SD01_DIR}/easy-diffusion/models hypernetwork ${BASE_DIR}/models hypernetwork -sl_folder ${SD01_DIR}/easy-diffusion/models lora ${BASE_DIR}/models lora -sl_folder ${SD01_DIR}/easy-diffusion/models vae ${BASE_DIR}/models vae -sl_folder ${SD01_DIR}/easy-diffusion/models controlnet ${BASE_DIR}/models controlnet -sl_folder ${SD01_DIR}/easy-diffusion/models realesrgan ${BASE_DIR}/models upscale -sl_folder ${SD01_DIR}/easy-diffusion/models codeformer ${BASE_DIR}/models codeformer -sl_folder ${SD01_DIR}/easy-diffusion/models embeddings ${BASE_DIR}/models embeddings -sl_folder ${SD01_DIR}/easy-diffusion/models gfpgan ${BASE_DIR}/models gfpgan +sl_folder ${SD01_DIR}/models stable-diffusion ${BASE_DIR}/models stable-diffusion +sl_folder ${SD01_DIR}/models hypernetwork ${BASE_DIR}/models hypernetwork +sl_folder ${SD01_DIR}/models lora ${BASE_DIR}/models lora +sl_folder ${SD01_DIR}/models vae ${BASE_DIR}/models vae +sl_folder ${SD01_DIR}/models controlnet ${BASE_DIR}/models controlnet +sl_folder ${SD01_DIR}/models realesrgan ${BASE_DIR}/models upscale +sl_folder ${SD01_DIR}/models codeformer ${BASE_DIR}/models codeformer +sl_folder ${SD01_DIR}/models embeddings ${BASE_DIR}/models embeddings +sl_folder ${SD01_DIR}/models gfpgan ${BASE_DIR}/models gfpgan sl_folder ${HOME} "Stable Diffusion UI" ${BASE_DIR}/outputs 01-Easy-Diffusion #copy default parameters if they don't exists -if [ ! -f "$SD01_DIR/easy-diffusion/config.yaml" ]; then - cp -v "${SD_INSTALL_DIR}/parameters/01.txt" "$SD01_DIR/parameters.txt" +if [ ! -f "$SD01_DIR/config.yaml" ]; then + cp -v "${SD_INSTALL_DIR}/parameters/01.txt" "$SD01_DIR/config.yaml" fi -#apply parameters -cp -v "${SD01_DIR}/parameters.txt" "$SD01_DIR/easy-diffusion/config.yaml" #clean conda env if [ "$active_clean" = "1" ]; then @@ -53,6 +44,7 @@ if [ "$active_clean" = "1" ]; then conda deactivate conda remove -p ${SD01_DIR}/conda-env --all -y conda create -p ${SD01_DIR}/conda-env -y + rm -rf ${SD01_DIR}/installer_files echo "Done!" echo -e "-------------------------------------\n" fi @@ -63,14 +55,14 @@ conda install -n base conda-libmamba-solver -y conda install -c git python=3.11 pip --solver=libmamba -y #download installer if it isn't present -if [ ! -f "$SD01_DIR/easy-diffusion/start.sh" ]; then +if [ ! -f "$SD01_DIR/start.sh" ]; then curl -L https://github.com/easydiffusion/easydiffusion/releases/download/v3.0.2/Easy-Diffusion-Linux.zip --output edui.zip unzip edui.zip -# cp -rf easy-diffusion/* . -# rm -rf easy-diffusion + cp -rf easy-diffusion/* . + rm -rf easy-diffusion rm -f edui.zip fi #run easy-diffusion -cd $SD01_DIR/easy-diffusion +cd $SD01_DIR bash start.sh diff --git a/03.sh b/03.sh index 7a282ab..d1383a0 100755 --- a/03.sh +++ b/03.sh @@ -3,6 +3,7 @@ source /sl_folder.sh export PATH="/home/abc/miniconda3/bin:$PATH" export use_venv=0 +export active_clean=0 mkdir -p "$SD03_DIR" mkdir -p /config/outputs/03-InvokeAI From f3783a901db028b764cf25de3629b3a19ed4bc35 Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 24 Mar 2024 00:36:23 +0100 Subject: [PATCH 13/30] fix temp path --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ea208e3..d051505 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,7 @@ ENV BASE_DIR=/config \ SD50_DIR=${BASE_DIR}/50-IOPaint \ SD51_DIR=${BASE_DIR}/51-facefusion \ SD70_DIR=${BASE_DIR}/70-kohya \ - XDG_CACHE_HOME=${BASE_DIR}/temp + XDG_CACHE_HOME=/config/temp RUN apt-get update -y -q=2 && \ apt-get install -y -q=2 curl \ From fb1a3076c7fc1e3f6e29883f94e14eed47b8af8b Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 24 Mar 2024 01:01:29 +0100 Subject: [PATCH 14/30] fix env --- 01.sh | 2 +- Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/01.sh b/01.sh index 04d5220..5840d56 100755 --- a/01.sh +++ b/01.sh @@ -3,6 +3,7 @@ source /sl_folder.sh export PATH="/home/abc/miniconda3/bin:$PATH" export active_clean=0 +export SD01_DIR=${BASE_DIR}/01-easy-diffusion #Create Conda Env if [ ! -d ${SD01_DIR}/conda-env ]; then @@ -15,7 +16,6 @@ cd ${SD01_DIR} #install manager plugin if [ ! -f ${SD01_DIR}/plugins/ui/plugin-manager.plugin.js ]; then - mkdir -p ${SD01_DIR}/plugins/ui/ curl -L https://raw.githubusercontent.com/patriceac/Easy-Diffusion-Plugins/main/plugin-manager.plugin.js --output ${SD01_DIR}/plugins/ui/plugin-manager.plugin.js fi diff --git a/Dockerfile b/Dockerfile index d051505..1ff058d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ ENV DEBIAN_FRONTEND=noninteractive ENV WEBUI_VERSION=01 ENV BASE_DIR=/config \ SD_INSTALL_DIR=/opt/sd-install \ - SD01_DIR=${BASE_DIR}/01-easy-diffusion \ +# SD01_DIR=${BASE_DIR}/01-easy-diffusion \ SD02_DIR=${BASE_DIR}/02-sd-webui \ SD03_DIR=${BASE_DIR}/03-invokeai \ SD04_DIR=${BASE_DIR}/04-SD-Next \ From a4fc10a06a2d842ecc053c0ae72afb7a1f554209 Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 24 Mar 2024 01:42:12 +0100 Subject: [PATCH 15/30] fix clean venv --- 01.sh | 36 ++++++++++++++++++------------------ 02.forge.sh | 2 +- 02.sh | 2 +- 03.sh | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/01.sh b/01.sh index 5840d56..2959001 100755 --- a/01.sh +++ b/01.sh @@ -2,14 +2,31 @@ source /sl_folder.sh export PATH="/home/abc/miniconda3/bin:$PATH" -export active_clean=0 export SD01_DIR=${BASE_DIR}/01-easy-diffusion +#clean conda env +if [ "$active_clean" = "1" ]; then + echo "-------------------------------------" + echo "Cleaning venv" + conda deactivate + conda remove -p ${SD01_DIR}/conda-env --all -y + conda create -p ${SD01_DIR}/conda-env -y + rm -rf ${SD01_DIR}/installer_files + export active_clean=0 + echo "Done!" + echo -e "-------------------------------------\n" +fi + #Create Conda Env if [ ! -d ${SD01_DIR}/conda-env ]; then conda create -p ${SD01_DIR}/conda-env -y fi +#active env and install python +source activate ${SD01_DIR}/conda-env +conda install -n base conda-libmamba-solver -y +conda install -c python=3.11 pip --solver=libmamba -y + #create 'models' folders mkdir -p ${SD01_DIR}/{models,version,plugins/ui,scripts} cd ${SD01_DIR} @@ -37,23 +54,6 @@ if [ ! -f "$SD01_DIR/config.yaml" ]; then cp -v "${SD_INSTALL_DIR}/parameters/01.txt" "$SD01_DIR/config.yaml" fi -#clean conda env -if [ "$active_clean" = "1" ]; then - echo "-------------------------------------" - echo "Cleaning venv" - conda deactivate - conda remove -p ${SD01_DIR}/conda-env --all -y - conda create -p ${SD01_DIR}/conda-env -y - rm -rf ${SD01_DIR}/installer_files - echo "Done!" - echo -e "-------------------------------------\n" -fi - -#active env and install git + python -source activate ${SD01_DIR}/conda-env -conda install -n base conda-libmamba-solver -y -conda install -c git python=3.11 pip --solver=libmamba -y - #download installer if it isn't present if [ ! -f "$SD01_DIR/start.sh" ]; then curl -L https://github.com/easydiffusion/easydiffusion/releases/download/v3.0.2/Easy-Diffusion-Linux.zip --output edui.zip diff --git a/02.forge.sh b/02.forge.sh index c3b398c..a5d68ed 100644 --- a/02.forge.sh +++ b/02.forge.sh @@ -2,7 +2,6 @@ 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="-" @@ -43,6 +42,7 @@ if [ "$active_clean" = "1" ]; then conda deactivate conda remove -p ${SD02_DIR}/conda-env --all -y conda create -p ${SD02_DIR}/conda-env -y + export active_clean=0 echo "Done!" echo -e "-------------------------------------\n" fi diff --git a/02.sh b/02.sh index 40ce372..491431a 100755 --- a/02.sh +++ b/02.sh @@ -2,7 +2,6 @@ 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="-" @@ -44,6 +43,7 @@ if [ "$active_clean" = "1" ]; then conda deactivate conda remove -p ${SD02_DIR}/conda-env --all -y conda create -p ${SD02_DIR}/conda-env -y + export active_clean=0 echo "Done!" echo -e "-------------------------------------\n" fi diff --git a/03.sh b/03.sh index d1383a0..2f89d9b 100755 --- a/03.sh +++ b/03.sh @@ -3,7 +3,6 @@ source /sl_folder.sh export PATH="/home/abc/miniconda3/bin:$PATH" export use_venv=0 -export active_clean=0 mkdir -p "$SD03_DIR" mkdir -p /config/outputs/03-InvokeAI @@ -18,6 +17,7 @@ if [ "$active_clean" = "1" ]; then echo "-------------------------------------" echo "Cleaning venv" rm -rf ${SD03_DIR}/env + export active_clean=0 echo "Done!" echo -e "-------------------------------------\n" fi From 4f8f8a2d8c546e035e8fecea0f329bf53709924a Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 24 Mar 2024 01:59:39 +0100 Subject: [PATCH 16/30] fix clean 01 --- 01.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/01.sh b/01.sh index 2959001..94643b3 100755 --- a/01.sh +++ b/01.sh @@ -8,9 +8,7 @@ export SD01_DIR=${BASE_DIR}/01-easy-diffusion if [ "$active_clean" = "1" ]; then echo "-------------------------------------" echo "Cleaning venv" - conda deactivate - conda remove -p ${SD01_DIR}/conda-env --all -y - conda create -p ${SD01_DIR}/conda-env -y + rm -rf ${SD01_DIR}/conda-env rm -rf ${SD01_DIR}/installer_files export active_clean=0 echo "Done!" From e75fbb0f5ab3b88de8751aaf142ff228562d6fd6 Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 24 Mar 2024 02:26:12 +0100 Subject: [PATCH 17/30] move dir variable export to individual scripts --- 02.forge.sh | 1 + 02.sh | 1 + 03.sh | 1 + 04.sh | 1 + 05.sh | 1 + 06.sh | 1 + 07.sh | 1 + 08.sh | 1 + 20.sh | 1 + 50.sh | 1 + 51.sh | 1 + 70.sh | 1 + Dockerfile | 12 ------------ 13 files changed, 12 insertions(+), 12 deletions(-) diff --git a/02.forge.sh b/02.forge.sh index a5d68ed..10c070b 100644 --- a/02.forge.sh +++ b/02.forge.sh @@ -2,6 +2,7 @@ source /sl_folder.sh export PATH="/home/abc/miniconda3/bin:$PATH" +export SD02_DIR=${BASE_DIR}/02-sd-webui # disable the use of a python venv export venv_dir="-" diff --git a/02.sh b/02.sh index 491431a..cc904a8 100755 --- a/02.sh +++ b/02.sh @@ -2,6 +2,7 @@ source /sl_folder.sh export PATH="/home/abc/miniconda3/bin:$PATH" +export SD02_DIR=${BASE_DIR}/02-sd-webui # disable the use of a python venv export venv_dir="-" diff --git a/03.sh b/03.sh index 2f89d9b..e8262bd 100755 --- a/03.sh +++ b/03.sh @@ -3,6 +3,7 @@ source /sl_folder.sh export PATH="/home/abc/miniconda3/bin:$PATH" export use_venv=0 +export SD03_DIR=${BASE_DIR}/03-invokeai mkdir -p "$SD03_DIR" mkdir -p /config/outputs/03-InvokeAI diff --git a/04.sh b/04.sh index 537a995..b6bc664 100755 --- a/04.sh +++ b/04.sh @@ -3,6 +3,7 @@ source /sl_folder.sh export PATH="/home/abc/miniconda3/bin:$PATH" export use_venv=1 +export SD04_DIR=${BASE_DIR}/04-SD-Next echo "Install and run SD-Next" diff --git a/05.sh b/05.sh index 03c47a0..2732ae0 100755 --- a/05.sh +++ b/05.sh @@ -2,6 +2,7 @@ source /sl_folder.sh export PATH="/home/abc/miniconda3/bin:$PATH" +export SD05_DIR=${BASE_DIR}/05-comfy-ui echo "Install and run Comfy-UI" mkdir -p ${SD05_DIR} diff --git a/06.sh b/06.sh index 7524c56..613f32d 100755 --- a/06.sh +++ b/06.sh @@ -2,6 +2,7 @@ source /sl_folder.sh export PATH="/home/abc/miniconda3/bin:$PATH" +export SD06_DIR=${BASE_DIR}/06-Fooocus mkdir -p ${SD06_DIR} mkdir -p $BASE_DIR/outputs/06-Fooocus diff --git a/07.sh b/07.sh index 701d99d..27b37f8 100755 --- a/07.sh +++ b/07.sh @@ -2,6 +2,7 @@ source /sl_folder.sh export PATH="/home/abc/miniconda3/bin:$PATH" +export SD07_DIR=${BASE_DIR}/07-StableSwarm mkdir -p ${SD07_DIR} mkdir -p /config/outputs/07-StableSwarm diff --git a/08.sh b/08.sh index 5076871..2b2ffaf 100755 --- a/08.sh +++ b/08.sh @@ -2,6 +2,7 @@ source /sl_folder.sh export PATH="/home/abc/miniconda3/bin:$PATH" +export SD08_DIR=${BASE_DIR}/08-voltaML mkdir -p ${SD08_DIR} mkdir -p /config/outputs/08-voltaML diff --git a/20.sh b/20.sh index ffff9dc..aedd102 100755 --- a/20.sh +++ b/20.sh @@ -3,6 +3,7 @@ source /sl_folder.sh export PATH="/home/abc/miniconda3/bin:$PATH" +export SD20_DIR=${BASE_DIR}/20-kubin mkdir -p "${SD20_DIR}" mkdir -p /config/outputs/20-kubin diff --git a/50.sh b/50.sh index 5d834c6..7c02b99 100755 --- a/50.sh +++ b/50.sh @@ -2,6 +2,7 @@ source /sl_folder.sh export PATH="/home/abc/miniconda3/bin:$PATH" +export SD50_DIR=${BASE_DIR}/50-IOPaint mkdir -p "${SD50_DIR}/IOPaint" mkdir -p /config/outputs/50-IOPaint diff --git a/51.sh b/51.sh index 95e0a0a..3a5f8a4 100755 --- a/51.sh +++ b/51.sh @@ -2,6 +2,7 @@ source /sl_folder.sh export PATH="/home/abc/miniconda3/bin:$PATH" +export SD51_DIR=${BASE_DIR}/51-facefusion mkdir -p ${SD51_DIR} mkdir -p /config/outputs/51-facefusion diff --git a/70.sh b/70.sh index f373cdd..6ab7016 100755 --- a/70.sh +++ b/70.sh @@ -2,6 +2,7 @@ source /sl_folder.sh export PATH="/home/abc/miniconda3/bin:$PATH" +export SD70_DIR=${BASE_DIR}/70-kohya mkdir -p ${SD70_DIR} mkdir -p /config/outputs/70-kohya diff --git a/Dockerfile b/Dockerfile index 1ff058d..02edaec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,18 +6,6 @@ ENV DEBIAN_FRONTEND=noninteractive ENV WEBUI_VERSION=01 ENV BASE_DIR=/config \ SD_INSTALL_DIR=/opt/sd-install \ -# SD01_DIR=${BASE_DIR}/01-easy-diffusion \ - SD02_DIR=${BASE_DIR}/02-sd-webui \ - SD03_DIR=${BASE_DIR}/03-invokeai \ - SD04_DIR=${BASE_DIR}/04-SD-Next \ - SD05_DIR=${BASE_DIR}/05-comfy-ui \ - SD06_DIR=${BASE_DIR}/06-Fooocus \ - SD07_DIR=${BASE_DIR}/07-StableSwarm \ - SD08_DIR=${BASE_DIR}/08-voltaML \ - SD20_DIR=${BASE_DIR}/20-kubin \ - SD50_DIR=${BASE_DIR}/50-IOPaint \ - SD51_DIR=${BASE_DIR}/51-facefusion \ - SD70_DIR=${BASE_DIR}/70-kohya \ XDG_CACHE_HOME=/config/temp RUN apt-get update -y -q=2 && \ From b693738ca7842bf6d4b0a60788eb97d8e7ef8e4d Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 24 Mar 2024 09:09:43 +0100 Subject: [PATCH 18/30] fix clean 02+forge fix torch version --- 02.forge.sh | 3 +-- 02.sh | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/02.forge.sh b/02.forge.sh index 10c070b..e0b4de7 100644 --- a/02.forge.sh +++ b/02.forge.sh @@ -41,7 +41,7 @@ if [ "$active_clean" = "1" ]; then echo "-------------------------------------" echo "Cleaning venv" conda deactivate - conda remove -p ${SD02_DIR}/conda-env --all -y + rm -rf ${SD02_DIR}/conda-env conda create -p ${SD02_DIR}/conda-env -y export active_clean=0 echo "Done!" @@ -64,7 +64,6 @@ 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 torch==2.2.0 torchvision==0.17.0 torchaudio==2.2.0 --index-url https://download.pytorch.org/whl/cu121 pip install xformers --index-url https://download.pytorch.org/whl/cu121 # Merge Models, vae, lora, and hypernetworks, and outputs diff --git a/02.sh b/02.sh index cc904a8..ed35e57 100755 --- a/02.sh +++ b/02.sh @@ -42,7 +42,7 @@ if [ "$active_clean" = "1" ]; then echo "-------------------------------------" echo "Cleaning venv" conda deactivate - conda remove -p ${SD02_DIR}/conda-env --all -y + rm -rf ${SD02_DIR}/conda-env conda create -p ${SD02_DIR}/conda-env -y export active_clean=0 echo "Done!" @@ -66,7 +66,6 @@ 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 torch==2.2.0 torchvision==0.17.0 torchaudio==2.2.0 --index-url https://download.pytorch.org/whl/cu121 pip install xformers --index-url https://download.pytorch.org/whl/cu121 From b7a88fde58fd56e8018274fa853f97c0ed20ce95 Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 24 Mar 2024 10:03:05 +0100 Subject: [PATCH 19/30] clean and update 04 install script --- 04.sh | 86 +++++++++++++++++++---------------------------- parameters/04.txt | 2 +- 2 files changed, 36 insertions(+), 52 deletions(-) diff --git a/04.sh b/04.sh index b6bc664..0b8c92e 100755 --- a/04.sh +++ b/04.sh @@ -2,72 +2,58 @@ source /sl_folder.sh export PATH="/home/abc/miniconda3/bin:$PATH" -export use_venv=1 export SD04_DIR=${BASE_DIR}/04-SD-Next echo "Install and run SD-Next" mkdir -p ${SD04_DIR} -if [ ! -d ${SD04_DIR}/env ]; then - conda create -p ${SD04_DIR}/env -y -fi - -source activate ${SD04_DIR}/env -conda install -n base conda-libmamba-solver -y -conda install -c conda-forge git python=3.11 pip gxx libcurand gcc gxx onnx --solver=libmamba -y -conda install -c nvidia cuda-cudart --solver=libmamba -y - +#clone main repository if [ ! -d ${SD04_DIR}/webui ]; then git clone https://github.com/vladmandic/automatic ${SD04_DIR}/webui fi cd ${SD04_DIR}/webui -if [ -d "${SD04_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 - 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 - rm -rf ${SD04_DIR}/webui/venv - git pull -X ours +# 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 -if [ ! -f "$SD04_DIR/parameters.txt" ]; then - cp -v "${SD_INSTALL_DIR}/parameters/04.txt" "$SD04_DIR/parameters.txt" +#clean virtual env +if [ "$active_clean" = "1" ]; then + echo "-------------------------------------" + echo "Cleaning venv" + rm -rf ${SD04_DIR}/env + rm -rf ${SD04_DIR}/webui/venv + export active_clean=0 + echo "Done!" + echo -e "-------------------------------------\n" fi -# Load updated malloc to fix memory leak -# https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/6850#issuecomment-1432435503 -# https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/6722 -# https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/6722#discussioncomment-6161333 -if [[ "${OSTYPE}" == "linux"* ]] && [[ -z "${NO_TCMALLOC}" ]] && [[ -z "${LD_PRELOAD}" ]]; then - TCMALLOC="$(ldconfig -p | grep -Po "libtcmalloc_minimal.so.\d" | head -n 1)" - if [[ ! -z "${TCMALLOC}" ]]; then - echo "Using TCMalloc: ${TCMALLOC}" - export LD_PRELOAD="${TCMALLOC}" - fi + +#create conda env if needed +if [ ! -d ${SD04_DIR}/env ]; then + conda create -p ${SD04_DIR}/env -y fi -# Create venv -if [ ! -d ${SD04_DIR}/webui/venv ]; then - echo "Activating venv" - cd ${SD04_DIR}/webui - python -m venv venv - cd ${SD04_DIR}/webui - source venv/bin/activate - pip install --upgrade pip - pip install onnxruntime-gpu - pip install insightface - pip install protobuf==3.20.3 - deactivate +#install basic tools +source activate ${SD04_DIR}/env +conda install -n base conda-libmamba-solver -y +conda install -c conda-forge python=3.11 pip gcc gxx --solver=libmamba -y + +#copy default parameters if absent +if [ ! -f "$SD04_DIR/parameters.txt" ]; then + cp -v "${SD_INSTALL_DIR}/parameters/04.txt" "$SD04_DIR/parameters.txt" fi # Merge Models, vae, lora, hypernetworks, and outputs @@ -85,10 +71,8 @@ sl_folder ${SD04_DIR}/webui/models ControlNet ${BASE_DIR}/models controlnet sl_folder ${SD04_DIR}/webui outputs ${BASE_DIR}/outputs 04-SD-Next cd ${SD04_DIR}/webui/ -source venv/bin/activate -export PATH="/config/04-SD-Next/env/lib/python3.11/site-packages/onnxruntime/capi:$PATH" -pip install typing-extensions==4.8.0 numpy==1.24.4 huggingface_hub==0.18.0 sqlalchemy --upgrade +#Launch WebUI CMD="bash webui.sh" while IFS= read -r param; do if [[ $param != \#* ]]; then diff --git a/parameters/04.txt b/parameters/04.txt index 7670d9d..660f931 100644 --- a/parameters/04.txt +++ b/parameters/04.txt @@ -5,4 +5,4 @@ # SD-Next options --insecure --medvram ---allow-code +--allow-code \ No newline at end of file From 053628169e10068ec101346ed7295b94d0ea4920 Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 24 Mar 2024 10:34:43 +0100 Subject: [PATCH 20/30] add insightface 04 --- 04.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/04.sh b/04.sh index 0b8c92e..12bc946 100755 --- a/04.sh +++ b/04.sh @@ -51,6 +51,15 @@ source activate ${SD04_DIR}/env conda install -n base conda-libmamba-solver -y conda install -c conda-forge python=3.11 pip gcc gxx --solver=libmamba -y +# install dependencies +pip install --upgrade pip +pip install coloredlogs flatbuffers numpy packaging protobuf==3.20.3 sympy +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 xformers --index-url https://download.pytorch.org/whl/cu121 + #copy default parameters if absent if [ ! -f "$SD04_DIR/parameters.txt" ]; then cp -v "${SD_INSTALL_DIR}/parameters/04.txt" "$SD04_DIR/parameters.txt" From 4e9d3ef950cbbd4c3a4bbfa9b58b6ad9b36d2ff4 Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 24 Mar 2024 11:14:15 +0100 Subject: [PATCH 21/30] fix 04 --- 04.sh | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/04.sh b/04.sh index 12bc946..5ea4099 100755 --- a/04.sh +++ b/04.sh @@ -3,6 +3,7 @@ source /sl_folder.sh export PATH="/home/abc/miniconda3/bin:$PATH" export SD04_DIR=${BASE_DIR}/04-SD-Next +export use_venv=1 echo "Install and run SD-Next" @@ -46,19 +47,34 @@ if [ ! -d ${SD04_DIR}/env ]; then conda create -p ${SD04_DIR}/env -y fi -#install basic tools +#activate and install basic tools source activate ${SD04_DIR}/env conda install -n base conda-libmamba-solver -y conda install -c conda-forge python=3.11 pip gcc gxx --solver=libmamba -y +# Create and activate venv +if [ ! -d ${SD04_DIR}/webui/venv ]; then + echo "Activating venv" + cd ${SD04_DIR}/webui + python -m venv venv + cd ${SD04_DIR}/webui + source venv/bin/activate # install dependencies -pip install --upgrade pip -pip install coloredlogs flatbuffers numpy packaging protobuf==3.20.3 sympy -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 xformers --index-url https://download.pytorch.org/whl/cu121 + pip install --upgrade pip + pip install coloredlogs flatbuffers numpy packaging protobuf==3.20.3 sympy + 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 xformers --index-url https://download.pytorch.org/whl/cu121 + pip install onnxruntime-gpu + pip install insightface + pip install protobuf==3.20.3 + pip install sqlalchemy + deactivate +fi + + #copy default parameters if absent if [ ! -f "$SD04_DIR/parameters.txt" ]; then From 9247542eaccef03515b1de24924fe29f120f5dcf Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 24 Mar 2024 11:35:50 +0100 Subject: [PATCH 22/30] update 04 --- 04.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/04.sh b/04.sh index 5ea4099..2c8c2bf 100755 --- a/04.sh +++ b/04.sh @@ -52,14 +52,16 @@ source activate ${SD04_DIR}/env conda install -n base conda-libmamba-solver -y conda install -c conda-forge python=3.11 pip gcc gxx --solver=libmamba -y -# Create and activate venv +# Create venv if [ ! -d ${SD04_DIR}/webui/venv ]; then - echo "Activating venv" + echo "create venv" cd ${SD04_DIR}/webui python -m venv venv +fi + +# install dependencies cd ${SD04_DIR}/webui source venv/bin/activate -# install dependencies pip install --upgrade pip pip install coloredlogs flatbuffers numpy packaging protobuf==3.20.3 sympy pip install packaging @@ -72,9 +74,6 @@ if [ ! -d ${SD04_DIR}/webui/venv ]; then pip install protobuf==3.20.3 pip install sqlalchemy deactivate -fi - - #copy default parameters if absent if [ ! -f "$SD04_DIR/parameters.txt" ]; then From e101cb8c64231f78d21fde638c10e5733e94016e Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 24 Mar 2024 11:58:54 +0100 Subject: [PATCH 23/30] update 05 --- 04.sh | 5 ----- 05.sh | 35 ++++++++++++++++++++++++++--------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/04.sh b/04.sh index 2c8c2bf..ca454a8 100755 --- a/04.sh +++ b/04.sh @@ -64,14 +64,9 @@ fi source venv/bin/activate pip install --upgrade pip pip install coloredlogs flatbuffers numpy packaging protobuf==3.20.3 sympy - 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 xformers --index-url https://download.pytorch.org/whl/cu121 - pip install onnxruntime-gpu - pip install insightface - pip install protobuf==3.20.3 pip install sqlalchemy deactivate diff --git a/05.sh b/05.sh index 2732ae0..c5c0903 100755 --- a/05.sh +++ b/05.sh @@ -8,16 +8,7 @@ echo "Install and run Comfy-UI" mkdir -p ${SD05_DIR} mkdir -p /config/outputs/05-comfy-ui -if [ ! -d ${SD05_DIR}/env ]; then - conda create -p ${SD05_DIR}/env -y -fi -source activate ${SD05_DIR}/env -conda install -n base conda-libmamba-solver -y -conda install -c conda-forge git python=3.11 pip gxx libcurand --solver=libmamba -y -conda install -c nvidia cuda-cudart --solver=libmamba -y -pip install onnxruntime-gpu -pip install insightface torch torchvision if [ ! -f "$SD05_DIR/parameters.txt" ]; then cp -v "${SD_INSTALL_DIR}/parameters/05.txt" "$SD05_DIR/parameters.txt" @@ -49,13 +40,39 @@ sl_folder ${SD05_DIR}/ComfyUI/models clip_vision ${BASE_DIR}/models clip_vision sl_folder ${SD05_DIR}/ComfyUI/models clip ${BASE_DIR}/models clip sl_folder ${SD05_DIR}/ComfyUI/models controlnet ${BASE_DIR}/models controlnet +#clean conda env +if [ "$active_clean" = "1" ]; then + echo "-------------------------------------" + echo "Cleaning venv" + rm -rf ${SD01_DIR}/env + export active_clean=0 + echo "Done!" + echo -e "-------------------------------------\n" +fi + +#create conda env if needed +if [ ! -d ${SD05_DIR}/env ]; then + conda create -p ${SD05_DIR}/env -y +fi + +#activate env and install basic dependencies +source activate ${SD05_DIR}/env +conda install -n base conda-libmamba-solver -y +conda install -c conda-forge git python=3.11 pip gxx libcurand --solver=libmamba -y +conda install -c nvidia cuda-cudart --solver=libmamba -y +pip install onnxruntime-gpu +pip install insightface torch torchvision + +#clean old venv if it still exists if [ -d ${SD05_DIR}/venv ]; then rm -rf ${SD05_DIR}/venv fi +#install requirements cd ${SD05_DIR}/ComfyUI pip install -r requirements.txt +#run webui CMD="python3 main.py" while IFS= read -r param; do if [[ $param != \#* ]]; then From c2ecf6ab79ec3a7195f5cf05cc9bb61491c0f480 Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 24 Mar 2024 12:16:31 +0100 Subject: [PATCH 24/30] update 05 --- 05.sh | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/05.sh b/05.sh index c5c0903..74b66d3 100755 --- a/05.sh +++ b/05.sh @@ -15,7 +15,7 @@ if [ ! -f "$SD05_DIR/parameters.txt" ]; then fi if [ ! -d ${SD05_DIR}/ComfyUI ]; then - git clone https://github.com/comfyanonymous/ComfyUI ${SD05_DIR}/ComfyUI + git clone https://github.com/comfyanonymous/ComfyUI.git ${SD05_DIR}/ComfyUI fi if [ ! -d ${SD05_DIR}/ComfyUI/custom_nodes/ComfyUI-Manager ]; then @@ -23,10 +23,23 @@ if [ ! -d ${SD05_DIR}/ComfyUI/custom_nodes/ComfyUI-Manager ]; then fi cd ${SD05_DIR}/ComfyUI/custom_nodes/ComfyUI-Manager -git pull -X ours - -cd ${SD05_DIR}/ComfyUI -git pull -X ours +git reset --hard HEAD + +# 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 reset --hard HEAD + #git pull -X ours +fi # Merge Models, vae, lora, hypernetworks, and outputs sl_folder ${SD05_DIR}/ComfyUI/models checkpoints ${BASE_DIR}/models stable-diffusion From c96018868ab6b51213d748b296a32736af756d0c Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 24 Mar 2024 13:29:04 +0100 Subject: [PATCH 25/30] update 06 --- 05.sh | 7 ++++--- 06.sh | 57 ++++++++++++++++++++++++++++++++++++++++++++------------- 2 files changed, 48 insertions(+), 16 deletions(-) diff --git a/05.sh b/05.sh index 74b66d3..5a9ef59 100755 --- a/05.sh +++ b/05.sh @@ -23,7 +23,8 @@ if [ ! -d ${SD05_DIR}/ComfyUI/custom_nodes/ComfyUI-Manager ]; then fi cd ${SD05_DIR}/ComfyUI/custom_nodes/ComfyUI-Manager -git reset --hard HEAD +#git reset --hard HEAD +git pull -X ours # check if remote is ahead of local # https://stackoverflow.com/a/25109122/1469797 @@ -37,8 +38,8 @@ sed 's/\// /g') | cut -f1) ]; then echo "Remote branch is ahead. Wiping venv for clean packages install" fi export active_clean=1 - git reset --hard HEAD - #git pull -X ours +# git reset --hard HEAD + git pull -X ours fi # Merge Models, vae, lora, hypernetworks, and outputs diff --git a/06.sh b/06.sh index 613f32d..f8cce08 100755 --- a/06.sh +++ b/06.sh @@ -7,26 +7,58 @@ export SD06_DIR=${BASE_DIR}/06-Fooocus mkdir -p ${SD06_DIR} mkdir -p $BASE_DIR/outputs/06-Fooocus -if [ ! -d ${SD06_DIR}/env ]; then - conda create -p ${SD06_DIR}/env -y +#remove old venv if still present +if [ -d ${SD06_DIR}/venv ]; then + rm -rf ${SD06_DIR}/venv fi -source activate ${SD06_DIR}/env -conda install -n base conda-libmamba-solver -y -conda install -c conda-forge git python=3.10 pip --solver=libmamba -y -conda install -c nvidia cuda-cudart --solver=libmamba -y - +#copy parameters if absent if [ ! -f "$SD06_DIR/parameters.txt" ]; then cp -v "${SD_INSTALL_DIR}/parameters/06.txt" "$SD06_DIR/parameters.txt" fi +#clone Fooocus repository if new install if [ ! -d ${SD06_DIR}/Fooocus ]; then cd "${SD06_DIR}" && git clone https://github.com/lllyasviel/Fooocus.git fi +# check if remote is ahead of local +# https://stackoverflow.com/a/25109122/1469797 cd ${SD06_DIR}/Fooocus -#git reset --hard HEAD -git pull -X ours +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 reset --hard HEAD + git pull -X ours +fi + +#clean conda env if needed +if [ "$active_clean" = "1" ]; then + echo "-------------------------------------" + echo "Cleaning venv" + rm -rf ${SD06_DIR}/env + export active_clean=0 + echo "Done!" + echo -e "-------------------------------------\n" +fi + +#create env if missing +if [ ! -d ${SD06_DIR}/env ]; then + conda create -p ${SD06_DIR}/env -y +fi + +#activate env and install packages +source activate ${SD06_DIR}/env +conda install -n base conda-libmamba-solver -y +conda install -c conda-forge git python=3.10 pip --solver=libmamba -y +conda install -c nvidia cuda-cudart --solver=libmamba -y sl_folder ${SD06_DIR}/Fooocus/models checkpoints ${BASE_DIR}/models stable-diffusion sl_folder ${SD06_DIR}/Fooocus/models loras ${BASE_DIR}/models lora @@ -39,12 +71,11 @@ sl_folder ${SD06_DIR}/Fooocus/models controlnet ${BASE_DIR}/models controlnet sl_folder ${SD06_DIR}/Fooocus outputs ${BASE_DIR}/outputs 06-Fooocus -if [ -d ${SD06_DIR}/venv ]; then - rm -rf ${SD06_DIR}/venv -fi - +#install requirements cd ${SD06_DIR}/Fooocus pip install -r requirements_versions.txt + +#Launch webUI CMD="python launch.py" while IFS= read -r param; do if [[ $param != \#* ]]; then From a720346fc90ecd2f04e6be98fe84d9d7e97f1c9b Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 24 Mar 2024 14:23:30 +0100 Subject: [PATCH 26/30] update 07 and 08 --- 07.sh | 51 +++++++++++++++++++++++++++++++++++++---------- 08.sh | 63 ++++++++++++++++++++++++++++++++++++++--------------------- 2 files changed, 82 insertions(+), 32 deletions(-) diff --git a/07.sh b/07.sh index 27b37f8..6a978fd 100755 --- a/07.sh +++ b/07.sh @@ -7,29 +7,59 @@ export SD07_DIR=${BASE_DIR}/07-StableSwarm mkdir -p ${SD07_DIR} mkdir -p /config/outputs/07-StableSwarm -if [ ! -d ${SD07_DIR}/env ]; then - conda create -p ${SD07_DIR}/env -y -fi - -source activate ${SD07_DIR}/env -conda install -n base conda-libmamba-solver -y -conda install -c conda-forge git python=3.11 pip --solver=libmamba -y - +#remove old venv if still exists if [ -d ${SD07_DIR}/venv ]; then rm -rf ${SD07_DIR}/venv fi +#copy default parameters if missing if [ ! -f "$SD07_DIR/parameters.txt" ]; then cp -v "${SD_INSTALL_DIR}/parameters/07.txt" "$SD07_DIR/parameters.txt" fi +#clone repository if new install if [ ! -d ${SD07_DIR}/StableSwarmUI ]; then - cd "${SD07_DIR}" && git clone https://github.com/Stability-AI/StableSwarmUI + cd "${SD07_DIR}" && git clone https://github.com/Stability-AI/StableSwarmUI.git fi +# check if remote is ahead of local +# https://stackoverflow.com/a/25109122/1469797 cd ${SD07_DIR}/StableSwarmUI -git pull -X ours +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 reset --hard HEAD + git pull -X ours +fi + +#clean conda env if needed +if [ "$active_clean" = "1" ]; then + echo "-------------------------------------" + echo "Cleaning venv" + rm -rf ${SD07_DIR}/env + export active_clean=0 + echo "Done!" + echo -e "-------------------------------------\n" +fi + +#create env if missing +if [ ! -d ${SD07_DIR}/env ]; then + conda create -p ${SD07_DIR}/env -y +fi + +#activate env and install packages +source activate ${SD07_DIR}/env +conda install -n base conda-libmamba-solver -y +conda install -c conda-forge git python=3.11 pip --solver=libmamba -y +#move models to common folder and create symlinks mkdir -p ${SD07_DIR}/StableSwarmUI/Models sl_folder ${SD07_DIR}/StableSwarmUI/Models Stable-Diffusion ${BASE_DIR}/models stable-diffusion @@ -41,6 +71,7 @@ sl_folder ${SD07_DIR}/StableSwarmUI/Models controlnet ${BASE_DIR}/models control sl_folder ${SD07_DIR}/StableSwarmUI Output ${BASE_DIR}/outputs 07-StableSwarm +#launch Stable Swarm cd ${SD07_DIR}/StableSwarmUI CMD="./launch-linux.sh" while IFS= read -r param; do diff --git a/08.sh b/08.sh index 2b2ffaf..11af85a 100755 --- a/08.sh +++ b/08.sh @@ -7,28 +7,54 @@ export SD08_DIR=${BASE_DIR}/08-voltaML mkdir -p ${SD08_DIR} mkdir -p /config/outputs/08-voltaML -if [ ! -d ${SD08_DIR}/env ]; then - conda create -p ${SD08_DIR}/env -y -fi - -source activate ${SD08_DIR}/env -conda install -n base conda-libmamba-solver -y -conda install -c conda-forge git python=3.10 pip=22.3.1 gcc gxx --solver=libmamba -y -conda install pytorch torchvision torchaudio -c pytorch --solver=libmamba -y - - - if [ ! -f "$SD08_DIR/parameters.txt" ]; then cp -v "${SD_INSTALL_DIR}/parameters/08.txt" "$SD08_DIR/parameters.txt" fi if [ ! -d "${SD08_DIR}/voltaML-fast-stable-diffusion" ]; then - cd "${SD08_DIR}" && git clone https://github.com/VoltaML/voltaML-fast-stable-diffusion + cd "${SD08_DIR}" && git clone https://github.com/VoltaML/voltaML-fast-stable-diffusion.git fi +# check if remote is ahead of local +# https://stackoverflow.com/a/25109122/1469797 cd ${SD08_DIR}/voltaML-fast-stable-diffusion -git pull -X ours +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 reset --hard HEAD + git pull -X ours +fi +#clean conda env if needed +if [ "$active_clean" = "1" ]; then + echo "-------------------------------------" + echo "Cleaning venv" + rm -rf ${SD08_DIR}/env + rm -rf ${SD08_DIR}/voltaML-fast-stable-diffusion/venv + export active_clean=0 + echo "Done!" + echo -e "-------------------------------------\n" +fi + +#create conda env if missing +if [ ! -d ${SD08_DIR}/env ]; then + conda create -p ${SD08_DIR}/env -y +fi + +#activate conda env and install packages +source activate ${SD08_DIR}/env +conda install -n base conda-libmamba-solver -y +conda install -c conda-forge git python=3.10 pip=22.3.1 gcc gxx --solver=libmamba -y +conda install pytorch torchvision torchaudio -c pytorch --solver=libmamba -y + +#create python venv if missing if [ ! -d ${SD08_DIR}/voltaML-fast-stable-diffusion/venv ]; then cd ${SD08_DIR}/voltaML-fast-stable-diffusion python -m venv venv @@ -44,6 +70,7 @@ for fichier in ${SD08_DIR}/voltaML-fast-stable-diffusion/requirements/*.txt; do pip install -r $fichier done +#move models to common folders and create symlinks sl_folder ${SD08_DIR}/voltaML-fast-stable-diffusion/data models ${BASE_DIR}/models stable-diffusion sl_folder ${SD08_DIR}/voltaML-fast-stable-diffusion/data lora ${BASE_DIR}/models lora sl_folder ${SD08_DIR}/voltaML-fast-stable-diffusion/data vae ${BASE_DIR}/models vae @@ -51,16 +78,8 @@ sl_folder ${SD08_DIR}/voltaML-fast-stable-diffusion/data textual-inversion ${BAS sl_folder ${SD08_DIR}/voltaML-fast-stable-diffusion/data upscaler ${BASE_DIR}/models upscale sl_folder ${SD08_DIR}/voltaML-fast-stable-diffusion/data outputs /config/outputs 08-voltaML -# cd ${SD08_DIR} -# conda install -c conda-forge pytorch torchvis --solver=libmamba -y -# pip install -v -U git+https://github.com/chengzeyi/stable-fast.git@main#egg=stable-fast -# su -w SD08_DIR - diffusion -c 'cd ${SD08_DIR} && source venv/bin/activate && pip install torch==2.1.0+cu118 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 ' -# su -w SD08_DIR - diffusion -c 'cd ${SD08_DIR} && source venv/bin/activate && pip install diffusers xformers ninja ' -# su -w SD08_DIR - diffusion -c 'cd ${SD08_DIR} && source venv/bin/activate && pip install -v -U git+https://github.com/chengzeyi/stable-fast.git@main#egg=stable-fast ' - -# Boucle pour parcourir tous les fichiers requirements.txt cd ${SD08_DIR}/voltaML-fast-stable-diffusion -# source venv/bin/activate +# launch Volta ML CMD="python3 main.py" while IFS= read -r param; do if [[ $param != \#* ]]; then From fa3b5f7170ec06df9eca838ac64fc51108633cc9 Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 24 Mar 2024 16:15:39 +0100 Subject: [PATCH 27/30] remove 08 --- 08.sh => 08.sh.old | 10 ++++++++-- 20.sh | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) rename 08.sh => 08.sh.old (88%) mode change 100755 => 100644 diff --git a/08.sh b/08.sh.old old mode 100755 new mode 100644 similarity index 88% rename from 08.sh rename to 08.sh.old index 11af85a..e262a26 --- a/08.sh +++ b/08.sh.old @@ -62,14 +62,20 @@ fi cd ${SD08_DIR}/voltaML-fast-stable-diffusion source venv/bin/activate -#pip install --upgrade pip -pip install onnxruntime-gpu for fichier in ${SD08_DIR}/voltaML-fast-stable-diffusion/requirements/*.txt; do echo "installation of requirements" pip install -r $fichier done +pip install --upgrade pip +pip install coloredlogs flatbuffers numpy packaging protobuf==3.20.3 sympy +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 xformers --index-url https://download.pytorch.org/whl/cu121 + #move models to common folders and create symlinks sl_folder ${SD08_DIR}/voltaML-fast-stable-diffusion/data models ${BASE_DIR}/models stable-diffusion sl_folder ${SD08_DIR}/voltaML-fast-stable-diffusion/data lora ${BASE_DIR}/models lora diff --git a/20.sh b/20.sh index aedd102..9f3781f 100755 --- a/20.sh +++ b/20.sh @@ -22,7 +22,7 @@ if [ ! -f "$SD20_DIR/parameters.txt" ]; then fi if [ ! -d ${SD20_DIR}/kuby ]; then - cd "${SD20_DIR}" && git clone https://github.com/seruva19/kubin + cd "${SD20_DIR}" && git clone https://github.com/seruva19/kubin.git fi cd ${SD20_DIR}/kubin From f10cca12b0adc66277bfcabea7e642f46cc86e07 Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 24 Mar 2024 22:11:37 +0100 Subject: [PATCH 28/30] new Kohya setup --- 70.sh | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/70.sh b/70.sh index 6ab7016..19db088 100755 --- a/70.sh +++ b/70.sh @@ -13,14 +13,14 @@ fi source activate ${SD70_DIR}/env conda install -n base conda-libmamba-solver -y -conda install -c conda-forge git python=3.10 pip --solver=libmamba -y +conda install -c conda-forge python=3.10 pip --solver=libmamba -y # Create venv -if [ ! -d ${SD70_DIR}/venv ]; then - cd ${SD70_DIR} - python -m venv venv - cd ${SD70_DIR} -fi +#if [ ! -d ${SD70_DIR}/venv ]; then +# cd ${SD70_DIR} +# python -m venv venv +# cd ${SD70_DIR} +#fi if [ ! -f "$SD70_DIR/parameters.txt" ]; then cp -v "${SD_INSTALL_DIR}/parameters/70.txt" "$SD70_DIR/parameters.txt" @@ -31,20 +31,21 @@ if [ ! -d ${SD70_DIR}/kohya_ss ]; then fi cd ${SD70_DIR}/kohya_ss - git config --global --add safe.directory ${SD70_DIR}/kohya_ss +# git config --global --add safe.directory ${SD70_DIR}/kohya_ss git pull -X ours # if [ ! -d ${SD70_DIR}/venv ]; then # su -w SD70_DIR - diffusion -c 'cd ${SD70_DIR} && python3 -m venv venv' # fi -cd ${SD70_DIR} -source venv/bin/activate +#cd ${SD70_DIR} +#source venv/bin/activate pip install --upgrade pip cd ${SD70_DIR}/kohya_ss -pip install -r requirements.txt +python ./setup/setup_linux.py +#pip install -r requirements.txt cd ${SD70_DIR}/kohya_ss -CMD="bash gui.sh"; while IFS= read -r param; do if [[ $param != \#* ]]; then CMD+=" ${param}"; fi; done < "${SD70_DIR}/parameters.txt"; eval $CMD +CMD="python kohya_gui.py"; while IFS= read -r param; do if [[ $param != \#* ]]; then CMD+=" ${param}"; fi; done < "${SD70_DIR}/parameters.txt"; eval $CMD From 95cba54db6bd098aa7f08c587d89c80475c771db Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 24 Mar 2024 22:41:16 +0100 Subject: [PATCH 29/30] remove kubin + update kohya installer --- 20.sh => 20.sh.old | 0 70.sh | 59 ++++++++++++++++++++++++++++------------------ 2 files changed, 36 insertions(+), 23 deletions(-) rename 20.sh => 20.sh.old (100%) mode change 100755 => 100644 diff --git a/20.sh b/20.sh.old old mode 100755 new mode 100644 similarity index 100% rename from 20.sh rename to 20.sh.old diff --git a/70.sh b/70.sh index 19db088..7ae2263 100755 --- a/70.sh +++ b/70.sh @@ -7,21 +7,6 @@ export SD70_DIR=${BASE_DIR}/70-kohya mkdir -p ${SD70_DIR} mkdir -p /config/outputs/70-kohya -if [ ! -d ${SD70_DIR}/env ]; then - conda create -p ${SD70_DIR}/env -y -fi - -source activate ${SD70_DIR}/env -conda install -n base conda-libmamba-solver -y -conda install -c conda-forge python=3.10 pip --solver=libmamba -y - -# Create venv -#if [ ! -d ${SD70_DIR}/venv ]; then -# cd ${SD70_DIR} -# python -m venv venv -# cd ${SD70_DIR} -#fi - if [ ! -f "$SD70_DIR/parameters.txt" ]; then cp -v "${SD_INSTALL_DIR}/parameters/70.txt" "$SD70_DIR/parameters.txt" fi @@ -30,21 +15,49 @@ if [ ! -d ${SD70_DIR}/kohya_ss ]; then cd "${SD70_DIR}" && git clone https://github.com/bmaltais/kohya_ss fi - cd ${SD70_DIR}/kohya_ss -# git config --global --add safe.directory ${SD70_DIR}/kohya_ss +# check if remote is ahead of local +# https://stackoverflow.com/a/25109122/1469797 +cd ${SD70_DIR}/kohya_ss +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 reset --hard HEAD git pull -X ours +fi -# if [ ! -d ${SD70_DIR}/venv ]; then -# su -w SD70_DIR - diffusion -c 'cd ${SD70_DIR} && python3 -m venv venv' -# fi +#clean conda env if needed +if [ "$active_clean" = "1" ]; then + echo "-------------------------------------" + echo "Cleaning venv" + rm -rf ${SD70_DIR}/env + export active_clean=0 + echo "Done!" + echo -e "-------------------------------------\n" +fi + +#create conda env +if [ ! -d ${SD70_DIR}/env ]; then + conda create -p ${SD70_DIR}/env -y +fi -#cd ${SD70_DIR} -#source venv/bin/activate +source activate ${SD70_DIR}/env +conda install -n base conda-libmamba-solver -y +conda install -c conda-forge python=3.10 pip --solver=libmamba -y + +#install dependencies pip install --upgrade pip cd ${SD70_DIR}/kohya_ss python ./setup/setup_linux.py -#pip install -r requirements.txt cd ${SD70_DIR}/kohya_ss + +#launch Kohya CMD="python kohya_gui.py"; while IFS= read -r param; do if [[ $param != \#* ]]; then CMD+=" ${param}"; fi; done < "${SD70_DIR}/parameters.txt"; eval $CMD From 640168a18f856c159a4a14204754766bb537e187 Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 24 Mar 2024 22:55:37 +0100 Subject: [PATCH 30/30] small update kohya --- 70.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/70.sh b/70.sh index 7ae2263..e794a43 100755 --- a/70.sh +++ b/70.sh @@ -58,6 +58,7 @@ python ./setup/setup_linux.py cd ${SD70_DIR}/kohya_ss #launch Kohya +echo LAUNCHING KOHYA_SS ! CMD="python kohya_gui.py"; while IFS= read -r param; do if [[ $param != \#* ]]; then CMD+=" ${param}"; fi; done < "${SD70_DIR}/parameters.txt"; eval $CMD