From d29fe44e467c6ecc435f561a776ead8f5116f077 Mon Sep 17 00:00:00 2001 From: kernelmethod <17100608+kernelmethod@users.noreply.github.com> Date: Thu, 25 May 2023 14:51:47 -0400 Subject: Small fixes to prepare_tcmalloc for Debian/Ubuntu compatibility - /usr/sbin (where ldconfig is usually located) is not typically on users' PATHs by default, so we set that variable before trying to run ldconfig. - The libtcmalloc library is called libtcmalloc_minimal on Debian/Ubuntu systems. We now check whether libtcmalloc_minimal exists when running prepare_tcmalloc. --- webui.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'webui.sh') diff --git a/webui.sh b/webui.sh index 19cf2f78..7f26d6bf 100755 --- a/webui.sh +++ b/webui.sh @@ -183,7 +183,7 @@ fi # Try using TCMalloc on Linux prepare_tcmalloc() { if [[ "${OSTYPE}" == "linux"* ]] && [[ -z "${NO_TCMALLOC}" ]] && [[ -z "${LD_PRELOAD}" ]]; then - TCMALLOC="$(ldconfig -p | grep -Po "libtcmalloc.so.\d" | head -n 1)" + TCMALLOC="$(PATH=/usr/sbin:$PATH ldconfig -p | grep -Po "libtcmalloc(_minimal|)\.so\.\d" | head -n 1)" if [[ ! -z "${TCMALLOC}" ]]; then echo "Using TCMalloc: ${TCMALLOC}" export LD_PRELOAD="${TCMALLOC}" -- cgit v1.2.3 From 09d9c3d287ee4543d285e0fde8b81603c9751a7e Mon Sep 17 00:00:00 2001 From: Roman Beltiukov Date: Thu, 25 May 2023 14:45:05 -0700 Subject: change to AMD only if NVIDIA is not presented --- webui.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'webui.sh') diff --git a/webui.sh b/webui.sh index 19cf2f78..999fafe4 100755 --- a/webui.sh +++ b/webui.sh @@ -116,11 +116,14 @@ case "$gpu_info" in *) ;; esac -if echo "$gpu_info" | grep -q "AMD" && [[ -z "${TORCH_COMMAND}" ]] +if ! echo "$gpu_info" | grep -q "NVIDIA"; then - # AMD users will still use torch 1.13 because 2.0 does not seem to work. - export TORCH_COMMAND="pip install torch==1.13.1+rocm5.2 torchvision==0.14.1+rocm5.2 --index-url https://download.pytorch.org/whl/rocm5.2" -fi + if echo "$gpu_info" | grep -q "AMD" && [[ -z "${TORCH_COMMAND}" ]] + then + # AMD users will still use torch 1.13 because 2.0 does not seem to work. + export TORCH_COMMAND="pip install torch==1.13.1+rocm5.2 torchvision==0.14.1+rocm5.2 --index-url https://download.pytorch.org/whl/rocm5.2" + fi +fi for preq in "${GIT}" "${python_cmd}" do -- cgit v1.2.3 From bdc371983ea817547378fd2232ff0eb22bb315fa Mon Sep 17 00:00:00 2001 From: Roman Beltiukov Date: Fri, 26 May 2023 02:09:09 -0700 Subject: Update webui.sh --- webui.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'webui.sh') diff --git a/webui.sh b/webui.sh index d8b57b14..31296e08 100755 --- a/webui.sh +++ b/webui.sh @@ -128,8 +128,7 @@ if ! echo "$gpu_info" | grep -q "NVIDIA"; then if echo "$gpu_info" | grep -q "AMD" && [[ -z "${TORCH_COMMAND}" ]] then - # AMD users will still use torch 1.13 because 2.0 does not seem to work. - export TORCH_COMMAND="pip install torch==1.13.1+rocm5.2 torchvision==0.14.1+rocm5.2 --index-url https://download.pytorch.org/whl/rocm5.2" + export TORCH_COMMAND="pip install torch==2.0.1+rocm5.4.2 torchvision==0.15.2+rocm5.4.2 --index-url https://download.pytorch.org/whl/rocm5.4.2" fi fi -- cgit v1.2.3 From 8d970a4a97147891265fd4f8cccf5719d958b125 Mon Sep 17 00:00:00 2001 From: Pablo Cholaky Date: Fri, 2 Jun 2023 15:01:30 -0400 Subject: Added support for workarounds on external GPU. lspci detects VGA for main/integrated videocards and Display for external videocards. This commit should apply workarounds on computers with more than one GPU. Useful for most laptops using weak iGPU and good dGPU. Signed-off-by: Pablo Cholaky --- webui.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'webui.sh') diff --git a/webui.sh b/webui.sh index ab52ac3b..3e7c3cf3 100755 --- a/webui.sh +++ b/webui.sh @@ -112,7 +112,7 @@ then fi # Check prerequisites -gpu_info=$(lspci 2>/dev/null | grep VGA) +gpu_info=$(lspci 2>/dev/null | grep -E "VGA|Display") case "$gpu_info" in *"Navi 1"*|*"Navi 2"*) export HSA_OVERRIDE_GFX_VERSION=10.3.0 ;; -- cgit v1.2.3 From 333e63c0911c148ea306d7b72580d5c6d2f2c41a Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Sat, 3 Jun 2023 09:59:56 +0300 Subject: a yet another method to restart webui --- webui.sh | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'webui.sh') diff --git a/webui.sh b/webui.sh index 1e728813..c407b3ef 100755 --- a/webui.sh +++ b/webui.sh @@ -203,17 +203,23 @@ prepare_tcmalloc() { fi } -if [[ ! -z "${ACCELERATE}" ]] && [ ${ACCELERATE}="True" ] && [ -x "$(command -v accelerate)" ] -then - printf "\n%s\n" "${delimiter}" - printf "Accelerating launch.py..." - printf "\n%s\n" "${delimiter}" - prepare_tcmalloc - exec accelerate launch --num_cpu_threads_per_process=6 "${LAUNCH_SCRIPT}" "$@" -else - printf "\n%s\n" "${delimiter}" - printf "Launching launch.py..." - printf "\n%s\n" "${delimiter}" - prepare_tcmalloc - exec "${python_cmd}" "${LAUNCH_SCRIPT}" "$@" -fi +KEEP_GOING=1 +while [[ "$KEEP_GOING" -eq "1" ]]; do + if [[ ! -z "${ACCELERATE}" ]] && [ ${ACCELERATE}="True" ] && [ -x "$(command -v accelerate)" ]; then + printf "\n%s\n" "${delimiter}" + printf "Accelerating launch.py..." + printf "\n%s\n" "${delimiter}" + prepare_tcmalloc + accelerate launch --num_cpu_threads_per_process=6 "${LAUNCH_SCRIPT}" "$@" + else + printf "\n%s\n" "${delimiter}" + printf "Launching launch.py..." + printf "\n%s\n" "${delimiter}" + prepare_tcmalloc + "${python_cmd}" "${LAUNCH_SCRIPT}" "$@" + fi + + if [[ ! -f tmp/restart ]]; then + KEEP_GOING=0 + fi +done -- cgit v1.2.3 From 46a5bd64edece07f521409f0adace6cdd6f30a40 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Mon, 5 Jun 2023 20:04:28 +0300 Subject: Restart: only do restart if running via the wrapper script --- webui.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'webui.sh') diff --git a/webui.sh b/webui.sh index c407b3ef..6c48e969 100755 --- a/webui.sh +++ b/webui.sh @@ -204,6 +204,7 @@ prepare_tcmalloc() { } KEEP_GOING=1 +export SD_WEBUI_RESTART=tmp/restart while [[ "$KEEP_GOING" -eq "1" ]]; do if [[ ! -z "${ACCELERATE}" ]] && [ ${ACCELERATE}="True" ] && [ -x "$(command -v accelerate)" ]; then printf "\n%s\n" "${delimiter}" -- cgit v1.2.3 From 8d98532b6531c6ef006cb596322da69ec49b1a00 Mon Sep 17 00:00:00 2001 From: DGdev91 Date: Tue, 6 Jun 2023 01:05:31 +0200 Subject: Forcing Torch Version to 1.13.1 for Navi and Renoir GPUs --- webui.sh | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'webui.sh') diff --git a/webui.sh b/webui.sh index 6c48e969..3b7964a5 100755 --- a/webui.sh +++ b/webui.sh @@ -112,14 +112,32 @@ then fi # Check prerequisites +pyv="$(python -c 'import sys; print(".".join(map(str, sys.version_info[0:2])))')" gpu_info=$(lspci 2>/dev/null | grep -E "VGA|Display") case "$gpu_info" in - *"Navi 1"*|*"Navi 2"*) export HSA_OVERRIDE_GFX_VERSION=10.3.0 + *"Navi 1"*|*"Navi 2"*) + then + export HSA_OVERRIDE_GFX_VERSION=10.3.0 + # Navi users will still use torch 1.13 because 2.0 does not seem to work. + export TORCH_COMMAND="pip install torch==1.13.1+rocm5.2 torchvision==0.14.1+rocm5.2 --index-url https://download.pytorch.org/whl/rocm5.2" + else + printf "\e[1m\e[31mERROR: Navi GPUs must be using at max python 3.10, aborting...\e[0m" + exit 1 + fi ;; - *"Renoir"*) export HSA_OVERRIDE_GFX_VERSION=9.0.0 - printf "\n%s\n" "${delimiter}" - printf "Experimental support for Renoir: make sure to have at least 4GB of VRAM and 10GB of RAM or enable cpu mode: --use-cpu all --no-half" - printf "\n%s\n" "${delimiter}" + *"Renoir"*) + if [[ $(bc <<< "$pyv <= 3.10") -eq 1 ]] + then + export HSA_OVERRIDE_GFX_VERSION=9.0.0 + # Renoir users will still use torch 1.13 because 2.0 does not seem to work. + export TORCH_COMMAND="pip install torch==1.13.1+rocm5.2 torchvision==0.14.1+rocm5.2 --index-url https://download.pytorch.org/whl/rocm5.2" + printf "\n%s\n" "${delimiter}" + printf "Experimental support for Renoir: make sure to have at least 4GB of VRAM and 10GB of RAM or enable cpu mode: --use-cpu all --no-half" + printf "\n%s\n" "${delimiter}" + else + printf "\e[1m\e[31mERROR: Renoir GPUs must be using at max python 3.10, aborting...\e[0m" + exit 1 + fi ;; *) ;; -- cgit v1.2.3 From 2788ce8c7bd7b3e3ee4319e99ce3f7aa6a709bb5 Mon Sep 17 00:00:00 2001 From: DGdev91 Date: Tue, 6 Jun 2023 01:51:01 +0200 Subject: Fix error in webui.sh --- webui.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'webui.sh') diff --git a/webui.sh b/webui.sh index 3b7964a5..45afbfc4 100755 --- a/webui.sh +++ b/webui.sh @@ -116,6 +116,7 @@ pyv="$(python -c 'import sys; print(".".join(map(str, sys.version_info[0:2])))') gpu_info=$(lspci 2>/dev/null | grep -E "VGA|Display") case "$gpu_info" in *"Navi 1"*|*"Navi 2"*) + if [[ $(bc <<< "$pyv <= 3.10") -eq 1 ]] then export HSA_OVERRIDE_GFX_VERSION=10.3.0 # Navi users will still use torch 1.13 because 2.0 does not seem to work. -- cgit v1.2.3 From e0d923bdf849e7afa4630260f8cc928ffcd3497b Mon Sep 17 00:00:00 2001 From: DGdev91 Date: Tue, 6 Jun 2023 09:55:49 +0200 Subject: Force python1 for Navi1 only, use python_cmd for python --- webui.sh | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'webui.sh') diff --git a/webui.sh b/webui.sh index 45afbfc4..c3e738c5 100755 --- a/webui.sh +++ b/webui.sh @@ -112,10 +112,10 @@ then fi # Check prerequisites -pyv="$(python -c 'import sys; print(".".join(map(str, sys.version_info[0:2])))')" +pyv="$(${python_cmd} -c 'import sys; print(".".join(map(str, sys.version_info[0:2])))')" gpu_info=$(lspci 2>/dev/null | grep -E "VGA|Display") case "$gpu_info" in - *"Navi 1"*|*"Navi 2"*) + *"Navi 1"*) if [[ $(bc <<< "$pyv <= 3.10") -eq 1 ]] then export HSA_OVERRIDE_GFX_VERSION=10.3.0 @@ -126,19 +126,12 @@ case "$gpu_info" in exit 1 fi ;; - *"Renoir"*) - if [[ $(bc <<< "$pyv <= 3.10") -eq 1 ]] - then - export HSA_OVERRIDE_GFX_VERSION=9.0.0 - # Renoir users will still use torch 1.13 because 2.0 does not seem to work. - export TORCH_COMMAND="pip install torch==1.13.1+rocm5.2 torchvision==0.14.1+rocm5.2 --index-url https://download.pytorch.org/whl/rocm5.2" - printf "\n%s\n" "${delimiter}" - printf "Experimental support for Renoir: make sure to have at least 4GB of VRAM and 10GB of RAM or enable cpu mode: --use-cpu all --no-half" - printf "\n%s\n" "${delimiter}" - else - printf "\e[1m\e[31mERROR: Renoir GPUs must be using at max python 3.10, aborting...\e[0m" - exit 1 - fi + *"Navi 2"*) export HSA_OVERRIDE_GFX_VERSION=10.3.0 + ;; + *"Renoir"*) export HSA_OVERRIDE_GFX_VERSION=9.0.0 + printf "\n%s\n" "${delimiter}" + printf "Experimental support for Renoir: make sure to have at least 4GB of VRAM and 10GB of RAM or enable cpu mode: --use-cpu all --no-half" + printf "\n%s\n" "${delimiter}" ;; *) ;; -- cgit v1.2.3 From 95d4d650d4f42a6fca94495fe9a1d0e471c92607 Mon Sep 17 00:00:00 2001 From: DGdev91 Date: Tue, 6 Jun 2023 09:59:13 +0200 Subject: Check python version for Navi 1 only --- webui.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'webui.sh') diff --git a/webui.sh b/webui.sh index c3e738c5..d123ac8b 100755 --- a/webui.sh +++ b/webui.sh @@ -112,10 +112,10 @@ then fi # Check prerequisites -pyv="$(${python_cmd} -c 'import sys; print(".".join(map(str, sys.version_info[0:2])))')" gpu_info=$(lspci 2>/dev/null | grep -E "VGA|Display") case "$gpu_info" in *"Navi 1"*) + pyv="$(${python_cmd} -c 'import sys; print(".".join(map(str, sys.version_info[0:2])))')" if [[ $(bc <<< "$pyv <= 3.10") -eq 1 ]] then export HSA_OVERRIDE_GFX_VERSION=10.3.0 -- cgit v1.2.3 From 864676880104fb42b8d78ce8a74dc0b735e8e9b3 Mon Sep 17 00:00:00 2001 From: DGdev91 Date: Tue, 6 Jun 2023 10:03:20 +0200 Subject: Write "RX 5000 Series" instead of "Navi" in err --- webui.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'webui.sh') diff --git a/webui.sh b/webui.sh index d123ac8b..15e65599 100755 --- a/webui.sh +++ b/webui.sh @@ -122,7 +122,7 @@ case "$gpu_info" in # Navi users will still use torch 1.13 because 2.0 does not seem to work. export TORCH_COMMAND="pip install torch==1.13.1+rocm5.2 torchvision==0.14.1+rocm5.2 --index-url https://download.pytorch.org/whl/rocm5.2" else - printf "\e[1m\e[31mERROR: Navi GPUs must be using at max python 3.10, aborting...\e[0m" + printf "\e[1m\e[31mERROR: RX 5000 series GPUs must be using at max python 3.10, aborting...\e[0m" exit 1 fi ;; -- cgit v1.2.3 From 62860c221ef9a08b6c7231063ad8887c7157e9d1 Mon Sep 17 00:00:00 2001 From: DGdev91 Date: Tue, 6 Jun 2023 15:43:32 +0200 Subject: Skip force pyton and pytorch ver if TORCH_COMMAND already set --- webui.sh | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'webui.sh') diff --git a/webui.sh b/webui.sh index 15e65599..5c8d977c 100755 --- a/webui.sh +++ b/webui.sh @@ -114,16 +114,19 @@ fi # Check prerequisites gpu_info=$(lspci 2>/dev/null | grep -E "VGA|Display") case "$gpu_info" in - *"Navi 1"*) - pyv="$(${python_cmd} -c 'import sys; print(".".join(map(str, sys.version_info[0:2])))')" - if [[ $(bc <<< "$pyv <= 3.10") -eq 1 ]] + *"Navi 1"*) + export HSA_OVERRIDE_GFX_VERSION=10.3.0 + if [[ -z "${TORCH_COMMAND}" ]] then - export HSA_OVERRIDE_GFX_VERSION=10.3.0 - # Navi users will still use torch 1.13 because 2.0 does not seem to work. - export TORCH_COMMAND="pip install torch==1.13.1+rocm5.2 torchvision==0.14.1+rocm5.2 --index-url https://download.pytorch.org/whl/rocm5.2" - else - printf "\e[1m\e[31mERROR: RX 5000 series GPUs must be using at max python 3.10, aborting...\e[0m" - exit 1 + pyv="$(${python_cmd} -c 'import sys; print(".".join(map(str, sys.version_info[0:2])))')" + if [[ $(bc <<< "$pyv <= 3.10") -eq 1 ]] + then + # Navi users will still use torch 1.13 because 2.0 does not seem to work. + export TORCH_COMMAND="pip install torch==1.13.1+rocm5.2 torchvision==0.14.1+rocm5.2 --index-url https://download.pytorch.org/whl/rocm5.2" + else + printf "\e[1m\e[31mERROR: RX 5000 series GPUs must be using at max python 3.10, aborting...\e[0m" + exit 1 + fi fi ;; *"Navi 2"*) export HSA_OVERRIDE_GFX_VERSION=10.3.0 -- cgit v1.2.3