File size: 22,572 Bytes
9064572
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
@echo off
setlocal enabledelayedexpansion

set "installPath=%CD%"
set "basePath=%installPath%\ComfyUI_windows_portable"
set "comfyPath=%basePath%\ComfyUI"
set "customNodesPath=%comfyPath%\custom_nodes"
set "modelsPath=%comfyPath%\models"

if not exist "%installPath%\logs" mkdir "%installPath%\logs"

curl -L -o banner.txt https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/others/banner.txt?download=true >> "%installPath%\logs\install.txt" 2>&1
echo -------------------------------------------------------------------------------
type banner.txt
echo -------------------------------------------------------------------------------
echo                     ComfyUI - WAN2.1 - All in one installer                          
echo                                                            V2.5 for CUDA 12.8         
echo -------------------------------------------------------------------------------
del /f banner.txt

REM Check if 7-Zip is installed and get its path
for %%I in (7z.exe) do set "SEVEN_ZIP_PATH=%%~$PATH:I"
if not defined SEVEN_ZIP_PATH (
    if exist "%ProgramFiles%\7-Zip\7z.exe" (
        set "SEVEN_ZIP_PATH=%ProgramFiles%\7-Zip\7z.exe"
    ) else if exist "%ProgramFiles(x86)%\7-Zip\7z.exe" (
        set "SEVEN_ZIP_PATH=%ProgramFiles(x86)%\7-Zip\7z.exe"
    ) else (
        echo 7-Zip is not installed. Downloading and installing...
        curl -L -o 7z-installer.exe https://www.7-zip.org/a/7z2201-x64.exe
        7z-installer.exe /S
        set "SEVEN_ZIP_PATH=%ProgramFiles%\7-Zip\7z.exe"
        if not exist "%SEVEN_ZIP_PATH%" (
            echo Installation of 7-Zip failed. Please install it manually and try again.
			pause
            exit /b 1
        )
        del 7z-installer.exe
    )
)

REM Check and install Git
git --version > NUL 2>&1
if %errorlevel% NEQ 0 (
    echo Installing Git...
    powershell -Command "& {Invoke-WebRequest -Uri 'https://github.com/git-for-windows/git/releases/download/v2.41.0.windows.3/Git-2.41.0.3-64-bit.exe' -OutFile 'Git-2.41.0.3-64-bit.exe'; if ($LASTEXITCODE -ne 0) { exit 1 }}"
    if %errorlevel% NEQ 0 (
        echo Failed to download Git installer.
		pause
        exit /b
    )
    start /wait Git-2.41.0.3-64-bit.exe /VERYSILENT
    del Git-2.41.0.3-64-bit.exe
) 
echo Enabling long paths for git...
powershell -Command "Start-Process git -WindowStyle Hidden -ArgumentList 'config','--system','core.longpaths','true' -Verb RunAs"

REM Download ComfyUI
echo Downloading ComfyUI...
curl -L -o ComfyUI_windows_portable_nvidia.7z https://github.com/comfyanonymous/ComfyUI/releases/download/v0.3.33/ComfyUI_windows_portable_nvidia.7z

REM Extract ComfyUI
echo Extracting ComfyUI...
"%SEVEN_ZIP_PATH%" x ComfyUI_windows_portable_nvidia.7z -o"%CD%" -y  >> "%installPath%\logs\install.txt" 2>&1

REM Check if extraction was successful
if not exist "ComfyUI_windows_portable" (
    echo Extraction failed. Please check the downloaded file and try again.
	pause
    exit /b 1
)

REM Delete archive
del /f ComfyUI_windows_portable_nvidia.7z -force


REM Navigate to custom_nodes folder
REM Update ComfyUI
"%basePath%\python_embeded\python.exe" -m pip install --upgrade pip  >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" "%basePath%\update\update.py" "%basePath%\ComfyUI"  >> "%installPath%\logs\install.txt" 2>&1
if exist update_new.py (
  move /y update_new.py update.py
  echo Running updater again since it got updated.
  "%basePath%\python_embeded\python.exe" "%basePath%\update\update.py" "%basePath%\ComfyUI" --skip_self_update  >> "%installPath%\logs\install.txt" 2>&1
)
"%basePath%\python_embeded\python.exe" -s -m pip install -r "%basePath%/ComfyUI/requirements.txt"  >> "%installPath%\logs\install.txt" 2>&1



