ComfyUI Node

DyPE

Push Flux, Qwen and Z-Image past their native resolution

By wildminder·Created 10 months ago·Updated 8 months ago· 555
DyPE
  • model
  • Patched Model
width1024
height1024
model_typeauto
methodvision_yarn
yarn_alt_scalingfalse
enable_dypetrue
base_resolution1024
dype_start_sigma1.00
dype_scale2.0
dype_exponent2.0
base_shift0.50
max_shift1.15

Every diffusion model has a resolution it was trained on - usually around a megapixel, so 1024x1024 for Flux and Z-Image. Ask it for a lot more than that in one pass and it falls apart in a very specific way: repeated patterns, a second head, cloned fingers, that "too-strong-JPEG" mush when a body gets small in the frame. The usual fix is to generate at native size and then upscale (hires fix, ControlNet Tile, SeedVR2). DyPE takes the other road. It lets the model natively render at 4K and beyond in a single pass, coherently, without the tiling breakdown.

That's the pitch, and it's a genuinely different tool from an upscaler. An upscaler takes a finished small image and adds pixels or invents detail. DyPE changes what the model can draw in the first place.

How it actually works

The trick is in the positional encoding. Diffusion transformers use RoPE (rotary position embeddings) to know where each patch sits in the image, and those embeddings are calibrated for the training resolution. Push way past it and the position math goes out of range - that's the real source of the repeats and structural drift, not a lack of detail.

DyPE ("Dynamic Position Extrapolation") is a training-free patch that rescales those position embeddings dynamically at every denoising step. Diffusion resolves an image coarse-to-fine - big shapes early, fine texture late - so DyPE leans on low-frequency (structure) handling in the early steps and shifts toward high-frequency (detail) as sampling progresses. It costs nothing at inference: no extra steps, no extra passes, it just retunes the encodings on the fly.

One honest caveat, straight from the README: even with DyPE you're asking a ~1-megapixel-trained model to paint 16 megapixels at 4096x4096. It's dramatically better than raw, but it's not magic - expect the occasional artifact at the extreme end.

The node, and the inputs that matter

It's a single node under model_patches/unet. Drop it between your model loader and your KSampler: loader → DyPE → KSampler. It outputs one thing, a Patched Model (MODEL), which is your original model with the positional trick baked in - it doesn't touch CLIP or the VAE. The name says "DyPE for FLUX," but that undersells it: model_type also covers Nunchaku (quantized Flux), Qwen Image, and Z-Image (Lumina 2). Leave model_type on auto and it detects the architecture for you.

The handful you'll actually set:

  • width / height - the big one. Set these to match your Empty Latent Image exactly. This is what tells DyPE how far past native you're pushing; if they disagree with your actual canvas, the scaling is calibrated for the wrong target.
  • base_resolution - the model's native size. 1024 for Flux and Z-Image, 1328 for Qwen.
  • method - defaults to vision_yarn, which handles odd aspect ratios best and is the right starting point. yarn is the classic version (can stretch geometry at extreme ratios), ntk is stable but softer, base is off.
  • dype_exponent - your main quality knob. 1.0 for 2K–3K, 2.0 for 4K+, and 3.04.0 if you hit speckle noise (below).

dype_scale, enable_dype, yarn_alt_scaling, dype_start_sigma, base_shift and max_shift are all exposed too, but the defaults are sane - leave them alone until you have a reason.

Installing it

Easiest path is ComfyUI Manager: search ComfyUI-DyPE and hit Install. Manually, drop into your custom_nodes folder and clone:

cd ComfyUI/custom_nodes && git clone https://github.com/wildminder/ComfyUI-DyPE.git

Then restart ComfyUI. That's the whole thing - the README is explicit that there are no extra dependencies to pip-install and no model files to download. For a high-res node that's a refreshingly clean install.

Where people get tripped up

  • Speckle noise at 4K+. Fine areas like hair and eyes can pick up high-frequency grain - a side effect of stretching attention past its limits. Raise dype_exponent to 3.04.0, or run a smoothing/detailer LoRA.
  • width/height not matching the latent. The single most common self-inflicted wound. If the node's dimensions don't equal your Empty Latent Image, you get worse results than DyPE off. Keep them in sync.
  • Z-Image needs vision_yarn or ntk. Z-Image uses a very low RoPE base frequency, and standard yarn can produce artifacts on it. The node already force-enables isotropic scaling for Z-Image to stop vertical stretching, but pick one of those two methods.
  • There's no magic preset. The README says it and it's true - the right method and dype_exponent shift with your prompt and target resolution. Budget a few test gens.

Last thing worth knowing: DyPE and upscaling aren't rivals, they stack. The pattern that shows up in high-res pipelines is DyPE for a coherent large base pass, then a generative upscaler like SeedVR2 for final detail - that's how people reach absurd resolutions like 8K–16K without the whole thing dissolving into repeats. DyPE handles coherence at scale; the upscaler handles crispness.

Categorymodel_patches/unet

Inputs (13)

NameTypeDefaultDescription
modelMODELThe model to patch with DyPE.
widthINT102416–8192Target image width. Must match the width of your empty latent.
heightINT102416–8192Target image height. Must match the height of your empty latent.
model_typeCOMBOautoSpecify the model architecture. 'auto' usually works
methodCOMBOvision_yarnPosition encoding extrapolation method.
yarn_alt_scalingBOOLEANfalse[YARN Only] Alternate scaling for ultra-high resolutions. Not used for 'vision_yarn'.
enable_dypeBOOLEANtrueEnable or disable DyPE
base_resolutionINT1024256–4096The native training resolution.
dype_start_sigmaFLOAT1.000–1When to start decaying the scaling effect (1.0 = Start, 0.5 = 50% through generation).
dype_scaleoptFLOAT2.00–8Controls DyPE magnitude (λs). Default is 2.0.
dype_exponentoptFLOAT2.00–1000Controls DyPE decay speed (λt). Higher = Faster decay. 2.0=Quadratic.
base_shiftoptFLOAT0.500–10Advanced: Base shift for the noise schedule (mu).
max_shiftoptFLOAT1.150–10Advanced: Max shift for the noise schedule (mu) at high resolutions.

Outputs (1)

NameTypeDescription
Patched ModelMODELThe model patched with DyPE.