lym00 commited on
Commit
e0f8896
·
verified ·
1 Parent(s): e3fc793

Upload AutoInstall Pytorch Triton Sage.bat

Browse files
Files changed (1) hide show
  1. AutoInstall Pytorch Triton Sage.bat +180 -0
AutoInstall Pytorch Triton Sage.bat ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+ setlocal enabledelayedexpansion
3
+
4
+ REM === SETUP PATHS ===
5
+ set "ROOT=%CD%"
6
+ set "PYTHON=%ROOT%\ComfyUI_windows_portable\python_embeded\python.exe"
7
+ set "COMFY_DIR=%ROOT%\ComfyUI_windows_portable\ComfyUI"
8
+ set "UPDATE_DIR=%ROOT%\ComfyUI_windows_portable\update"
9
+
10
+ REM === CHECK PYTHON ===
11
+ if not exist "%PYTHON%" (
12
+ echo [ERROR] Python not found at: %PYTHON%
13
+ pause
14
+ exit /b 1
15
+ )
16
+
17
+ REM === SHOW SYSTEM INFO ===
18
+ echo.
19
+ echo ======== ComfyUI Nightly Installer (Interactive) ========
20
+ echo.
21
+
22
+ REM Python version
23
+ for /f "delims=" %%i in ('%PYTHON% -c "import platform; print(platform.python_version())"') do set PYVER=%%i
24
+ echo [INFO] Python Version: %PYVER%
25
+
26
+ REM Pip version
27
+ for /f "delims=" %%i in ('%PYTHON% -m pip --version') do set PIPVER=%%i
28
+ echo [INFO] Pip Version: %PIPVER%
29
+
30
+ REM CPU Cores
31
+ for /f %%i in ('powershell -NoProfile -Command "[Environment]::ProcessorCount"') do set "CPU_CORES=%%i"
32
+ if not defined CPU_CORES set "CPU_CORES=16"
33
+ echo [INFO] Detected CPU cores: %CPU_CORES%
34
+
35
+ REM CUDA Version
36
+ for /f "tokens=5 delims= " %%A in ('nvcc --version ^| findstr /C:"release"') do (
37
+ for /f "tokens=1 delims=," %%B in ("%%A") do set cuda_version=%%B
38
+ )
39
+ for /f "tokens=1 delims=." %%a in ("%cuda_version%") do set cuda_major=%%a
40
+ for /f "tokens=2 delims=." %%b in ("%cuda_version%") do set cuda_minor=%%b
41
+ set cuda_version=!cuda_major!.!cuda_minor!
42
+ set "CLEAN_CUDA=%cuda_version:.=%"
43
+ echo [INFO] Detected CUDA version: %cuda_version%
44
+
45
+ echo.
46
+ pause
47
+
48
+ REM === PROMPTS ===
49
+
50
+ REM Update pip and setuptools?
51
+ set UPDATE_PIP=false
52
+ echo.
53
+ set /p "inp=Do you want to update pip and set setuptools to 70.2.0? (y/n): "
54
+ if /i "!inp!"=="y" set UPDATE_PIP=true
55
+
56
+ REM Install PyTorch?
57
+ set INSTALL_TORCH=false
58
+ echo.
59
+ echo [1] Install PyTorch Nightly
60
+ echo [2] Install PyTorch Stable
61
+ echo [0] Skip PyTorch installation
62
+ set /p "torch_choice=Choose PyTorch version: "
63
+ if "!torch_choice!"=="1" set TORCH_NIGHTLY=true & set INSTALL_TORCH=true
64
+ if "!torch_choice!"=="2" set TORCH_NIGHTLY=false & set INSTALL_TORCH=true
65
+
66
+ REM Install Triton?
67
+ set INSTALL_TRITON=false
68
+ echo.
69
+ echo [0] Skip Triton
70
+ echo [1] Install Nightly Triton
71
+ echo [2] Install Stable Triton
72
+ echo [3] Install LeoMaxwell Triton
73
+ set /p "triton_choice=Choose Triton version: "
74
+ if not "!triton_choice!"=="0" set INSTALL_TRITON=true
75
+
76
+ REM Install SageAttention?
77
+ set INSTALL_SAGE=false
78
+ echo.
79
+ echo [1] Install SageAttention v1 (PyPI)
80
+ echo [2] Install SageAttention v2 (Build from GitHub)
81
+ echo [0] Skip SageAttention
82
+ set /p "sage_choice=Choose SageAttention version: "
83
+ if not "!sage_choice!"=="0" set INSTALL_SAGE=true
84
+
85
+ REM Update ComfyUI?
86
+ set UPDATE_COMFY=false
87
+ echo.
88
+ set /p "inp=Do you want to update ComfyUI via Git? (y/n): "
89
+ if /i "!inp!"=="y" set UPDATE_COMFY=true
90
+
91
+ REM Create Launcher?
92
+ set MAKE_LAUNCHER=false
93
+ echo.
94
+ set /p "inp=Do you want to generate a launcher batch file for FP16+Sage? (y/n): "
95
+ if /i "!inp!"=="y" set MAKE_LAUNCHER=true
96
+
97
+ REM === RUN CHOSEN INSTALLS ===
98
+
99
+ cd /d "%UPDATE_DIR%"
100
+
101
+ if "%UPDATE_PIP%"=="true" (
102
+ echo [INFO] Updating pip and installing setuptools==70.2.0
103
+ %PYTHON% -m pip install --upgrade pip setuptools==70.2.0
104
+ )
105
+
106
+ if "%INSTALL_TORCH%"=="true" (
107
+ echo [INFO] Uninstalling old PyTorch versions
108
+ %PYTHON% -m pip uninstall -y torch torchvision torchaudio
109
+
110
+ if "%TORCH_NIGHTLY%"=="true" (
111
+ echo [INFO] Installing PyTorch Nightly for CUDA %CLEAN_CUDA%
112
+ %PYTHON% -m pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu%CLEAN_CUDA%
113
+ ) else (
114
+ echo [INFO] Installing PyTorch Stable for CUDA %CLEAN_CUDA%
115
+ %PYTHON% -m pip install torch torchvision torchaudio
116
+ )
117
+ )
118
+
119
+ if "%INSTALL_TRITON%"=="true" (
120
+ if "%triton_choice%"=="1" (
121
+ echo Installing Triton Nightly
122
+ %PYTHON% -m pip install -U --pre triton-windows
123
+ ) else if "%triton_choice%"=="2" (
124
+ echo Installing Triton Stable
125
+ %PYTHON% -m pip install triton-windows
126
+ ) else if "%triton_choice%"=="3" (
127
+ echo Installing LeoMaxwell Triton
128
+ %PYTHON% -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
129
+ )
130
+ )
131
+
132
+ if "%INSTALL_SAGE%"=="true" (
133
+ if "%sage_choice%"=="1" (
134
+ echo Installing SageAttention v1
135
+ %PYTHON% -m pip install sageattention==1.0.6
136
+ ) else (
137
+ echo Installing SageAttention v2 from source
138
+ git clone https://github.com/thu-ml/SageAttention
139
+ cd SageAttention
140
+ set MAX_JOBS=%CPU_CORES%
141
+ %PYTHON% -m pip install .
142
+ cd ..
143
+ rmdir /s /q SageAttention
144
+ )
145
+ )
146
+
147
+ if "%UPDATE_COMFY%"=="true" (
148
+ echo Updating ComfyUI
149
+ pushd "%COMFY_DIR%"
150
+ git pull
151
+ popd
152
+ )
153
+
154
+ echo Installing ComfyUI Manager if not exists
155
+ cd /d "%COMFY_DIR%\custom_nodes"
156
+ if not exist ComfyUI-Manager (
157
+ git clone https://github.com/ltdrdata/ComfyUI-Manager.git
158
+ )
159
+
160
+ cd /d "%UPDATE_DIR%"
161
+ %PYTHON% update.py ..\ComfyUI\
162
+ if exist update_new.py (
163
+ move /y update_new.py update.py
164
+ %PYTHON% update.py ..\ComfyUI\ --skip_self_update
165
+ )
166
+
167
+ if "%MAKE_LAUNCHER%"=="true" (
168
+ echo Creating run_comfyui_fp16fast_sage.bat
169
+ set "LAUNCHER=%ROOT%\ComfyUI_windows_portable\run_comfyui_fp16fast_sage.bat"
170
+ (
171
+ echo call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
172
+ echo .\python_embeded\python.exe -s ComfyUI\main.py --use-sage-attention --windows-standalone-build --fast fp16_accumulation --listen 0.0.0.0
173
+ echo pause
174
+ ) > "%LAUNCHER%"
175
+ )
176
+
177
+ echo
178
+ echo All selected components installed. You may now run ComfyUI.
179
+ pause
180
+ exit /b