forked from Comfy-Org/ComfyUI
-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy pathcomfyui-n.bat
More file actions
208 lines (192 loc) · 7.23 KB
/
Copy pathcomfyui-n.bat
File metadata and controls
208 lines (192 loc) · 7.23 KB
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
@echo off
set "MIOPEN_FIND_MODE=2"
set "MIOPEN_LOG_LEVEL=3"
set "PYTHON=%~dp0venv\Scripts\python.exe"
set "GIT="
set "VENV_DIR=.\venv"
set "COMMANDLINE_ARGS=--auto-launch --use-quad-cross-attention --reserve-vram 0.9 --disable-async-offload --disable-pinned-memory"
:: "--disable-async-offload" added because of this : ComfyUI has added async weight offloading by default, not compatible with older GPUs, try without it , if it works you are good.
:: "--disable-pinned-memory" added , because it seems to be the cause of many recent problems with generation using zluda.
:: in the comfyui-user.bat remove the dots on the line below and change the gfx1030 to your gpu's specific code.
:: you can find out about yours here, https://llvm.org/docs/AMDGPUUsage.html#processors
:: set "TRITON_OVERRIDE_ARCH=gfx1030"
set "ZLUDA_COMGR_LOG_LEVEL=1"
:: echo Checking HIP environment variables...
if defined HIP_PATH (
echo HIP_PATH = %HIP_PATH%
) else (
echo HIP_PATH = Not set
)
if defined HIP_PATH_57 (
echo HIP_PATH_57 = %HIP_PATH_57%
)
if defined HIP_PATH_61 (
echo HIP_PATH_61 = %HIP_PATH_61%
)
if defined HIP_PATH_62 (
echo HIP_PATH_62 = %HIP_PATH_62%
)
if defined HIP_PATH_64 (
echo HIP_PATH_64 = %HIP_PATH_64%
)
if defined HIP_PATH_70 (
echo HIP_PATH_70 = %HIP_PATH_70%
)
echo.
:: Check for Build Tools and Components via vswhere.exe (assuming default path)
setlocal enabledelayedexpansion
set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
if not exist "%VSWHERE%" (
echo [ERROR] vswhere.exe not found. Cannot detect Visual Studio installations.
)
for /f "tokens=*" %%v in ('"%VSWHERE%" -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property catalog_productDisplayVersion -latest') do (
set "VSVer=%%v"
)
if defined VSVer (
echo [INFO] Detected Visual Studio Build Tools version: !VSVer!
) else (
echo [ERROR] Visual Studio Build Tools not found.
echo Please install from https://aka.ms/vs/17/release/vs_BuildTools.exe
echo Make sure to select "Desktop development with C++" with optional components:
echo CMake tools for Windows, Clang compiler for Windows, MSVC x64/x86 build tools, and Windows 10/11 SDK.
)
set componentsA=^
Microsoft.VisualStudio.Component.VC.Tools.x86.x64^
Microsoft.VisualStudio.Component.VC.CMake.Project^
Microsoft.VisualStudio.Component.VC.Llvm.Clang^
Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Llvm.Clang
for %%C in (%componentsA%) do (
"%VSWHERE%" -all -requires %%C >nul 2>&1
if errorlevel 1 (
echo [MISSING] Component "%%C" is NOT installed.
)
)
set "foundSDK=0"
set componentsB=^
Microsoft.VisualStudio.Component.Windows10SDK.18362^
Microsoft.VisualStudio.Component.Windows10SDK.19041^
Microsoft.VisualStudio.Component.Windows10SDK.20348^
Microsoft.VisualStudio.Component.Windows11SDK.22000^
Microsoft.VisualStudio.Component.Windows11SDK.22621^
Microsoft.VisualStudio.Component.Windows11SDK.26100
for %%C in (%componentsB%) do (
"%VSWHERE%" -all -requires %%C >nul 2>&1
if errorlevel 0 (
set "foundSDK=1"
)
)
if "!foundSDK!"=="0" (
echo [MISSING] No Windows SDK component is installed.
)
endlocal
:: Check Git version
where git >NUL 2>&1
if errorlevel 1 (
echo [ERROR] Git is not installed or not found in the system PATH.
echo Please install Git from https://git-scm.com and ensure it's added to your PATH during installation.
) else (
for /f "tokens=3" %%v in ('git --version') do (
echo [INFO] Detected Git version: %%v
)
)
:: Get ComfyUI full path, if inside Users folder censor username
setlocal enabledelayedexpansion
set "fullpath=%~dp0"
echo %fullpath% | findstr /i "\\Users\\" >nul
if errorlevel 1 (
echo [INFO] ComfyUI-Zluda current path: %fullpath%
) else (
for /f "tokens=1,* delims=\ " %%a in ("%fullpath%") do (
set "drive=%%a"
set "rest=%%b"
)
for /f "tokens=1,2,* delims=\" %%a in ("!rest!") do (
if /i "%%a"=="Users" (
set "username=%%b"
set "afterUser=%%c"
)
)
set "censoredUser=***"
if defined afterUser (
set "finalPath=!drive!\Users\!censoredUser!\!afterUser!"
) else (
set "finalPath=!drive!\Users\!censoredUser!\"
)
echo [INFO] ComfyUI-Zluda current path: !finalPath!
)
endlocal
:: Check current git branch, commit hash and date (Git required)
setlocal enabledelayedexpansion
for /f "delims=" %%b in ('git rev-parse --abbrev-ref HEAD') do set "BRANCH=%%b"
for /f "delims=" %%c in ('git rev-parse HEAD') do set "COMMIT=%%c"
for /f "delims=" %%d in ('git log -1 --format^="%%ad" --date=iso-strict') do set "FULL_DATE=%%d"
for /f "tokens=1 delims=T" %%x in ("!FULL_DATE!") do set "COMMIT_DATE=%%x"
for /f "tokens=1 delims=+" %%y in ("!FULL_DATE!") do set "COMMIT_TIME=%%y"
set "COMMIT_TIME=!COMMIT_TIME:*T=!"
echo [INFO] ComfyUI-Zluda current version: !COMMIT_DATE! !COMMIT_TIME! hash: !COMMIT:~0,8! branch: !BRANCH!
endlocal
echo [INFO] Checking and updating to a new version if possible...
copy comfy\customzluda\zluda-default.py comfy\zluda.py /y >NUL
git fetch >NUL
for /f "delims=" %%L in ('git rev-parse @') do set LOCAL=%%L
for /f "delims=" %%R in ('git rev-parse @{u}') do set REMOTE=%%R
if NOT "%LOCAL%"=="%REMOTE%" (
echo.
echo [INFO] Update available. New commits:
git --no-pager log --oneline %LOCAL%..%REMOTE%
echo.
echo [INFO] Pulling updates...
git --no-pager pull
) else (
echo [INFO] Already up to date.
)
copy comfy\customzluda\zluda.py comfy\zluda.py /y >NUL
echo.
:: Get AMD Software version via registry (stop on first match)
setlocal enabledelayedexpansion
for %%K in (
"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
"HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
) do (
for /f "tokens=*" %%I in ('reg query %%K 2^>nul') do (
for /f "skip=2 tokens=2,*" %%A in ('reg query "%%I" /v DisplayName 2^>nul') do (
set "dispName=%%B"
echo !dispName! | findstr /i "AMD" >nul
if !errorlevel! == 0 (
echo !dispName! | findstr /i "Software" >nul
if !errorlevel! == 0 (
for /f "skip=2 tokens=2,*" %%V in ('reg query "%%I" /v DisplayVersion 2^>nul') do (
set "dispVer=%%W"
if defined dispVer (
echo [INFO] !dispName! version: !dispVer!
goto :match
)
)
)
)
)
)
)
:match
endlocal
:: Check for zluda.exe and nccl.dll inside the zluda folder, pull version info from exe and build info from nvcuda.dll (via py script)
setlocal enabledelayedexpansion
pushd .\zluda
set "nightlyFlag=[unknown build]"
if exist zluda.exe (
for /f "tokens=2 delims= " %%v in ('zluda.exe --version 2^>^&1') do set "zludaVer=%%v"
for /f "delims=" %%f in ('python "..\comfy\customzluda\nvcuda.zluda_get_nightly_flag.py" 2^>nul') do set "nightlyFlag=%%f"
if not exist nccl.dll (
echo [ERROR] Detected ZLUDA version: !zludaVer! !nightlyFlag!, but nccl.dll is missing. Likely blocked by AV as false positive.
) else (
echo [INFO] ZLUDA version: !zludaVer! !nightlyFlag!
)
) else (
echo [ERROR] Can't detect zluda.exe inside .\zluda directory.
)
popd
endlocal
echo [INFO] Launching application via ZLUDA...
echo.
.\zluda\zluda.exe -- %PYTHON% main.py %COMMANDLINE_ARGS%
pause