DyPE for Nunchaku Flux
DyPE, the Nunchaku-friendly hi-res patch
- model
- Patched Model
The name is a bit of a fib: this node isn't only for Nunchaku FLUX. It's the DyPE high-resolution patch for FLUX (originally from wildminder's ComfyUI-DyPE, based on the HUJI research project of the same name), forked and reworked so it also works on Nunchaku-quantized FLUX models. Which is exactly who should care: if you run FLUX on a 6–12GB card, Nunchaku's int4 SVDQuant weights are how you're running it at all, and until this fork, DyPE silently refused to touch those models.
Why you'd reach for it
FLUX is trained at roughly 1024×1024. Push past that and you get the classic punishment: repeated patterns, duplicated anatomy, stretched limbs - the thing every troubleshooting thread blames on "generating above native resolution." The standard fix is to generate at 1K and upscale in a second pass, which costs you a whole extra inference run. DyPE is the training-free alternative: generate directly at 2048 or 4096, no hires-fix pass, no tiled VAE dance. That's where the author's "100% speed boost at 2048×2048 on an RTX 2070" claim comes from - it's wall-clock time, because you skip the upscale round-trip. Treat the exact number as marketing, but the logic holds.
How it works
The trick is that the RoPE frequency interpolation doesn't stay fixed across a sample. Early denoising steps are building low-frequency structure; late steps resolve fine detail. DyPE exploits that by shifting the positional-encoding spectrum to match whatever stage the diffusion process is in - you get YARN-style extrapolation (yarn, ntk, or plain base methods) plus a time-aware dynamic layer on top. It also nudges the noise schedule: the node computes a resolution-dependent mu shift from your target size and applies it via flux_time_shift. All of it happens per-step on a cloned model with negligible overhead, then hands you back a patched MODEL.
The Nunchaku-specific bit: Nunchaku models store position embeddings in a different rope layout, so this fork replaces the pos-embed module with one that outputs Nunchaku's (B, M, D/2, 1, 2) contract. It auto-detects whether you fed it a Nunchaku or a standard FLUX model and patches the right embedder.
The inputs that matter
model- your FLUXMODEL. It's FLUX-only; aValueErroris raised otherwise.width/height- must match your Empty Latent Image (the tooltip says so, and the code uses them to compute the noise-shift). The inherited README claims they're "buggy, keep below 1024×1024" - ignore that stale warning and set them to your actual target resolution.dype_exponent- the one real tuning knob.2.0(exponential) for 4K+,1.0(linear) for 2K–3K,0.5for just above 1K.method(yarndefault) andenable_dype- leave both alone unless you're experimenting; disabling the dynamic layer is mainly for A/B comparison.base_shift/max_shift- advanced noise-schedule knobs. Don't chase them: a community XY plot of exactly these two showed zero visible difference.
Output is a single Patched Model - wire it into your KSampler's model input. That's the whole integration.
Install
Via ComfyUI Manager, search "ComfyUI-DyPE". Careful: that string also matches the upstream project, and the README's own clone URL is stale and points at wildminder/ComfyUI-DyPE - this fork is:
cd ComfyUI/custom_nodes
git clone https://github.com/Usonaki/ComfyUI-DyPE-Nunchaku
Then restart ComfyUI. requirements.txt is just torch, so nothing heavy installs. To actually use the Nunchaku path you'll also need the mit-han-lab/ComfyUI-nunchaku plugin and a quantized FLUX weights file (like svdq-int4-r32-flux.1-dev.safetensors); standard FLUX checkpoints work with zero extras. Note the author is upfront that this is a hobby fork with no maintenance commitment - know that going in.
Gotchas
Nunchaku auto-offloads to CPU on cards under ~14GB VRAM, so at 2K+ watch for slow spillover rather than a crash. If you get "not a compatible FLUX model," you've fed it a non-FLUX checkpoint. And one legal asterisk from the original paper: DyPE is patent-pending, so think twice before shipping a product on it.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | The FLUX model to patch with DyPE. | |
| width | INT | 102416–8192 | Target image width. Must match the width of your empty latent. |
| height | INT | 102416–8192 | Target image height. Must match the height of your empty latent. |
| method | COMBO | yarn | Position encoding extrapolation method (YARN recommended). |
| enable_dype | BOOLEAN | true | Enable or disable Dynamic Position Extrapolation for RoPE. |
| dype_exponentopt | FLOAT | 2.00–4 | Controls DyPE strength over time (λt). 2.0=Exponential (best for 4K+), 1.0=Linear, 0.5=Sub-linear (better for ~2K). |
| base_shiftopt | FLOAT | 0.500–10 | Advanced: Base shift for the noise schedule (mu). Default is 0.5. |
| max_shiftopt | FLOAT | 1.150–10 | Advanced: Max shift for the noise schedule (mu) at high resolutions. Default is 1.15. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Patched Model | MODEL | The FLUX model patched with DyPE. |