Download autoinstall_pytorch_triton_sage.bat from lym00/scripts: direct link, hf CLI and curl.
- Browser
- Download file 8.33 kB
-
https://huggingface.co/lym00/scripts/resolve/main/autoinstall_pytorch_triton_sage.bat
- Command line
-
hf download hf://lym00/scripts/autoinstall_pytorch_triton_sage.bat
-
curl -L -o autoinstall_pytorch_triton_sage.bat https://huggingface.co/lym00/scripts/resolve/main/autoinstall_pytorch_triton_sage.bat
8.33 kB
| @echo off | |
| setlocal enabledelayedexpansion | |
| REM === SETUP PATHS === | |
| set "ROOT=%CD%" | |
| set "PYTHON=%ROOT%\ComfyUI_windows_portable\python_embeded\python.exe" | |
| set "COMFY_DIR=%ROOT%\ComfyUI_windows_portable\ComfyUI" | |
| set "UPDATE_DIR=%ROOT%\ComfyUI_windows_portable\update" | |
| REM === CHECK PYTHON === | |
| if not exist "%PYTHON%" ( | |
| echo [ERROR] Python not found at: %PYTHON% | |
| pause | |
| exit /b 1 | |
| ) | |
| REM === SHOW SYSTEM INFO === | |
| echo. | |
| echo ======== ComfyUI Nightly Installer (Interactive) ======== | |
| echo. | |
| REM Python version | |
| for /f "delims=" %%i in ('%PYTHON% -c "import platform; print(platform.python_version())"') do set PYVER=%%i | |
| echo [INFO] Python Version: %PYVER% | |
| REM Pip version | |
| for /f "delims=" %%i in ('%PYTHON% -s -m pip --version') do set PIPVER=%%i | |
| echo [INFO] Pip Version: %PIPVER% | |
| REM CPU Cores | |
| for /f %%i in ('powershell -NoProfile -Command "[Environment]::ProcessorCount"') do set "CPU_CORES=%%i" | |
| if not defined CPU_CORES set "CPU_CORES=16" | |
| echo [INFO] Detected CPU cores: %CPU_CORES% | |
| REM CUDA Version | |
| for /f "tokens=5 delims= " %%A in ('nvcc --version ^| findstr /C:"release"') do ( | |
| for /f "tokens=1 delims=," %%B in ("%%A") do set cuda_version=%%B | |
| ) | |
| for /f "tokens=1 delims=." %%a in ("%cuda_version%") do set cuda_major=%%a | |
| for /f "tokens=2 delims=." %%b in ("%cuda_version%") do set cuda_minor=%%b | |
| set cuda_version=!cuda_major!.!cuda_minor! | |
| set "CLEAN_CUDA=%cuda_version:.=%" | |
| echo [INFO] Detected CUDA version: %cuda_version% | |
| echo. | |
| pause | |
| REM === PROMPTS === | |
| REM Update pip and setuptools? | |
| set UPDATE_PIP=false | |
| echo. | |
| set /p "inp=Do you want to update pip and set setuptools to 70.2.0? (y/n): " | |
| if /i "!inp!"=="y" set UPDATE_PIP=true | |
| REM Update ComfyUI? | |
| set UPDATE_COMFY=false | |
| echo. | |
| set /p "inp=Do you want to update ComfyUI via Git? (y/n): " | |
| if /i "!inp!"=="y" set UPDATE_COMFY=true | |
| REM Create Launcher? | |
| set MAKE_LAUNCHER=false | |
| echo. | |
| set /p "inp=Do you want to generate a launcher batch file for FP16+Sage? (y/n): " | |
| if /i "!inp!"=="y" set MAKE_LAUNCHER=true | |
| REM Install PyTorch? | |
| set INSTALL_TORCH=false | |
| set TORCH_NIGHTLY=false | |
| set TORCH_MANUAL=false | |
| echo. | |
| echo [1] Install PyTorch Nightly Latest (auto) | |
| echo [2] Install PyTorch Nightly manually (specify version) | |
| echo [3] Install PyTorch Stable | |
| echo [0] Skip PyTorch installation | |
| set /p "torch_choice=Choose PyTorch install option: " | |
| if "%torch_choice%"=="1" ( | |
| set INSTALL_TORCH=true | |
| set TORCH_NIGHTLY=true | |
| set TORCH_MANUAL=false | |
| ) else if "%torch_choice%"=="2" ( | |
| set INSTALL_TORCH=true | |
| set TORCH_NIGHTLY=true | |
| set TORCH_MANUAL=true | |
| ) else if "%torch_choice%"=="3" ( | |
| set INSTALL_TORCH=true | |
| set TORCH_NIGHTLY=false | |
| set TORCH_MANUAL=false | |
| ) | |
| REM Install Triton? | |
| set INSTALL_TRITON=false | |
| echo. | |
| echo [1] Install Nightly Triton | |
| echo [2] Install Stable Triton | |
| echo [3] Install LeoMaxwell Triton | |
| echo [0] Skip Triton | |
| set /p "triton_choice=Choose Triton version: " | |
| if not "!triton_choice!"=="0" set INSTALL_TRITON=true | |
| REM Install SageAttention? | |
| set INSTALL_SAGE=false | |
| echo. | |
| echo [1] Install SageAttention v1 (PyPI) | |
| echo [2] Install SageAttention v2 (Build from GitHub) | |
| echo [0] Skip SageAttention | |
| set /p "sage_choice=Choose SageAttention version: " | |
| if not "!sage_choice!"=="0" set INSTALL_SAGE=true | |
| REM === RUN CHOSEN INSTALLS === | |
| cd /d "%UPDATE_DIR%" | |
| if "%UPDATE_PIP%"=="true" ( | |
| echo [INFO] Updating pip and installing setuptools==70.2.0 | |
| %PYTHON% -s -m pip install --upgrade pip setuptools==70.2.0 | |
| ) | |
| if "%INSTALL_TORCH%"=="true" ( | |
| echo [INFO] Uninstalling old Torch versions | |
| %PYTHON% -s -m pip uninstall -y torch torchvision torchaudio | |
| if "%TORCH_NIGHTLY%"=="true" ( | |
| if "%TORCH_MANUAL%"=="true" ( | |
| echo. | |
| echo [INFO] Manual Nightly Installation | |
| echo Visit the following URLs to find the latest compatible versions: | |
| echo Torch: https://download.pytorch.org/whl/nightly/cu!CLEAN_CUDA!/torch/ | |
| echo Torchaudio: https://download.pytorch.org/whl/nightly/cu!CLEAN_CUDA!/torchaudio/ | |
| echo Torchvision:https://download.pytorch.org/whl/nightly/cu!CLEAN_CUDA!/torchvision/ | |
| echo. | |
| set /p "TORCH_VER=Enter base torch version (e.g. torch-2.9.0.dev20250715): " | |
| set /p "AUDIO_VER=Enter base torchaudio version (e.g. torchaudio-2.8.0.dev20250716): " | |
| set /p "VISION_VER=Enter base torchvision version (e.g. torchvision-0.24.0.dev20250716): " | |
| for /f "tokens=1,2 delims=." %%a in ("%PYVER%") do ( | |
| set "TMP_PY_MAJ=%%a" | |
| set "TMP_PY_MIN=%%b" | |
| ) | |
| set "PY_MAJ=!TMP_PY_MAJ!" | |
| set "PY_MIN=!TMP_PY_MIN!" | |
| set "PY_TAG=cp!PY_MAJ!!PY_MIN!-cp!PY_MAJ!!PY_MIN!" | |
| set "WHEEL_SUFFIX=%%2Bcu!CLEAN_CUDA!-!PY_TAG!-win_amd64.whl" | |
| set "TORCH_URL=https://download.pytorch.org/whl/nightly/cu!CLEAN_CUDA!/!TORCH_VER!!WHEEL_SUFFIX!" | |
| set "AUDIO_URL=https://download.pytorch.org/whl/nightly/cu!CLEAN_CUDA!/!AUDIO_VER!!WHEEL_SUFFIX!" | |
| set "VISION_URL=https://download.pytorch.org/whl/nightly/cu!CLEAN_CUDA!/!VISION_VER!!WHEEL_SUFFIX!" | |
| echo. | |
| echo [INFO] Installing manually specified wheels... | |
| echo Torch: !TORCH_URL! | |
| echo Torchaudio: !AUDIO_URL! | |
| echo Torchvision:!VISION_URL! | |
| %PYTHON% -s -m pip install "!TORCH_URL!" "!AUDIO_URL!" "!VISION_URL!" | |
| ) else ( | |
| echo [INFO] Installing PyTorch Nightly for CUDA %CLEAN_CUDA% | |
| %PYTHON% -s -m pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu%CLEAN_CUDA% | |
| ) | |
| ) else ( | |
| echo [INFO] Installing PyTorch Stable for CUDA %CLEAN_CUDA% | |
| %PYTHON% -s -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu%CLEAN_CUDA% | |
| ) | |
| ) | |
| if "%INSTALL_TRITON%"=="true" ( | |
| echo [INFO] Uninstalling old Triton versions | |
| %PYTHON% -s -m pip uninstall -y triton triton-windows | |
| if "%triton_choice%"=="1" ( | |
| echo Installing Triton Nightly | |
| %PYTHON% -s -m pip install -U --pre triton-windows | |
| ) else if "%triton_choice%"=="2" ( | |
| echo Installing Triton Stable | |
| %PYTHON% -s -m pip install triton-windows | |
| ) else if "%triton_choice%"=="3" ( | |
| echo Installing LeoMaxwell Triton | |
| %PYTHON% -s -m pip install https://github.com/leomaxwell973/Triton-3.3.0-UPDATE_FROM_3.2.0_and_FIXED-Windows-Nvidia-Prebuilt/releases/download/3.3.0_cu128_Py312/triton-3.3.0-cp312-cp312-win_amd64.whl | |
| ) | |
| ) | |
| if "%INSTALL_SAGE%"=="true" ( | |
| echo [INFO] Uninstalling old SageAttention versions | |
| %PYTHON% -s -m pip uninstall -y sageattention | |
| if "%sage_choice%"=="1" ( | |
| echo Installing SageAttention v1 | |
| %PYTHON% -s -m pip install sageattention==1.0.6 | |
| ) else ( | |
| echo Installing SageAttention v2 from source | |
| cd "%UPDATE_DIR%" | |
| git clone https://github.com/thu-ml/SageAttention | |
| cd SageAttention | |
| set MAX_JOBS=%CPU_CORES% | |
| %PYTHON% -s -m pip install . | |
| cd .. | |
| rmdir /s /q SageAttention | |
| ) | |
| ) | |
| if "%UPDATE_COMFY%"=="true" ( | |
| echo Updating ComfyUI | |
| pushd "%COMFY_DIR%" | |
| git pull | |
| popd | |
| ) | |
| echo Installing ComfyUI Manager if not exists | |
| cd /d "%COMFY_DIR%\custom_nodes" | |
| if not exist ComfyUI-Manager ( | |
| git clone https://github.com/ltdrdata/ComfyUI-Manager.git | |
| ) | |
| cd /d "%UPDATE_DIR%" | |
| %PYTHON% update.py ..\ComfyUI\ | |
| if exist update_new.py ( | |
| move /y update_new.py update.py | |
| %PYTHON% update.py ..\ComfyUI\ --skip_self_update | |
| ) | |
| if "%MAKE_LAUNCHER%"=="true" ( | |
| echo Creating run_comfyui_fp16fast_sage.bat | |
| set "LAUNCHER=%ROOT%\ComfyUI_windows_portable\run_comfyui_fp16fast_sage.bat" | |
| ( | |
| echo call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" | |
| echo .\python_embeded\python.exe -s ComfyUI\main.py --use-sage-attention --windows-standalone-build --fast fp16_accumulation --listen 0.0.0.0 | |
| echo pause | |
| ) > "%LAUNCHER%" | |
| ) | |
| echo. | |
| echo All selected components installed. You may now run ComfyUI. | |
| pause | |
| exit /b | |