To use Sage Attention in ComfyUI, install the sageattention Python package into ComfyUI's environment and start ComfyUI with --use-sage-attention.
Steps
pip install sageattention==2.2.0 --no-build-isolation
python main.py --use-sage-attention
The install command is the one in the SageAttention repo for version 2.2.0. If the package is missing, ComfyUI tells you: its error says the sageattention package must be installed first for the --use-sage-attention feature.
Requirements (from SageAttention)
- Python 3.9 or newer, torch 2.3.0 or newer, triton 3.0.0 or newer.
- CUDA 12.8 or newer for Blackwell or SageAttention2++; 12.4 or newer for FP8 on Ada; 12.3 or newer for FP8 on Hopper; 12.0 or newer for Ampere.
SageAttention describes itself as quantized attention that speeds up inference. If it errors while running, ComfyUI logs the error and uses PyTorch attention instead, so a broken install slows you down rather than crashing the run.
It is one of several attention options in cli_args.py (--use-pytorch-cross-attention, --use-flash-attention and others); only one can be chosen. Before tuning speed, confirm you are on the GPU at all: how to check if ComfyUI is using the GPU. The ComfyUI custom node install guide covers installs that pull in compiled dependencies.
Sources
- SageAttention repository. github.com
- ComfyUI cli_args.py (attention flags). github.com
- ComfyUI comfy/ldm/modules/attention.py. github.com