Use CUDA-specific torch only on Linux, not mac

This commit is contained in:
cmdr2 2023-03-17 13:20:37 +05:30
parent 28338612fa
commit 0324deec60

View File

@ -56,6 +56,13 @@ if [ -e "GFPGANv1.3.pth" ]; then mv GFPGANv1.3.pth ../models/gfpgan/; fi
if [ -e "RealESRGAN_x4plus.pth" ]; then mv RealESRGAN_x4plus.pth ../models/realesrgan/; fi
if [ -e "RealESRGAN_x4plus_anime_6B.pth" ]; then mv RealESRGAN_x4plus_anime_6B.pth ../models/realesrgan/; fi
OS_NAME=$(uname -s)
case "${OS_NAME}" in
Linux*) OS_NAME="linux";;
Darwin*) OS_NAME="macos";;
*) echo "Unknown OS: $OS_NAME! This script runs only on Linux or Mac" && exit
esac
# install torch and torchvision
if python ../scripts/check_modules.py torch torchvision; then
echo "torch and torchvision have already been installed."
@ -65,10 +72,18 @@ else
export PYTHONNOUSERSITE=1
export PYTHONPATH="$INSTALL_ENV_DIR/lib/python3.8/site-packages"
if python -m pip install --upgrade torch==1.13.1+cu116 torchvision==0.14.1+cu116 --extra-index-url https://download.pytorch.org/whl/cu116 ; then
echo "Installed."
else
fail "torch install failed"
if [ "$OS_NAME" == "linux" ]; then
if python -m pip install --upgrade torch==1.13.1+cu116 torchvision==0.14.1+cu116 --extra-index-url https://download.pytorch.org/whl/cu116 ; then
echo "Installed."
else
fail "torch install failed"
fi
elif [ "$OS_NAME" == "macos" ]; then
if python -m pip install --upgrade torch==1.13.1 torchvision==0.14.1 ; then
echo "Installed."
else
fail "torch install failed"
fi
fi
fi