Nodes/ComfyUI Star DyPE/⭐ Star DyPE Model Patcher
ComfyUI Node

⭐ Star DyPE Model Patcher

4K FLUX without the tiling horror

By Starnodes2024·Created 10 months ago·Updated 10 months ago· 9
⭐ Star DyPE Model Patcher
  • model
  • MODEL
  • empty_latent
  • width
  • height
methodyarn
enable_dypetrue
aspect_ratio1:1 (4096x4096)
scale0.5

Generate any FLUX image above its native 1024×1024 and you'll eventually see it: duplicated faces, tiled ceiling tiles, a hand that quietly repeats across the frame. That's the model running out of position encoding - it simply doesn't know what 4096×4096 is. The usual fixes (hires fix, tiled diffusion, ControlNet Tile) are all two-pass band-aids. The Star DyPE Model Patcher takes a different route: it rewrites the position encoding itself so a 12B FLUX transformer can extrapolate to 4K+ in a single pass.

This is a ComfyUI port of DyPE ("Dynamic Position Extrapolation"), a 2025 research technique (arXiv:2510.20766) that scales the rotary position embeddings to match the resolution you ask for. Several ports exist in the wild - this is the StarNodes one, and its trick is that it bundles a latent-size selector into the same node, so you patch and size in one step instead of wiring up a separate Empty Latent.

How it works

FLUX is a transformer, and like all of them it learns positions via rotary embeddings (RoPE) tuned to a specific training scale. When you feed it a longer sequence than it trained on, the frequencies drift and you get those repeating artifacts. The patcher swaps the model's pos_embed for a DyPE version that rebuilds the frequency table on the fly, scaled to the actual sequence length.

You get three flavors via the method dropdown:

  • yarn - YaRN, the default and the one the author recommends. It blends NTK scaling with linear interpolation using a frequency-dependent mask, so low frequencies stretch while high ones mostly hold. Best quality at extreme resolutions.
  • ntk - Neural Tangent Kernel scaling, a simpler base-frequency bump. Good balance, slightly less finesse.
  • base - no extrapolation at all. Only useful as a baseline to see what DyPE is actually buying you.

One honest note from reading the source: the README talks a lot about dynamic timestep-aware scaling, and the code defines a set_timestep hook for it - but in v1.0.0 nothing ever calls it. The timestep stays pinned at full strength, so you're effectively getting static YARN/NTK. The scaling is real; the "dynamic" part is future work. It doesn't hurt results, just manage your expectations.

The inputs that matter

There are only five, and three of them are the whole game:

  • model - any FLUX checkpoint (dev, schnell, Krea, etc.). The node clones it, so your original model stays untouched. QWEN and WAN claim support, but FLUX is the tested path.
  • method - yarn, ntk, or base. Start with yarn.
  • enable_dype - leave it on (default True). It gates the extrapolation branch entirely.
  • aspect_ratio - 7 presets, all tuned to ~16MP: 1:1 at 4096×4096, 3:4, 4:3, 5:7, 7:5, 16:9, 9:16. Just pick your frame.
  • scale - the one that trips people up. It defaults to 0.5, which builds the latent at half your chosen resolution. Pick "1:1 (4096x4096)" with the default scale and you're actually generating 2048×2048 - still 4× beyond FLUX native, still a place DyPE earns its keep, but not 4K. Set scale to 1.0 for true 4K, and make sure your VRAM can take it (16–24GB, more for the 16:9 preset).

Outputs are MODEL (the patched model, straight into your KSampler), empty_latent (pre-sized, pre-scaled latent), plus width/height INTs if a downstream node wants the real pixel dimensions.

Install

Easiest via ComfyUI Manager - search "ComfyUI Star DyPE" and hit install. Or the manual route:

cd ComfyUI/custom_nodes/
git clone https://github.com/Starnodes2024/comfyui_Starnodes_DyPE

Then restart ComfyUI. The node shows up under ⭐StarNodes/DyPE. Good news for a change: no model downloads, no hidden dependencies. requirements.txt is just torch and numpy, which ComfyUI already ships - this pack patches an existing checkpoint, so you don't download anything new.

Troubleshooting

  • "Model does not have pos_embed attribute" in the console - you fed it an SD1.5/SDXL model. FLUX-style transformers have pos_embed; UNets don't. Swap the checkpoint.
  • Out of memory - drop to a smaller aspect ratio, keep scale at 0.5, enable VAE tiling on decode, batch size 1. True 4K on a 12GB card is not happening.
  • Quality still degrades at high res - flip method to ntk and compare, make sure enable_dype is True, and lean on FLUX's own habits: 28–50 steps, CFG 3.5–4.5, euler/flowmatch sampling.

It's a young pack (first release, zero community footprint as of writing), so treat it as a tool to compare against your tiled-upscale workflow, not a replacement you must adopt. If it holds up, a single-pass 4K is a genuinely nicer experience than two passes of tiling - fewer seams, more coherent anatomy. Worst case you're out one clone and one KSampler.

Category⭐StarNodes/DyPE

Inputs (5)

NameTypeDefaultDescription
modelMODEL
methodCOMBOyarnPosition encoding method. YARN (recommended) combines NTK and linear interpolation. NTK uses Neural Tangent Kernel scaling. Base uses standard encoding.
enable_dypeBOOLEANtrueEnable Dynamic Position Encoding with timestep-aware scaling for better high-res results
aspect_ratioCOMBO1:1 (4096x4096)Select aspect ratio preset. All presets are optimized for ~16MP total resolution.
scaleFLOAT0.50.1–2Latent scale factor. 0.5 creates latent at half the chosen resolution (e.g., 2048x2048 for 4096x4096). 1.0 creates full-size latent.

Outputs (4)

NameTypeDescription
MODELMODEL
empty_latentLATENT
widthINT
heightINT