Windows下成功安装SageAttention和triton
SageAttention 是最近在一些大模型框架(特别是像 Wan2.2、Qwen2.5、DeepSeek-V2 等视频/多模态模型)中开始出现的一个新的 注意力机制优化组件。
它主要是为了解决传统 Transformer 中 Attention 的速度瓶颈和显存开销 问题的。
SageAttention 是一种「高效节能版」的注意力机制, 通过稀疏化和 GPU 内核优化让视频生成模型更快、更省显存, 相当于 FlashAttention 的“下一代”。
如果你要在Windows下面直接使用pip install SageAttention 往往都会遇到问题。所以专门开一个帖子记录一下安装方法。
首先安装一下triton。
Github地址:
https://github.com/woct0rdho/triton-windows
安装trition需要注意Pytorch的版本,他们之间的对应关系如下:
| PyTorch | Triton |
|---|---|
| 2.4 | 3.1 |
| 2.5 | 3.1 |
| 2.6 | 3.2 |
| 2.7 | 3.3 |
| 2.8 | 3.4 |
| 2.9 | 3.5 |
理论上高版本可以兼容低版本。比如我的Pytorch是2.8,可以安装Triton3.5。反过来可能就会有问题!
安装命令:
pip install -U "triton-windows<3.6"
ComfyUI便携版安装命令:
python.exe -m pip install -U "triton-windows<3.6"
然后在安装SageAttention
Github地址:
https://github.com/woct0rdho/SageAttention
安装SageAttention需要事先把对应的whl文件下载到本地。
可以从下面这个地址找到合适的版本:
https://github.com/woct0rdho/SageAttention/releases

这里需要注意Cuda版本,Torch版本,Python版本。
红色框中选中的文件适用于cuda 为12.8,torch为2.8.0,Python为3.13。
必须根据自己环境来选择合适的文件,这里基本涵盖了常见的版本。
然后运行安装命令。
常规安装命令:
pip install sageattention-2.2.0+cu128torch2.8.0-cp313-cp313-win_amd64.whl
ComfyUI便携版命令:
python.exe -m pip install sageattention-2.2.0+cu128torch2.8.0-cp313-cp313-win_amd64.whl
SageAttention 安装成功之后,就可以在Windows环境下启用加速功能了,一般会有比较明显的提速效果。
如果你是在ComfyUI中使用,可能会遇到另外一个问题。在执行tcc.exe的时候报错。这是因为便携版的Python文件中缺少了两个文件而导致。
具有解决方案可以参考这篇文章: