wildminder/ComfyUI-DyPE
ComfyUI DyPE+SEGA, enabling artifact-free 4K+ image generation: Z-Image, Qwen, Flux, Krea2
ComfyUI‑DyPE – High‑resolution diffusion for ComfyUI
What it is – A collection of custom nodes for the visual‑programming UI ComfyUI that let you push modern diffusion‑transformer models (Flux, Qwen‑Image, Z‑Image, Anima/Cosmos, Krea‑2, etc.) to ultra‑high resolutions (2 K, 4 K and beyond) without retraining the model.
How it works – The nodes implement training‑free patches that modify the model’s positional encodings or attention patterns at inference time:
- DyPE – Dynamic Position Extrapolation, adjusts RoPE on the fly so the model can attend to a larger canvas.
- SEGA – Spectral‑Energy Guided Attention, a frequency‑based sharpening alternative.
- SPA / HAP – HRDiT‑based patches that fix spatial disorder or prune attention heads for speed.
- PixelRush, FreeScale, HiFlow, I‑Max – cascade‑style up‑scalers that start from a base‑resolution image/latent and refine it progressively. All nodes are drop‑in: place the node after the model‑loader in a ComfyUI graph, set the target width/height, and connect it to the usual KSampler (or to the cascade‑specific inputs).
Key features
- Multi‑architecture support – works with Flux (including the quantised Nunchaku variant), Qwen‑Image 1.0 & 2.1, Krea‑2, Z‑Image, Anima/Cosmos and even classic SDXL/SD1.5 via the cascade nodes.
- Zero‑retraining – no extra checkpoints or fine‑tuning; the patch is applied at runtime.
- Single‑node integration – each method is a single ComfyUI node; you can mix‑and‑match (e.g., DyPE + SPA for quality, DyPE + HAP for speed).
- High‑resolution output – demonstrated up to 4096 × 4096 pixels and higher.
- Low overhead – DyPE/SEGA add negligible cost; SPA adds ~1.3‑1.8× inference time at 4 K; HAP can give 2‑5× speed‑ups when a scope‑plan is used.
When to use which node
| Goal | Recommended node(s) |
|---|---|
| Generate directly at 4 K from noise | DyPE (or SEGA) – choose a method (vision_yarn, yarn, ntk, …) based on model and visual preference. |
| Fix repeated structures that appear when scaling | SPA (HRDiT) – adds a cheap spatial‑alignment pass. |
| Speed up high‑res sampling | HAP (HRDiT) – use a pre‑calibrated scope plan (provided for Flux) or calibrate your own. |
| Upscale an existing image while keeping its composition | PixelRush – patch‑wise cascade refinement. |
| Fully automatic upscale without a source image | FreeScale – self‑cascade with scale‑fused attention. |
| Upscale flow‑based models (Flux, Qwen‑Image, …) preserving structure | HiFlow – re‑uses the low‑res diffusion trajectory as guidance. |
| Dual‑pass high‑res for Flux/Z‑Image | I‑Max – low‑res pass guides a separate high‑res pass. |
Getting started
- Install ComfyUI (if you haven’t already).
- Clone the repository into
ComfyUI/custom_nodes/:cd path/to/ComfyUI/custom_nodes git clone https://github.com/wildminder/ComfyUI-DyPE.git - Restart ComfyUI – the new nodes appear under WMNodes → image.
- Build a simple graph:
Load Model → DyPE → KSampler → VAE Decode. - Set
width/heightto the desired high resolution (e.g., 4096 × 4096) and pick amethod(the README recommendsvision_yarnas a safe default). - Run the workflow.
Optional: addSPAafterDyPEif you notice duplicated patterns, or addHAPfor a speed boost.
Limitations & gotchas
- The patches are model‑specific; some nodes (e.g., HAP) are not supported on every architecture (Nunchaku, Qwen‑Image 2.1, etc.).
- Qwen‑Image 2.1 uses a 16× VAE with an alpha channel; cascade nodes drop the alpha channel and log a warning.
DyPE/SEGArequire the correctmodel_typeselection; auto‑detect works in most cases but manual override (flux,qwen21, …) may be needed for edge cases.- High‑resolution runs still need sufficient GPU VRAM; the cascade nodes keep memory flat by processing patches, but the base model still occupies its full latent size.
SPAandDyPE/SEGAcannot be used together – they are mutually exclusive.
Where to learn more
- Original papers linked in the README (DyPE, HRDiT, FreeScale, HiFlow) explain the underlying algorithms.
- Each node’s tooltip in ComfyUI shows the full list of parameters; the README provides recommended defaults and tuning tips.
- For custom speed‑up plans, see the
calibration/calibrate_hap.pyscript.
ComfyUI‑DyPE is a practical toolbox for anyone who wants to generate 4 K‑plus images with the latest diffusion transformers while staying inside the visual‑workflow paradigm of ComfyUI.
Related
- Project
- Project
- Project
- Project
- Project