Spaces:
Runtime error
Runtime error
Commit
·
1027a13
1
Parent(s):
8a22daf
Delete webui.sh
Browse files
webui.sh
DELETED
@@ -1,140 +0,0 @@
|
|
1 |
-
#!/usr/bin/env bash
|
2 |
-
|
3 |
-
|
4 |
-
# If run from macOS, load defaults from webui-macos-env.sh
|
5 |
-
if [[ "$OSTYPE" == "darwin"* ]]; then
|
6 |
-
export TORCH_COMMAND="pip install torch==1.12.1 torchvision==0.13.1"
|
7 |
-
fi
|
8 |
-
|
9 |
-
# python3 executable
|
10 |
-
if [[ -z "${python_cmd}" ]]
|
11 |
-
then
|
12 |
-
python_cmd="python3"
|
13 |
-
fi
|
14 |
-
|
15 |
-
# git executable
|
16 |
-
if [[ -z "${GIT}" ]]
|
17 |
-
then
|
18 |
-
export GIT="git"
|
19 |
-
fi
|
20 |
-
|
21 |
-
# python3 venv without trailing slash (defaults to ${install_dir}/${clone_dir}/venv)
|
22 |
-
if [[ -z "${venv_dir}" ]]
|
23 |
-
then
|
24 |
-
venv_dir="venv"
|
25 |
-
fi
|
26 |
-
|
27 |
-
if [[ -z "${LAUNCH_SCRIPT}" ]]
|
28 |
-
then
|
29 |
-
LAUNCH_SCRIPT="launcher.py"
|
30 |
-
fi
|
31 |
-
|
32 |
-
# this script cannot be run as root by default
|
33 |
-
can_run_as_root=1
|
34 |
-
|
35 |
-
# read any command line flags to the webui.sh script
|
36 |
-
while getopts "f" flag > /dev/null 2>&1
|
37 |
-
do
|
38 |
-
case ${flag} in
|
39 |
-
f) can_run_as_root=1;;
|
40 |
-
*) break;;
|
41 |
-
esac
|
42 |
-
done
|
43 |
-
|
44 |
-
# Disable sentry logging
|
45 |
-
export ERROR_REPORTING=FALSE
|
46 |
-
|
47 |
-
# Do not reinstall existing pip packages on Debian/Ubuntu
|
48 |
-
export PIP_IGNORE_INSTALLED=0
|
49 |
-
|
50 |
-
# Pretty print
|
51 |
-
delimiter="################################################################"
|
52 |
-
|
53 |
-
printf "\n%s\n" "${delimiter}"
|
54 |
-
printf "\e[1m\e[32mInstall script for SadTalker + Web UI\n"
|
55 |
-
printf "\e[1m\e[34mTested on Debian 11 (Bullseye)\e[0m"
|
56 |
-
printf "\n%s\n" "${delimiter}"
|
57 |
-
|
58 |
-
# Do not run as root
|
59 |
-
if [[ $(id -u) -eq 0 && can_run_as_root -eq 0 ]]
|
60 |
-
then
|
61 |
-
printf "\n%s\n" "${delimiter}"
|
62 |
-
printf "\e[1m\e[31mERROR: This script must not be launched as root, aborting...\e[0m"
|
63 |
-
printf "\n%s\n" "${delimiter}"
|
64 |
-
exit 1
|
65 |
-
else
|
66 |
-
printf "\n%s\n" "${delimiter}"
|
67 |
-
printf "Running on \e[1m\e[32m%s\e[0m user" "$(whoami)"
|
68 |
-
printf "\n%s\n" "${delimiter}"
|
69 |
-
fi
|
70 |
-
|
71 |
-
if [[ -d .git ]]
|
72 |
-
then
|
73 |
-
printf "\n%s\n" "${delimiter}"
|
74 |
-
printf "Repo already cloned, using it as install directory"
|
75 |
-
printf "\n%s\n" "${delimiter}"
|
76 |
-
install_dir="${PWD}/../"
|
77 |
-
clone_dir="${PWD##*/}"
|
78 |
-
fi
|
79 |
-
|
80 |
-
# Check prerequisites
|
81 |
-
gpu_info=$(lspci 2>/dev/null | grep VGA)
|
82 |
-
case "$gpu_info" in
|
83 |
-
*"Navi 1"*|*"Navi 2"*) export HSA_OVERRIDE_GFX_VERSION=10.3.0
|
84 |
-
;;
|
85 |
-
*"Renoir"*) export HSA_OVERRIDE_GFX_VERSION=9.0.0
|
86 |
-
printf "\n%s\n" "${delimiter}"
|
87 |
-
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"
|
88 |
-
printf "\n%s\n" "${delimiter}"
|
89 |
-
;;
|
90 |
-
*)
|
91 |
-
;;
|
92 |
-
esac
|
93 |
-
if echo "$gpu_info" | grep -q "AMD" && [[ -z "${TORCH_COMMAND}" ]]
|
94 |
-
then
|
95 |
-
export TORCH_COMMAND="pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/rocm5.2"
|
96 |
-
fi
|
97 |
-
|
98 |
-
for preq in "${GIT}" "${python_cmd}"
|
99 |
-
do
|
100 |
-
if ! hash "${preq}" &>/dev/null
|
101 |
-
then
|
102 |
-
printf "\n%s\n" "${delimiter}"
|
103 |
-
printf "\e[1m\e[31mERROR: %s is not installed, aborting...\e[0m" "${preq}"
|
104 |
-
printf "\n%s\n" "${delimiter}"
|
105 |
-
exit 1
|
106 |
-
fi
|
107 |
-
done
|
108 |
-
|
109 |
-
if ! "${python_cmd}" -c "import venv" &>/dev/null
|
110 |
-
then
|
111 |
-
printf "\n%s\n" "${delimiter}"
|
112 |
-
printf "\e[1m\e[31mERROR: python3-venv is not installed, aborting...\e[0m"
|
113 |
-
printf "\n%s\n" "${delimiter}"
|
114 |
-
exit 1
|
115 |
-
fi
|
116 |
-
|
117 |
-
printf "\n%s\n" "${delimiter}"
|
118 |
-
printf "Create and activate python venv"
|
119 |
-
printf "\n%s\n" "${delimiter}"
|
120 |
-
cd "${install_dir}"/"${clone_dir}"/ || { printf "\e[1m\e[31mERROR: Can't cd to %s/%s/, aborting...\e[0m" "${install_dir}" "${clone_dir}"; exit 1; }
|
121 |
-
if [[ ! -d "${venv_dir}" ]]
|
122 |
-
then
|
123 |
-
"${python_cmd}" -m venv "${venv_dir}"
|
124 |
-
first_launch=1
|
125 |
-
fi
|
126 |
-
# shellcheck source=/dev/null
|
127 |
-
if [[ -f "${venv_dir}"/bin/activate ]]
|
128 |
-
then
|
129 |
-
source "${venv_dir}"/bin/activate
|
130 |
-
else
|
131 |
-
printf "\n%s\n" "${delimiter}"
|
132 |
-
printf "\e[1m\e[31mERROR: Cannot activate python venv, aborting...\e[0m"
|
133 |
-
printf "\n%s\n" "${delimiter}"
|
134 |
-
exit 1
|
135 |
-
fi
|
136 |
-
|
137 |
-
printf "\n%s\n" "${delimiter}"
|
138 |
-
printf "Launching launcher.py..."
|
139 |
-
printf "\n%s\n" "${delimiter}"
|
140 |
-
exec "${python_cmd}" "${LAUNCH_SCRIPT}" "$@"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|