REM Clone ComfyUI-Manager
echo Installing ComfyUI-Manager...
git clone https://github.com/ltdrdata/ComfyUI-Manager.git "%customNodesPath%/ComfyUI-Manager" >> "%installPath%\logs\install.txt" 2>&1

echo Installing additional nodes...

echo   - Impact-Pack
git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack "%customNodesPath%/ComfyUI-Impact-Pack" >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -s -m pip install -r "%customNodesPath%/ComfyUI-Impact-Pack/requirements.txt" --no-warn-script-location >> "%installPath%\logs\install.txt" 2>&1
git clone https://github.com/ltdrdata/ComfyUI-Impact-Subpack "%customNodesPath%/ComfyUI-Impact-Pack/impact_subpack" >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -s -m pip install -r "%customNodesPath%/ComfyUI-Impact-Pack/impact_subpack/requirements.txt" --no-warn-script-location >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -s -m pip install ultralytics --no-warn-script-location >> "%installPath%\logs\install.txt" 2>&1

echo   - GGUF
git clone https://github.com/city96/ComfyUI-GGUF "%customNodesPath%/ComfyUI-GGUF" >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -s -m pip install -r "%customNodesPath%/ComfyUI-GGUF/requirements.txt" --no-warn-script-location >> "%installPath%\logs\install.txt" 2>&1

echo   - mxToolkit
git clone https://github.com/Smirnov75/ComfyUI-mxToolkit "%customNodesPath%/ComfyUI-mxToolkit" >> "%installPath%\logs\install.txt" 2>&1

echo   - Custom-Scripts
git clone https://github.com/pythongosssss/ComfyUI-Custom-Scripts "%customNodesPath%/ComfyUI-Custom-Scripts" >> "%installPath%\logs\install.txt" 2>&1

echo   - KJNodes
git clone https://github.com/kijai/ComfyUI-KJNodes "%customNodesPath%/ComfyUI-KJNodes" >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -s -m pip install -r "%customNodesPath%/ComfyUI-KJNodes/requirements.txt" --no-warn-script-location >> "%installPath%\logs\install.txt" 2>&1

echo   - WanVideoWrapper
git clone https://github.com/kijai/ComfyUI-WanVideoWrapper "%customNodesPath%/ComfyUI-WanVideoWrapper" >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -s -m pip install -r "%customNodesPath%/ComfyUI-WanVideoWrapper/requirements.txt" --no-warn-script-location >> "%installPath%\logs\install.txt" 2>&1

echo   - VideoHelperSuite
git clone https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite "%customNodesPath%/ComfyUI-VideoHelperSuite" >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -s -m pip install -r "%customNodesPath%/ComfyUI-VideoHelperSuite/requirements.txt" --no-warn-script-location >> "%installPath%\logs\install.txt" 2>&1

echo   - Frame-Interpolation
git clone https://github.com/Fannovel16/ComfyUI-Frame-Interpolation "%customNodesPath%/ComfyUI-Frame-Interpolation" >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -s -m pip install -r "%customNodesPath%/ComfyUI-Frame-Interpolation/requirements-with-cupy.txt" --no-warn-script-location >> "%installPath%\logs\install.txt" 2>&1

echo   - rgthree
curl -L -o rgthree-comfy.zip https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/others/rgthree-comfy.zip  >> "%installPath%\logs\install.txt" 2>&1
"%SEVEN_ZIP_PATH%" x rgthree-comfy.zip -o"%customNodesPath%" >> "%installPath%\logs\install.txt" 2>&1
del /f rgthree-comfy.zip -force

echo   - Easy-Use
git clone https://github.com/yolain/ComfyUI-Easy-Use "%customNodesPath%/ComfyUI-Easy-Use" >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -s -m pip install -r "%customNodesPath%/ComfyUI-Easy-Use/requirements.txt" --no-warn-script-location >> "%installPath%\logs\install.txt" 2>&1

