File size: 4,262 Bytes
ffaaa7b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
@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 -------------------------------------------------------------------------------
type banner.txt
echo -------------------------------------------------------------------------------
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
REM Ask user if they want to download FLUX SCHNELL Model
echo Do you want to do a clean install? (old triton and sageattention will be deleted)
echo A) Yes
echo B) No
set /p "CHOOSE_CLEAN=Enter your choice (A or B) and press Enter: "

if /i "%CHOOSE_CLEAN%"=="A" (
	echo Uninstalling Triton and SageAttention...
	"%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 Removing SageAttention build files...
	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 Invalid choice. Please enter A or B.
    goto CHOOSE_CLEAN
)

echo Installing Visual Studio Build Tools...
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 Installing Triton...
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 Downloading Python include/libs...
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 Downloading SageAttention...
git clone https://github.com/thu-ml/SageAttention.git >> "%basePath%\logs\SageAttention.txt" 2>&1

echo Installing SageAttention...
"%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 Installation complete
pause