WanVideo Mem Eff Sage Attention Patch(WanVideoMemoryEfficientSageAttentionPatch)
EXPERIMENTAL! Activates custom sageattention on the WanVideo self-attention to reduce peak VRAM usage, overrides the attention mode. Requires latest sageattention version.
Wan Video Memory Efficient Sage Attention Patch
Description
An experimental node that patches the WanVideo self-attention mechanism to use a custom sageattention implementation, reducing peak VRAM usage during inference. This node overrides the attention mode of the model.
Requires the latest version of sageattention – ensure it is installed, compatible, and up to date before using this node.
Inputs
| Name | Type | Description |
|---|---|---|
model | MODEL | The WanVideo model to which the memory‑efficient sageattention patch is applied. |
Outputs
| Type | Description |
|---|---|
MODEL | The same model instance with its self‑attention mechanism patched to use sageattention. |
Usage Notes
- This node is experimental – behaviour may change in future releases.
- It only affects the self‑attention layers of WanVideo; cross‑attention or other components remain unchanged.
- Patching is applied as a model wrapper; the output
MODELcan be used directly in subsequent sampling nodes. - If
sageattentionis not installed or is outdated, an error will be raised at runtime. - Running this patch may alter output quality or behaviour – test carefully with your specific workflow.
Installation (SageAttention)
This node requires the SageAttention library to be installed in your ComfyUI Python environment:
- Official repo (Linux): thu-ml/SageAttention -
pip install sageattention(requirespython>=3.9,torch>=2.3.0,triton>=3.0.0, CUDA>=12.0; see the README for version requirements) - Windows: woct0rdho/SageAttention - prebuilt wheels for Windows; install triton-windows first, then pick a wheel from the releases page matching your PyTorch version (see the README)
For ComfyUI's built-in global acceleration (no node needed), start ComfyUI with --use-sage-attention. If WanVideo produces black or noisy output due to quantization overflow, use this node with sageattn_qk_int8_pv_fp16_cuda (least likely to overflow), or adjust pv_accum_dtype.
Comments
Sign in with GitHub to join the discussion.