echo   - PuLID_Flux_ll
git clone https://github.com/lldacing/ComfyUI_PuLID_Flux_ll "%customNodesPath%/ComfyUI_PuLID_Flux_ll" >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -s -m pip install -r "%customNodesPath%/ComfyUI_PuLID_Flux_ll/requirements.txt" --no-warn-script-location >> "%installPath%\logs\install.txt" 2>&1
curl -L -o "%basePath%\python_embeded\insightface-0.7.3-cp312-cp312-win_amd64.whl" https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/whl/insightface-0.7.3-cp312-cp312-win_amd64.whl?download=true  >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -m pip install --use-pep517 facexlib  >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -m pip install git+https://github.com/rodjjo/filterpy.git  >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -m pip install onnxruntime==1.19.2 onnxruntime-gpu==1.17.1 "%basePath%\python_embeded\insightface-0.7.3-cp312-cp312-win_amd64.whl"  >> "%installPath%\logs\install.txt" 2>&1

echo   - HunyuanVideoMultiLora
git clone https://github.com/facok/ComfyUI-HunyuanVideoMultiLora "%customNodesPath%/ComfyUI-HunyuanVideoMultiLora" >> "%installPath%\logs\install.txt" 2>&1

echo   - was-node-suite-comfyui
git clone https://github.com/WASasquatch/was-node-suite-comfyui "%customNodesPath%/was-node-suite-comfyui" >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -s -m pip install -r "%customNodesPath%/was-node-suite-comfyui/requirements.txt" --no-warn-script-location >> "%installPath%\logs\install.txt" 2>&1

echo   - Florence2
git clone https://github.com/kijai/ComfyUI-Florence2  "%customNodesPath%/ComfyUI-Florence2">> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -m pip install transformers==4.49.0 --upgrade >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -s -m pip install -r "%customNodesPath%/ComfyUI-Florence2/requirements.txt" --no-warn-script-location >> "%installPath%\logs\install.txt" 2>&1

echo   - Upscaler-Tensorrt
git clone https://github.com/yuvraj108c/ComfyUI-Upscaler-Tensorrt "%customNodesPath%/ComfyUI-Upscaler-Tensorrt" >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -s -m pip install wheel-stub >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -s -m pip install -r "%customNodesPath%/ComfyUI-Upscaler-Tensorrt/requirements.txt" --no-warn-script-location >> "%installPath%\logs\install.txt" 2>&1

echo   - MultiGPU
git clone https://github.com/pollockjj/ComfyUI-MultiGPU "%customNodesPath%/ComfyUI-MultiGPU" >> "%installPath%\logs\install.txt" 2>&1

echo   - WanStartEndFramesNative
git clone https://github.com/Flow-two/ComfyUI-WanStartEndFramesNative "%customNodesPath%/ComfyUI-WanStartEndFramesNative" >> "%installPath%\logs\install.txt" 2>&1

echo   - ComfyUI-Image-Saver
git clone https://github.com/alexopus/ComfyUI-Image-Saver "%customNodesPath%/ComfyUI-Image-Saver" >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -s -m pip install -r "%customNodesPath%/ComfyUI-Image-Saver/requirements.txt" --no-warn-script-location >> "%installPath%\logs\install.txt" 2>&1

echo   - ComfyUI_UltimateSDUpscale
git clone https://github.com/ssitu/ComfyUI_UltimateSDUpscale "%customNodesPath%/ComfyUI_UltimateSDUpscale" >> "%installPath%\logs\install.txt" 2>&1

echo   - Controlnet_Aux
git clone https://github.com/Fannovel16/comfyui_controlnet_aux "%customNodesPath%/comfyui_controlnet_aux" >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -s -m pip install -r "%customNodesPath%/comfyui_controlnet_aux/requirements.txt" --no-warn-script-location >> "%installPath%\logs\install.txt" 2>&1

