From cbf4b3472b1da35937ff12c06072214a2e5cbad7 Mon Sep 17 00:00:00 2001 From: DaniAndTheWeb <57776841+DaniAndTheWeb@users.noreply.github.com> Date: Fri, 13 Jan 2023 19:18:56 +0100 Subject: Automatic launch argument for AMD GPUs This commit adds a few lines to detect if the system has an AMD gpu and adds an environment variable needed for torch to recognize the gpu. --- webui.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'webui.sh') diff --git a/webui.sh b/webui.sh index c4d6521d..23629ef9 100755 --- a/webui.sh +++ b/webui.sh @@ -165,5 +165,11 @@ else printf "\n%s\n" "${delimiter}" printf "Launching launch.py..." printf "\n%s\n" "${delimiter}" - exec "${python_cmd}" "${LAUNCH_SCRIPT}" "$@" + gpu_info=$(lspci | grep VGA) + if echo "$gpu_info" | grep -q "AMD" + then + HSA_OVERRIDE_GFX_VERSION=10.3.0 exec "${python_cmd}" "${LAUNCH_SCRIPT}" "$@" + else + exec "${python_cmd}" "${LAUNCH_SCRIPT}" "$@" + fi fi -- cgit v1.2.3 From 6192a222bf7131771a2cd7655a64a5b24a1e6e2e Mon Sep 17 00:00:00 2001 From: DaniAndTheWeb <57776841+DaniAndTheWeb@users.noreply.github.com> Date: Sat, 14 Jan 2023 15:46:23 +0100 Subject: Export TORCH_COMMAND for AMD from the webui --- webui.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'webui.sh') diff --git a/webui.sh b/webui.sh index 23629ef9..35f52f2a 100755 --- a/webui.sh +++ b/webui.sh @@ -168,6 +168,7 @@ else gpu_info=$(lspci | grep VGA) if echo "$gpu_info" | grep -q "AMD" then + export TORCH_COMMAND="pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/rocm5.2" HSA_OVERRIDE_GFX_VERSION=10.3.0 exec "${python_cmd}" "${LAUNCH_SCRIPT}" "$@" else exec "${python_cmd}" "${LAUNCH_SCRIPT}" "$@" -- cgit v1.2.3 From c4ba34928ec7f977585494f0fa5925496c887698 Mon Sep 17 00:00:00 2001 From: DaniAndTheWeb <57776841+DaniAndTheWeb@users.noreply.github.com> Date: Sat, 14 Jan 2023 15:58:50 +0100 Subject: Quick format fix --- webui.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'webui.sh') diff --git a/webui.sh b/webui.sh index 35f52f2a..fcba6b7d 100755 --- a/webui.sh +++ b/webui.sh @@ -168,7 +168,7 @@ else gpu_info=$(lspci | grep VGA) if echo "$gpu_info" | grep -q "AMD" then - export TORCH_COMMAND="pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/rocm5.2" + export TORCH_COMMAND="pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/rocm5.2" HSA_OVERRIDE_GFX_VERSION=10.3.0 exec "${python_cmd}" "${LAUNCH_SCRIPT}" "$@" else exec "${python_cmd}" "${LAUNCH_SCRIPT}" "$@" -- cgit v1.2.3 From 2e172cf831a928223e93803b94896325bd4c22a7 Mon Sep 17 00:00:00 2001 From: DaniAndTheWeb <57776841+DaniAndTheWeb@users.noreply.github.com> Date: Sat, 14 Jan 2023 22:25:32 +0100 Subject: Only set TORCH_COMMAND if wasn't set webui-user --- webui.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'webui.sh') diff --git a/webui.sh b/webui.sh index fcba6b7d..35542ed6 100755 --- a/webui.sh +++ b/webui.sh @@ -168,7 +168,10 @@ else gpu_info=$(lspci | grep VGA) if echo "$gpu_info" | grep -q "AMD" then - export TORCH_COMMAND="pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/rocm5.2" + if [ -z ${TORCH_COMMAND+x} ] + then + export TORCH_COMMAND="pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/rocm5.2" + fi HSA_OVERRIDE_GFX_VERSION=10.3.0 exec "${python_cmd}" "${LAUNCH_SCRIPT}" "$@" else exec "${python_cmd}" "${LAUNCH_SCRIPT}" "$@" -- cgit v1.2.3 From ba077e2110cab891a46d14665fb161ce0669f31e Mon Sep 17 00:00:00 2001 From: DaniAndTheWeb <57776841+DaniAndTheWeb@users.noreply.github.com> Date: Sat, 14 Jan 2023 23:19:52 +0100 Subject: Fix TORCH_COMMAND check --- webui.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'webui.sh') diff --git a/webui.sh b/webui.sh index 35542ed6..6e07778f 100755 --- a/webui.sh +++ b/webui.sh @@ -168,7 +168,7 @@ else gpu_info=$(lspci | grep VGA) if echo "$gpu_info" | grep -q "AMD" then - if [ -z ${TORCH_COMMAND+x} ] + if [[ -z "${TORCH_COMMAND}" ]] then export TORCH_COMMAND="pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/rocm5.2" fi -- cgit v1.2.3