Bernini-R Attention Config
SageAttention vs the fallback chain, explained
- attention_config
Video generation is attention-heavy, and the attention implementation you use can be the difference between a clip that renders in a tolerable time and one that turns your GPU into a space heater. BerniniR_AttentionConfig is the pack's dropdown for choosing that implementation. It's a two-settings node with an output that plugs into BerniniR_ModelLoader, and most of the value is in understanding what auto actually does.
How it works
The node selects from a chain of backends, best-first: SageAttention 3 → SageAttention 2/1 → FlashAttention → xFormers → SDPA. The trick is in the two settings:
- backend -
auto(default),sage,xformers, orsdpa. Withauto, the pack probes what's actually installed and available on your hardware and picks the best one, walking the chain as it goes. - force_backend - the trap door.
false(default) means a missing backend silently falls through to the next one in the chain.truemeans the pack errors out if the backend you asked for isn't available.
That force_backend distinction is the thing to internalize. Leave it false and you can set backend to sage on a machine without SageAttention installed, and you'll just quietly get FlashAttention or SDPA instead - which is exactly what most people want. Flip it true and a broken install becomes a loud, diagnosable error instead of a silent perf drop.
What you should actually pick
The README's guidance is solid: sage3 or sage on RTX 30/40/50 series, flash on Ampere/Hopper/Ada, xformers or sdpa as the fallback. If you're on a recent NVIDIA card and you don't have SageAttention installed, install it - it's the single biggest free speedup for these Wan-family models, and it's what makes Bernini-R editing tolerable on a 3090. The catch is the install: on Windows, SageAttention wants Triton, and Triton on Windows has historically been the most painful part of this whole ecosystem. pip install sageattention is the start; if the wheel fails, you may be hunting for a Windows Triton build.
Installation context
The pack's own requirements keep the optional stuff optional - requirements.txt pins only numpy, einops, tqdm, comfy-kitchen, and (Windows) pywin32. The attention backends are your choice: pip install sageattention flash-attn xformers, plus kornia if you want the CIELAB path in Reinhard color matching. If you skip them all, auto still works - it just lands on SDPA, which is fine for correctness and mediocre for speed.
Where people get burned
The classic is thinking you have SageAttention active when you don't. You set backend to sage, force_backend to false, and the chain silently lands on SDPA - correct output, no speedup, no error. If your steps-per-second looks suspiciously slow, check what's actually installed with pip list | grep -i sage and either fix the install or flip force_backend to true so it stops hiding from you. Memory-efficient attention also matters on small cards: a lower backend like SDPA uses less VRAM than the fancier kernels, so if you're OOM-ing, stepping the backend down is a legitimate lever before you start cutting context windows.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| backend | COMBO | auto | Attention implementation. 'auto' = best available. Chain: Sage3 → Sage2/1 → FlashAttn → xformers → SDPA |
| force_backend | BOOLEAN | false | If True, error on unavailable backend. If False, silently fall back through the chain |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| attention_config | BERNINI_ATTN | — |