From 810ff3ffb12b1fefb881774f92dae7b8fc9930df Mon Sep 17 00:00:00 2001 From: Jeffreytsai1004 Date: Tue, 18 Feb 2025 01:07:41 +0800 Subject: [PATCH] Update download_resource.bat --- download_resource.bat | 82 +++++++++---------------------------------- 1 file changed, 16 insertions(+), 66 deletions(-) diff --git a/download_resource.bat b/download_resource.bat index 2923f4e..b2e8051 100644 --- a/download_resource.bat +++ b/download_resource.bat @@ -1,105 +1,55 @@ @echo off +chcp 437 >nul setlocal enabledelayedexpansion -REM 设置环境变量 +REM Set environment variables set "PROJECT_DIR=%~dp0" set "PYTHONDONTWRITEBYTECODE=1" set "GDOWN_CACHE=%PROJECT_DIR%\cache\gdown" set "TORCH_HOME=%PROJECT_DIR%\cache\torch" set "HF_HOME=%PROJECT_DIR%\cache\huggingface" -REM 检查 Python +REM Check Python python --version >nul 2>&1 if %ERRORLEVEL% neq 0 ( echo ERROR: Python not found exit /b 1 ) -REM 创建缓存目录 +REM Create directories mkdir "%PROJECT_DIR%\cache\gdown" 2>nul mkdir "%PROJECT_DIR%\cache\torch" 2>nul mkdir "%PROJECT_DIR%\cache\huggingface" 2>nul - -REM 创建资源目录 mkdir "%PROJECT_DIR%\resource\NeuralHaircut\pretrained_models\diffusion_prior" 2>nul -mkdir "%PROJECT_DIR%\resource\NeuralHaircut\pretrained_models\strand_prior" 2>nul mkdir "%PROJECT_DIR%\resource\NeuralHaircut\PIXIE" 2>nul mkdir "%PROJECT_DIR%\resource\Matte-Anything\pretrained" 2>nul mkdir "%PROJECT_DIR%\resource\openpose\models" 2>nul mkdir "%PROJECT_DIR%\resource\hyperIQA\pretrained" 2>nul -REM 安装gdown -python -m pip install --upgrade pip -python -m pip install gdown +REM Install gdown +python -m pip install --upgrade pip gdown -REM 添加目录存在性检查 -if not exist "%PROJECT_DIR%\ext" mkdir "%PROJECT_DIR%\ext" -if not exist "%PROJECT_DIR%\cache" mkdir "%PROJECT_DIR%\cache" -if not exist "%PROJECT_DIR%\resource" mkdir "%PROJECT_DIR%\resource" - -REM 下载 NeuralHaircut 模型文件 +REM Download model files cd "%PROJECT_DIR%\resource\NeuralHaircut" -python -m gdown --folder https://drive.google.com/drive/folders/1TCdJ0CKR3Q6LviovndOkJaKm8S1T9F_8 -if %ERRORLEVEL% neq 0 ( - echo ERROR: Failed to download NeuralHaircut models - exit /b 1 -) +python -m gdown --folder https://drive.google.com/drive/folders/1TCdJ0CKR3Q6LviovndOkJaKm8S1T9F_8 || exit /b 1 cd "%PROJECT_DIR%\resource\NeuralHaircut\pretrained_models\diffusion_prior" -python -m gdown 1_9EOUXHayKiGH5nkrayncln3d6m1uV7f -if %ERRORLEVEL% neq 0 ( - echo ERROR: Failed to download diffusion prior model - exit /b 1 -) +python -m gdown 1_9EOUXHayKiGH5nkrayncln3d6m1uV7f || exit /b 1 cd "%PROJECT_DIR%\resource\NeuralHaircut\PIXIE" -python -m gdown 1mPcGu62YPc4MdkT8FFiOCP629xsENHZf -if %ERRORLEVEL% neq 0 ( - echo ERROR: Failed to download PIXIE model - exit /b 1 -) +python -m gdown 1mPcGu62YPc4MdkT8FFiOCP629xsENHZf || exit /b 1 -REM 下载 hyperIQA 模型文件 cd "%PROJECT_DIR%\resource\hyperIQA\pretrained" -python -m gdown 1OOUmnbvpGea0LIGpIWEbOyxfWx6UCiiE -if %ERRORLEVEL% neq 0 ( - echo ERROR: Failed to download hyperIQA model - exit /b 1 -) +python -m gdown 1OOUmnbvpGea0LIGpIWEbOyxfWx6UCiiE || exit /b 1 -REM 下载 Matte-Anything 模型文件 cd "%PROJECT_DIR%\resource\Matte-Anything\pretrained" -curl -L https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth -o sam_vit_h_4b8939.pth -if %ERRORLEVEL% neq 0 ( - echo ERROR: Failed to download SAM model - exit /b 1 -) +curl -L https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth -o sam_vit_h_4b8939.pth || exit /b 1 +curl -L https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha/groundingdino_swint_ogc.pth -o groundingdino_swint_ogc.pth || exit /b 1 +python -m gdown 1d97oKuITCeWgai2Tf3iNilt6rMSSYzkW || exit /b 1 -curl -L https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha/groundingdino_swint_ogc.pth -o groundingdino_swint_ogc.pth -if %ERRORLEVEL% neq 0 ( - echo ERROR: Failed to download GroundingDINO model - exit /b 1 -) - -python -m gdown 1d97oKuITCeWgai2Tf3iNilt6rMSSYzkW -if %ERRORLEVEL% neq 0 ( - echo ERROR: Failed to download Matte-Anything model - exit /b 1 -) - -REM 下载 OpenPose 模型文件 cd "%PROJECT_DIR%\resource\openpose" -python -m gdown 1Yn03cKKfVOq4qXmgBMQD20UMRRRkd_tV -if %ERRORLEVEL% neq 0 ( - echo ERROR: Failed to download OpenPose models - exit /b 1 -) - -tar -xf models.tar.gz -if %ERRORLEVEL% neq 0 ( - echo ERROR: Failed to extract OpenPose models - exit /b 1 -) +python -m gdown 1Yn03cKKfVOq4qXmgBMQD20UMRRRkd_tV || exit /b 1 +tar -xf models.tar.gz || exit /b 1 cd "%PROJECT_DIR%" echo All resources downloaded successfully!