确定你的comfyui pytorch的版本查看命令如下:
<!--将E:\APP_install\ComfyUI\ComfyUI_windows_portable\python_embeded\python.exe替换为你的comfyui所依赖的python环境 -->
E:\APP_install\ComfyUI\ComfyUI_windows_portable\python_embeded\python.exe -c "import torch; print('Torch version:', torch.__version__); print('CUDA version:', torch.version.cuda); print('CUDA available:', torch.cuda.is_available()); print('Device:', torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'CPU only')"
<!-- 打印有如下内容 -->
Torch version: 2.7.0+cu126
CUDA version: 12.6
CUDA available: True
Device: NVIDIA GeForce RTX 3090 Ti
- 根据你的pytorch版本 如:Torch version: 2.7.0+cu126 寻找对应的版本
windows编译好的sageattention包,文件链接如下:
https://github.com/woct0rdho/SageAttention/releases
- 下载whl文件如:sageattention-2.2.0+cu126torch2.6.0.post3-cp39-abi3-win_amd64.whl到本地后,运行命令
<!--将E:\APP_install\ComfyUI\ComfyUI_windows_portable\python_embeded\python.exe替换为你的comfyui所依赖的python环境 -->
<!-- 将E:\APP_install\py_whl\sageattention-2.2.0+cu126torch2.6.0.post3-cp39-abi3-win_amd64.whl替换为你的whl文件路径 -->
E:\APP_install\ComfyUI\ComfyUI_windows_portable\python_embeded\python.exe -m pip install E:\APP_install\py_whl\sageattention-2.2.0+cu126torch2.6.0.post3-cp39-abi3-win_amd64.whl
- 安装成功后再打印一下版本
E:\APP_install\ComfyUI\ComfyUI_windows_portable\python_embeded\python.exe -m pip show sageattention
<!--显示如下sageattention Version: 2.2.0 代表成功重启comfyui -->
sageattention
Name: sageattention
Version: 2.2.0+cu126torch2.6.0.post3
Summary: Accurate and efficient plug-and-play low-bit attention.
Home-page: https://github.com/thu-ml/SageAttention