echo   - X-Flux
git clone https://github.com/XLabs-AI/x-flux-comfyui "%customNodesPath%/x-flux-comfyui" >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -s -m pip install -r "%customNodesPath%/x-flux-comfyui/requirements.txt" --no-warn-script-location >> "%installPath%\logs\install.txt" 2>&1

echo   - RMBG
git clone https://github.com/1038lab/ComfyUI-RMBG "%customNodesPath%/ComfyUI-RMBG" >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -s -m pip install -r "%customNodesPath%/ComfyUI-RMBG/requirements.txt" --no-warn-script-location >> "%installPath%\logs\install.txt" 2>&1

echo   - Detail-Daemon
git clone https://github.com/Jonseed/ComfyUI-Detail-Daemon "%customNodesPath%/ComfyUI-Detail-Daemon" >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -s -m pip install -r "%customNodesPath%/ComfyUI-Detail-Daemon/requirements.txt" --no-warn-script-location >> "%installPath%\logs\install.txt" 2>&1

echo   - TeaCache
git clone https://github.com/welltop-cn/ComfyUI-TeaCache "%customNodesPath%/ComfyUI-TeaCache" >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -s -m pip install -r "%customNodesPath%/ComfyUI-TeaCache/requirements.txt" --no-warn-script-location >> "%installPath%\logs\install.txt" 2>&1

mkdir "%comfyPath%\user\default\workflows"
echo Downloading comfy settings...
curl -L -o "%comfyPath%\user\default\comfy.settings.json" https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/others/comfy.settings.json?download=true >> "%installPath%\logs\install.txt" 2>&1
echo Downloading comfy workflow...
curl -L -o "%comfyPath%\user\default\workflows\UmeAiRT-WAN21_workflow.7z" https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/workflows/UmeAiRT-WAN21_workflow.7z?download=true >> "%installPath%\logs\install.txt" 2>&1
"%SEVEN_ZIP_PATH%" x "%comfyPath%\user\default\workflows\UmeAiRT-WAN21_workflow.7z" -o"%comfyPath%\user\default\workflows\" -y   >> "%installPath%\logs\install.txt" 2>&1
del /f "%comfyPath%\user\default\workflows\UmeAiRT-WAN21_workflow.7z" -force   >> "%installPath%\logs\install.txt" 2>&1

curl -L -o "%comfyPath%\user\default\workflows\UmeAiRT-Flux_Workflow.7z" https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/workflows/UmeAiRT-Flux_Workflow.7z?download=true >> "%installPath%\logs\install.txt" 2>&1
"%SEVEN_ZIP_PATH%" x "%comfyPath%\user\default\workflows\UmeAiRT-Flux_Workflow.7z" -o"%comfyPath%\user\default\workflows\" -y   >> "%installPath%\logs\install.txt" 2>&1
del /f "%comfyPath%\user\default\workflows\UmeAiRT-Flux_Workflow.7z" -force   >> "%installPath%\logs\install.txt" 2>&1

curl -L -o "%comfyPath%\user\default\workflows\UmeAiRT-HIDREAM_workflow.7z" https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/workflows/UmeAiRT-HIDREAM_workflow.7z?download=true >> "%installPath%\logs\install.txt" 2>&1
"%SEVEN_ZIP_PATH%" x "%comfyPath%\user\default\workflows\UmeAiRT-HIDREAM_workflow.7z" -o"%comfyPath%\user\default\workflows\" -y   >> "%installPath%\logs\install.txt" 2>&1
del /f "%comfyPath%\user\default\workflows\UmeAiRT-HIDREAM_workflow.7z" -force   >> "%installPath%\logs\install.txt" 2>&1

curl -L -o "%comfyPath%\user\default\workflows\UmeAiRT-LTXV_Workflow.7z" https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/workflows/UmeAiRT-LTXV_Workflow.7z?download=true >> "%installPath%\logs\install.txt" 2>&1
"%SEVEN_ZIP_PATH%" x "%comfyPath%\user\default\workflows\UmeAiRT-LTXV_Workflow.7z" -o"%comfyPath%\user\default\workflows\" -y   >> "%installPath%\logs\install.txt" 2>&1
del /f "%comfyPath%\user\default\workflows\UmeAiRT-LTXV_Workflow.7z" -force   >> "%installPath%\logs\install.txt" 2>&1

curl -L -o "%installPath%/UmeAiRT-Missing_nodes.bat" "https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/scripts/Missing_nodes/UmeAiRT-Missing_nodes.bat?download=true"  >> "%installPath%\logs\install.txt" 2>&1
curl -L -o "%installPath%/UmeAiRT-WAN2.1-Model_downloader.bat" "https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/scripts/Model_downloader/UmeAiRT-WAN2.1-Model_downloader.bat?download=true"  >> "%installPath%\logs\install.txt" 2>&1
curl -L -o "%installPath%/UmeAiRT-FLUX-Model_downloader.bat" "https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/scripts/Model_downloader/UmeAiRT-FLUX-Model_downloader.bat?download=true"  >> "%installPath%\logs\install.txt" 2>&1
curl -L -o "%installPath%/UmeAiRT-HIDREAM-Model_downloader.bat" "https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/scripts/Model_downloader/UmeAiRT-HIDREAM-Model_downloader.bat?download=true"  >> "%installPath%\logs\install.txt" 2>&1
curl -L -o "%installPath%/UmeAiRT-LTXV-Model_downloader.bat" "https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/scripts/Model_downloader/UmeAiRT-LTXV-Model_downloader.bat?download=true"  >> "%installPath%\logs\install.txt" 2>&1

REM Final steps based on user choice
curl -L -o "%basePath%/run_nvidia_gpu-LOWVRAM.bat" https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/scripts/ComfyUI/run_nvidia_gpu-LOWVRAM.bat?download=true >> "%installPath%\logs\install.txt" 2>&1
curl -L -o "%basePath%/run_nvidia_gpu-sageattention.bat" https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/scripts/ComfyUI/run_nvidia_gpu-sageattention.bat?download=true >> "%installPath%\logs\install.txt" 2>&1

echo Installing additional modules for Python...

echo   - Visual Studio Build Tools
powershell -Command "Start-Process winget -WindowStyle Hidden -ArgumentList 'install','--id','Microsoft.VisualStudio.2022.BuildTools','-e','--source','winget','--override','--quiet --wait --norestart --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK.20348' -Verb RunAs"

echo   - Python include/libs
curl -L -o "%basePath%\python_embeded\python_3.12.9_include_libs.zip" https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/others/python_3.12.9_include_libs.zip?download=true  >> "%installPath%\logs\install.txt" 2>&1
tar -xf "%basePath%\python_embeded\python_3.12.9_include_libs.zip" -C "%basePath%\python_embeded"  >> "%installPath%\logs\install.txt" 2>&1

echo   - NVIDIA Apex
git clone https://github.com/NVIDIA/apex  >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -s -m pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation .\apex >> "%installPath%\logs\install.txt" 2>&1
rmdir /s /q "apex" >> "%installPath%\logs\install.txt" 2>&1
curl -L -o apex-patch.zip https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/others/apex-patch.zip  >> "%installPath%\logs\install.txt" 2>&1
"%SEVEN_ZIP_PATH%" x apex-patch.zip -o"%basePath%\python_embeded\Lib\site-packages" >> "%installPath%\logs\install.txt" 2>&1
del /f apex-patch.zip -force

echo   - Triton
curl -L -o "%basePath%\python_embeded\triton-3.3.0-py3-none-any.whl" https://github.com/woct0rdho/triton-windows/releases/download/empty/triton-3.3.0-py3-none-any.whl  >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -m pip install "%basePath%\python_embeded\triton-3.3.0-py3-none-any.whl"  >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -s -m pip install triton-windows  >> "%installPath%\logs\install.txt" 2>&1

