Update install.sh For Robustness

This commit is contained in:
XXXXRT666 2025-05-09 10:02:39 +01:00
parent 1aeca895d2
commit fcf16309b8
2 changed files with 23 additions and 28 deletions

View File

@ -16,15 +16,15 @@ WORKFLOW=${WORKFLOW:-"false"}
TARGETPLATFORM=${TARGETPLATFORM:-"linux/amd64"} TARGETPLATFORM=${TARGETPLATFORM:-"linux/amd64"}
if [ "$WORKFLOW" = "true" ]; then if [ "$WORKFLOW" = "true" ]; then
WGET_CMD="wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" WGET_CMD=(wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404)
else else
WGET_CMD="wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" WGET_CMD=(wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404)
fi fi
if [ "$TARGETPLATFORM" = "linux/amd64" ]; then if [ "$TARGETPLATFORM" = "linux/amd64" ]; then
eval "$WGET_CMD -O miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py311_25.3.1-1-Linux-x86_64.sh" "${WGET_CMD[@]}" -O miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py311_25.3.1-1-Linux-x86_64.sh
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then
eval "$WGET_CMD -O miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py311_25.3.1-1-Linux-aarch64.sh" "${WGET_CMD[@]}" -O miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py311_25.3.1-1-Linux-aarch64.sh
else else
exit 1 exit 1
fi fi

View File

@ -126,11 +126,13 @@ fi
# 安装构建工具 # 安装构建工具
# Install build tools # Install build tools
if [ "$(uname)" != "Darwin" ]; then if [ "$(uname)" != "Darwin" ]; then
echo "Installing GCC..." gcc_major_version=$(command -v gcc >/dev/null 2>&1 && gcc -dumpversion | cut -d. -f1 || echo 0)
conda install -c conda-forge gcc=14 -q -y if [ "$gcc_major_version" -lt 11 ]; then
echo "Installing GCC & G++..."
echo "Installing G++..." conda install -c conda-forge gcc=11 gxx=11 -q -y
conda install -c conda-forge gxx -q -y else
echo "GCC >=11"
fi
else else
if ! xcode-select -p &>/dev/null; then if ! xcode-select -p &>/dev/null; then
echo "Installing Xcode Command Line Tools..." echo "Installing Xcode Command Line Tools..."
@ -179,30 +181,27 @@ elif [ "$USE_MODELSCOPE" = "true" ]; then
fi fi
if [ "$WORKFLOW" = "true" ]; then if [ "$WORKFLOW" = "true" ]; then
WGET_CMD="wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" WGET_CMD=(wget -nv --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404)
else else
WGET_CMD="wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404" WGET_CMD=(wget --tries=25 --wait=5 --read-timeout=40 --retry-on-http-error=404)
fi fi
if find -L "GPT_SoVITS/pretrained_models" -mindepth 1 ! -name '.gitignore' | grep -q .; then if find -L "GPT_SoVITS/pretrained_models" -mindepth 1 ! -name '.gitignore' | grep -q .; then
echo "Pretrained Model Exists" echo "Pretrained Model Exists"
else else
echo "Download Pretrained Models" echo "Download Pretrained Models"
$WGET_CMD "$PRETRINED_URL" "${WGET_CMD[@]}" "$PRETRINED_URL"
unzip -q pretrained_models.zip unzip -q -o pretrained_models.zip -d GPT_SoVITS
rm -rf pretrained_models.zip rm -rf pretrained_models.zip
mv -f pretrained_models/* GPT_SoVITS/pretrained_models
rm -rf pretrained_models
fi fi
if [ ! -d "GPT_SoVITS/text/G2PWModel" ]; then if [ ! -d "GPT_SoVITS/text/G2PWModel" ]; then
echo "Download G2PWModel" echo "Download G2PWModel"
$WGET_CMD "$G2PW_URL" "${WGET_CMD[@]}" "$G2PW_URL"
unzip -q G2PWModel.zip unzip -q -o G2PWModel.zip -d GPT_SoVITS/text
rm -rf G2PWModel.zip rm -rf G2PWModel.zip
mv -f G2PWModel GPT_SoVITS/text/G2PWModel
else else
echo "G2PWModel Exists" echo "G2PWModel Exists"
fi fi
@ -212,12 +211,10 @@ if [ "$DOWNLOAD_UVR5" = "true" ]; then
echo "UVR5 Model Exists" echo "UVR5 Model Exists"
else else
echo "Download UVR5 Model" echo "Download UVR5 Model"
$WGET_CMD "$UVR5_URL" "${WGET_CMD[@]}" "$UVR5_URL"
unzip -q uvr5_weights.zip unzip -q -o uvr5_weights.zip -d tools/uvr5
rm -rf uvr5_weights.zip rm -rf uvr5_weights.zip
mv-f uvr5_weights/* tools/uvr5/uvr5_weights
rm -rf uvr5_weights
fi fi
fi fi
@ -281,15 +278,13 @@ pip install -r requirements.txt --quiet
PY_PREFIX=$(python -c "import sys; print(sys.prefix)") PY_PREFIX=$(python -c "import sys; print(sys.prefix)")
PYOPENJTALK_PREFIX=$(python -c "import os, pyopenjtalk; print(os.path.dirname(pyopenjtalk.__file__))") PYOPENJTALK_PREFIX=$(python -c "import os, pyopenjtalk; print(os.path.dirname(pyopenjtalk.__file__))")
$WGET_CMD "$NLTK_URL" "${WGET_CMD[@]}" "$NLTK_URL" -O nltk_data.zip
unzip -q nltk_data unzip -q -o nltk_data -d "$PY_PREFIX"
rm -rf nltk_data.zip rm -rf nltk_data.zip
mv -f nltk_data "$PY_PREFIX"
$WGET_CMD "$PYOPENJTALK_URL" "${WGET_CMD[@]}" "$PYOPENJTALK_URL" -O open_jtalk_dic_utf_8-1.11.tar.gz
tar -xvzf open_jtalk_dic_utf_8-1.11.tar.gz tar -xvzf open_jtalk_dic_utf_8-1.11.tar.gz -C "$PYOPENJTALK_PREFIX"
rm -rf open_jtalk_dic_utf_8-1.11.tar.gz rm -rf open_jtalk_dic_utf_8-1.11.tar.gz
mv -f open_jtalk_dic_utf_8-1.11 "$PYOPENJTALK_PREFIX"
if [ "$USE_ROCM" = true ] && [ "$IS_WSL" = true ]; then if [ "$USE_ROCM" = true ] && [ "$IS_WSL" = true ]; then
echo "Update to WSL compatible runtime lib..." echo "Update to WSL compatible runtime lib..."