Install Triton and Sage Attention on Windows with RTX 50XX
详情
下载文件
模型描述
大家好!我已成功在配备Windows 11的RTX 5070Ti上配置了Triton和Sage Attention,以加速Wan2.1的生成。本指南专为不想折腾WSL或安装Linux的用户设计。以下是步骤,更多细节请参考以下链接:
https://github.com/woct0rdho/triton-windows/?tab=readme-ov-file
https://www.reddit.com/r/comfyui/comments/1j298vc/comfyui_not_recognizing_sageattention/
https://github.com/thu-ml/SageAttention/issues/107
下载专为50XX系列显卡设计的ComfyUI版本,解压后运行run_nvidia_gpu.bat批处理文件,等待所有依赖项安装完成。
https://github.com/comfyanonymous/ComfyUI/releases/download/latest/ComfyUI_cu128_50XX.7z安装MSVC和Windows SDK
步骤:
从 Visual Studio 下载页面 安装 Visual Studio 2022,选择“使用C++的桌面开发”。
添加到PATH:
找到 cl.exe(例如:C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.43.34808\bin\Hostx64\x64)。
添加到PATH:
cmd
set PATH=%PATH%;C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.43.34808\bin\Hostx64\x64或通过“系统 > 高级 > 环境变量 > 编辑‘Path’”永久设置。
测试:
打开PowerShell,输入
cl期望输出:Microsoft (R) C/C++ Optimizing Compiler Version 19.43.34808 for x64....
- 安装 vcredist
步骤:
从 Microsoft 下载 Visual C++ Redistributable (2015-2022)。
运行 vc_redist.x64.exe 并完成安装。
- 安装 Triton
步骤:
安装适用于Windows的预发布whl包:
cmd
cd ComfyUI_cu128_50XX\python_embeded python.exe -m pip install https://github.com/woct0rdho/triton-windows/releases/download/v3.2.0%2Bgit8f9b005b-windows.post11/triton-3.2.0+git8f9b005b-cp312-cp312-win_amd64.whl
- 安装 Python 3.12.8 并配置 ComfyUI 嵌入式 Python
原因:ComfyUI 的嵌入式 Python 需要头文件和库文件以支持 Triton/Sage Attention。
步骤:
从 Python.org 下载 Python 3.12.8(Windows 安装程序)。
安装到临时路径(例如:C:\Python312)。
将 include 和 libs 复制到 ComfyUI 的嵌入式 Python 中:
cmd
xcopy C:\Python312\include C:\Data\ComfyUI_cu128_50XX\python_embeded\includexcopy C:\Python312\libs C:\Data\ComfyUI_cu128_50XX\python_embeded\libs
- 安装 Sage Attention 1.0.6
步骤:
下载 Sage Attention 1.0.6 https://github.com/thu-ml/SageAttention/tree/sageattention-1
将其解压到 ComfyUI 文件夹,并用附带的文件替换 setup.py
使用嵌入式 Python 安装:
cmd
cd C:\Temp\sageattention-1.0.6 \ComfyUI_cu128_50XX\python_embeded\python.exe setup.py install
前后效果对比
测试环境:使用512x512的i2v视频,30步,41帧,20次块交换,UniPC采样器,模型来自master Kijai的I2V 720p 8fp:https://huggingface.co/Kijai/WanVideo_comfy/tree/main
Sage Attention:约14秒/步。

Sage Attention + TeaCache:约8秒/步!