echo   - xformers
rem curl -L -o "%basePath%\python_embeded\mpmath-1.3.0-py3-none-any.whl" https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/others/mpmath-1.3.0-py3-none-any.whl  >> "%installPath%\logs\install.txt" 2>&1
rem curl -L -o xformers-0.0.30.zip https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/others/xformers-0.0.30.zip  >> "%installPath%\logs\install.txt" 2>&1
rem "%SEVEN_ZIP_PATH%" x xformers-0.0.30.zip -o"%basePath%\python_embeded\Lib\site-packages" >> "%installPath%\logs\install.txt" 2>&1
rem del /f xformers-0.0.30.zip -force
rem curl -L -o "%basePath%\python_embeded\xformers-0.0.30+3abeaa9e.d20250426-cp312-cp312-win_amd64.whl" https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/others/xformers-0.0.30%2B3abeaa9e.d20250426-cp312-cp312-win_amd64.whl  >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -m pip install -U xformers --index-url https://download.pytorch.org/whl/cu128  >> "%installPath%\logs\install.txt" 2>&1
rem "%basePath%\python_embeded\python.exe" -m pip install --no-deps "%basePath%\python_embeded\xformers-0.0.30+3abeaa9e.d20250426-cp312-cp312-win_amd64.whl"  >> "%installPath%\logs\install.txt" 2>&1

echo   - SageAttention
rem git clone https://github.com/thu-ml/SageAttention.git  >> "%installPath%\logs\install.txt" 2>&1
rem "%basePath%\python_embeded\python.exe" -s -m pip install .\SageAttention >> "%installPath%\logs\install.txt" 2>&1
rem rmdir /s /q "SageAttention" >> "%installPath%\logs\install.txt" 2>&1

curl -L -o "%basePath%\python_embeded\sageattention-2.1.1+cu128torch2.7.0-cp312-cp312-win_amd64.whl" https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/whl/sageattention-2.1.1+cu128torch2.7.0-cp312-cp312-win_amd64.whl?download=true  >> "%installPath%\logs\install.txt" 2>&1
"%basePath%\python_embeded\python.exe" -m pip install "%basePath%\python_embeded\sageattention-2.1.1+cu128torch2.7.0-cp312-cp312-win_amd64.whl"  >> "%installPath%\logs\install.txt" 2>&1

:CHOOSE_DOWNLOAD_WAN
REM Ask user for installation type
echo Would you like to download WAN models?
set /p "MODELS=Enter your choice (Y or N) and press Enter: "

if /i "%MODELS%"=="Y" (
    call "%installPath%\UmeAiRT-WAN2.1-Model_downloader.bat"
) else if /i "%MODELS%"=="N" (
    REM Do nothing, just continue
) else (
    echo Invalid choice. Please enter Y or N.
    goto CHOOSE_DOWNLOAD_WAN
)

:CHOOSE_DOWNLOAD_FLUX
REM Ask user for installation type
echo Would you like to download FLUX models?
set /p "MODELS=Enter your choice (Y or N) and press Enter: "

if /i "%MODELS%"=="Y" (
    call "%installPath%\UmeAiRT-FLUX-Model_downloader.bat"
) else if /i "%MODELS%"=="N" (
    REM Do nothing, just continue
) else (
    echo Invalid choice. Please enter Y or N.
    goto CHOOSE_DOWNLOAD_FLUX
)

:CHOOSE_DOWNLOAD_HID
REM Ask user for installation type
echo Would you like to download HIDREAM models?
set /p "MODELS=Enter your choice (Y or N) and press Enter: "

if /i "%MODELS%"=="Y" (
    call "%installPath%\UmeAiRT-HIDREAM-Model_downloader.bat"
) else if /i "%MODELS%"=="N" (
    REM Do nothing, just continue
) else (
    echo Invalid choice. Please enter Y or N.
    goto CHOOSE_DOWNLOAD_HID
)

:CHOOSE_DOWNLOAD_LTXV
REM Ask user for installation type
echo Would you like to download HIDREAM models?
set /p "MODELS=Enter your choice (Y or N) and press Enter: "

if /i "%MODELS%"=="Y" (
    call "%installPath%\UmeAiRT-LTXV-Model_downloader.bat"
) else if /i "%MODELS%"=="N" (
    REM Do nothing, just continue
) else (
    echo Invalid choice. Please enter Y or N.
    goto CHOOSE_DOWNLOAD_LTXV
)

echo ComfyUI installed.
pause