BerniniR · Guider (APG + dual-expert)
A guider that knows Bernini's 7 modes
- model
- positive
- negative
- model_low
- GUIDER
If you run Bernini through the GGUF path (14B quantized on a 24 GB card, or the 1.3B on a laptop), you need this node. BerniniR · Guider builds a GUIDER for ComfyUI's native SamplerCustomAdvanced that implements Bernini's guidance on top of native sampling - the chained-CFG modes, the APG x-space guidance, and the dual-expert switch. Skip it and your GGUF runs as plain Wan: generation works, but editing silently loses the Bernini logic that makes it Bernini.
It exists because the GGUF path hands you ComfyUI-native MODELs (via UnetLoaderGGUF), and native sampling has no idea what a source-id stream or an omega is. This node supplies that knowledge.
How it works
It subclasses ComfyUI's CFGGuider and overrides predict_noise. Two details make it faithful and simple:
- ComfyUI's
apply_modelreturns the x0 (denoised) prediction, which is exactly the space where Bernini applies APG - no eps↔x conversions needed. - The non-APG modes (
rv2v,v2v,v2v_chain,t2v) are affine combinations, so applying the same formula to x0 and returning x0 is exact.
It reads the condition streams from the model's transformer_options (injected by BerniniR · Source Stream), splits them into video (temporal dim > 1) and image (T == 1) streams, and runs up to 4 forwards per step with different subsets - none, V (first video), I (images), or VI (all) - combined per the active mode. The dual-expert switch watches the timestep: below the boundary (t < 875) it lazy-loads the low-noise expert and scales the omegas ×0.8 once. It sets CFG to 1.0, because Bernini uses omegas, not a scalar CFG.
Inputs you'll touch
mode-autopicks it for you: no streams →t2v, image or video →v2v, both →rv2v. Manual override is available but rarely needed.omega_V(1.25),omega_I(4.5),omega_TI(4.0) - same guidance strengths as the dual-expert Sampler node.eta(0.5) - APG parallel-component weight (1.0 = normal CFG).norm_threshold(50) - APG norm clip on the diff (0 = off).momentum(0) - APG momentum.model_low(optional) - the low-noise expert. Leave it empty for the 1.3B (single-expert). For the 14B dual-expert, this is where the second GGUF goes.omega_scale(0.8) andboundary(0.875) - the switch's knobs; the defaults are Wan 2.2's values.
positive and negative are CONDITIONING - on the GGUF path those come from CLIPLoaderGGUF with type = wan (the umt5 encoder), not from this pack's Text Encode node.
Output and wiring
Output is a single GUIDER → SamplerCustomAdvanced. The README's editing graph:
UnetLoaderGGUF (high) → BerniniR · Apply Patches → BerniniR · Source Stream → BerniniR · Guider
UnetLoaderGGUF (low) ────────────────────────────────────────────────────────────► model_low
Note on 14B vs 1.3B: with both experts loaded, set model = high-noise and model_low = low-noise. GGUF carries no fp8 tensors, so both 14B experts coexist in 24 GB without the offload crash fp8 weights hit. The low expert is loaded lazily on the switch and unloaded after sampling, so chaining v2v → i2i doesn't thrash VRAM.
Troubleshooting
SamplerCustomAdvancedwon't take it? TheGUIDERtype is the native ComfyUI one - it should plug straight in. If the guider errors and the console shows "patches Bernini NOT installed," it's still running as native Wan: generation works, editing won't.- Editing ignoring the source? Check that BerniniR · Source Stream is chained after Apply Patches on the high-noise model, and that its latent came from a Wan VAE encode.
- Two GGUFs don't fit? Q4/Q5 for the low expert first - it only refines detail, so it tolerates more quantization.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | MODEL de BerniniR (Load Model native), opcionalmente con streams. | |
| positive | CONDITIONING | — | |
| negative | CONDITIONING | — | |
| mode | COMBO | auto | auto: t2v sin streams, v2v con imagen/vídeo, rv2v con ambos. |
| omega_V | FLOAT | 1.250–30 | — |
| omega_I | FLOAT | 4.500–30 | — |
| omega_TI | FLOAT | 4.000–30 | — |
| eta | FLOAT | 0.500–1 | APG: peso de la componente paralela (1.0 = CFG normal). |
| momentum | FLOAT | 0.00-1–1 | — |
| norm_threshold | FLOAT | 500–1000 | APG: recorte de norma del diff (0 = sin recorte). |
| model_lowopt | MODEL | Experto low-noise (Wan2.2). Si está, switch por boundary (necesita GGUF/pagefile). | |
| omega_scaleopt | FLOAT | 0.800–2 | Escala los omegas al cambiar a low-noise. |
| boundaryopt | FLOAT | 0.8750–1 | Frontera high/low (× 1000 timesteps). Wan2.2 A14B = 0.875. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| GUIDER | GUIDER | — |