|  | @echo off | 
					
						
						|  | setlocal enabledelayedexpansion | 
					
						
						|  |  | 
					
						
						|  | set "basePath=%CD%" | 
					
						
						|  | set "comfyPath=%basePath%\ComfyUI" | 
					
						
						|  | set "pythonPath=%basePath%\python_embeded" | 
					
						
						|  | set "customNodesPath=%comfyPath%\custom_nodes" | 
					
						
						|  |  | 
					
						
						|  | if not exist "%basePath%\logs" mkdir "%basePath%\logs" | 
					
						
						|  |  | 
					
						
						|  | curl -L -o banner.txt https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/others/banner.txt?download=true >> "%basePath%\logs\SageAttention.txt" 2>&1 | 
					
						
						|  | echo -------------------------------------------------------------------------------[34m | 
					
						
						|  | type banner.txt | 
					
						
						|  | echo [0m------------------------------------------------------------------------------- | 
					
						
						|  | echo                   ComfyUI - WAN2.1 - SageAttention installer | 
					
						
						|  | echo                                                                     V1.3 | 
					
						
						|  | echo ------------------------------------------------------------------------------- | 
					
						
						|  | del /f banner.txt | 
					
						
						|  |  | 
					
						
						|  | :check_folder | 
					
						
						|  | if exist "%basePath%\ComfyUI" ( | 
					
						
						|  | echo ComfyUI folder detected | 
					
						
						|  | set "comfyPath=%basePath%\ComfyUI" | 
					
						
						|  | if exist "%basePath%\python_embeded" ( | 
					
						
						|  | echo Python folder detected | 
					
						
						|  | set "pythonPath=%basePath%\python_embeded" | 
					
						
						|  | ) else ( | 
					
						
						|  | echo Python folder not detected, give Python folder path : | 
					
						
						|  | pause | 
					
						
						|  | ) | 
					
						
						|  | ) else if exist "%basePath%\ComfyUI_windows_portable" ( | 
					
						
						|  | set "comfyPath=%basePath%\ComfyUI_windows_portable\ComfyUI" | 
					
						
						|  | set "pythonPath=%basePath%\ComfyUI_windows_portable\python_embeded" | 
					
						
						|  | echo ComfyUI folder detected | 
					
						
						|  | ) else ( | 
					
						
						|  | echo ComfyUI folder not detected, give ComfyUi folder path : | 
					
						
						|  | set /p "comfyPath=Path: " | 
					
						
						|  | echo Python folder not detected, give Python folder path : | 
					
						
						|  | set /p "pythonPath=Path: " | 
					
						
						|  | ) | 
					
						
						|  |  | 
					
						
						|  | :CHOOSE_CLEAN | 
					
						
						|  |  | 
					
						
						|  | echo [33mDo you want to do a clean install? (old triton and sageattention will be deleted)[0m | 
					
						
						|  | echo [32mA) Yes[0m | 
					
						
						|  | echo [32mB) No[0m | 
					
						
						|  | set /p "CHOOSE_CLEAN=Enter your choice (A or B) and press Enter: " | 
					
						
						|  |  | 
					
						
						|  | if /i "%CHOOSE_CLEAN%"=="A" ( | 
					
						
						|  | echo [33mUninstalling Triton and SageAttention...[0m | 
					
						
						|  | "%pythonPath%\python.exe" -m pip uninstall -y triton-windows  >> "%basePath%\logs\SageAttention.txt" 2>&1 | 
					
						
						|  | "%pythonPath%\python.exe" -m pip uninstall -y triton  >> "%basePath%\logs\SageAttention.txt" 2>&1 | 
					
						
						|  | "%pythonPath%\python.exe" -m pip uninstall -y sageattention  >> "%basePath%\logs\SageAttention.txt" 2>&1 | 
					
						
						|  |  | 
					
						
						|  | echo [33mRemoving SageAttention build files...[0m | 
					
						
						|  | rmdir /s /q "SageAttention"  >> "%basePath%\logs\SageAttention.txt" 2>&1 | 
					
						
						|  | rmdir /s /q "%pythonPath%\libs"  >> "%basePath%\logs\SageAttention.txt" 2>&1 | 
					
						
						|  | rmdir /s /q "%pythonPath%\include"  >> "%basePath%\logs\SageAttention.txt" 2>&1 | 
					
						
						|  | ) else if /i "%CHOOSE_CLEAN%"=="B" ( | 
					
						
						|  | set "CHOOSE_CLEANL=no" | 
					
						
						|  | ) else ( | 
					
						
						|  | echo [31mInvalid choice. Please enter A or B.[0m | 
					
						
						|  | goto CHOOSE_CLEAN | 
					
						
						|  | ) | 
					
						
						|  |  | 
					
						
						|  | echo [33mInstalling Visual Studio Build Tools...[0m | 
					
						
						|  | winget 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" | 
					
						
						|  |  | 
					
						
						|  | echo [33mInstalling Triton...[0m | 
					
						
						|  | curl -L -o "%pythonPath%\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 >> "%basePath%\logs\SageAttention.txt" 2>&1 | 
					
						
						|  | "%pythonPath%\python.exe" -m pip install "%pythonPath%\triton-3.3.0-py3-none-any.whl" >> "%basePath%\logs\SageAttention.txt" 2>&1 | 
					
						
						|  | "%pythonPath%\python.exe" -s -m pip install triton-windows >> "%basePath%\logs\SageAttention.txt" 2>&1 | 
					
						
						|  |  | 
					
						
						|  | echo [33mDownloading Python include/libs...[0m | 
					
						
						|  | curl -L -o "%pythonPath%\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 >> "%basePath%\logs\SageAttention.txt" 2>&1 | 
					
						
						|  | tar -xf "%pythonPath%\python_3.12.9_include_libs.zip" -C "%pythonPath%" >> "%basePath%\logs\SageAttention.txt" 2>&1 | 
					
						
						|  |  | 
					
						
						|  | echo [33mDownloading SageAttention...[0m | 
					
						
						|  | git clone https://github.com/thu-ml/SageAttention.git >> "%basePath%\logs\SageAttention.txt" 2>&1 | 
					
						
						|  |  | 
					
						
						|  | echo [33mInstalling SageAttention...[0m | 
					
						
						|  | "%pythonPath%\python.exe" -s -m pip install -e SageAttention >> "%basePath%\logs\SageAttention.txt" 2>&1 | 
					
						
						|  | rmdir /s /q "SageAttention"  >> "%basePath%\logs\SageAttention.txt" 2>&1 | 
					
						
						|  |  | 
					
						
						|  | echo [33mInstallation complete[0m | 
					
						
						|  | pause |