π§ TA SageAttention Toggler
SageAttention on a switch, instead of a reinstall ritual
- model
- MODEL
SageAttention is one of those accelerators everyone wants and nobody wants to babysit: it makes attention faster and eats less VRAM, and it's a classic install-and-then-it-breaks-on-the-next-ComfyUI-update story. The community knows this pain well - threads about "sageattention/ComfyUI update not working" and people keeping a separate python_embeded_sage copy just to survive updates are a real recurring theme. TA SageAttention Toggler is the pack's attempt to make that pain optional and switchable instead of binary.
You feed it a model and it returns a patched model, with two independent toggles. sage_enable applies the SageAttention kernel patch; torch_enable is a separate patch that enables PyTorch's FP16 matmul acceleration. Either can be on alone, both on together, or both off - in which case your model passes through untouched. The sage_mode dropdown picks which of the five kernel variants to use: auto (let the library decide) or the explicit ones - qk_int8_pv_fp16_cuda, qk_int8_pv_fp16_triton, qk_int8_pv_fp8_cuda, qk_fp8_pv_fp8_cuda. The mode names map directly onto SageAttention's own kernel functions, so if you know which variant your GPU prefers, you can pin it.
Mechanically it hooks ComfyUI's attention with set_model_patch_replace, swapping in the Sage function for the attention computation. The failure path is handled gracefully and visibly: if import sageattention fails, the node logs "Install with: pip install sageattention-nightly" and skips the patch rather than crashing your run - so a misconfigured machine degrades to normal sampling instead of a hard error. The torch FP16 patch has its own requirement: PyTorch nightly 2.7+.
Where it belongs in a graph: right after your model loader and before the sampler. Because both patches are independent toggles, you can A/B test "is Sage actually helping on my card" without touching the environment - flip the toggle, re-run, compare. That's a genuinely nice way to decide whether the acceleration is worth its maintenance cost on your hardware.
Install. The pack itself is dependency-free:
cd ComfyUI/custom_nodes
git clone https://github.com/tmode-1960/TA-ComfyUI-Nodes-Pack
or via ComfyUI Manager. Restart, under TA Smart LLM. The Sage patch needs the real thing installed separately:
pip install sageattention-nightly
...and if you want the torch FP16 path, you need a PyTorch nightly 2.7+ build.
Gotchas. This is the one TA node where the pack's zero-dependency story is a polite fiction - the node ships clean, but it does nothing for you until sageattention-nightly is in your environment, and SageAttention is famously finicky about matching your CUDA/torch build. If your sampler is slower, not faster, after enabling it, test with Sage off. The pack's own tested setup (RTX 3090, torch 2.9.1+cu130, triton 3.5.1) is a good compatibility hint for what the author validated. And v2.x pack note as always: rebuild TA v1 workflows.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | β | |
| sage_enable | BOOLEAN | true | β |
| torch_enable | BOOLEAN | true | β |
| sage_mode | COMBO | auto | 5 options: auto, sageattn_qk_int8_pv_fp16_cuda, sageattn_qk_int8_pv_fp16_triton, sageattn_qk_int8_pv_fp8_cuda, sageattn_qk_fp8_pv_fp8_cuda |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | β |