Nodes/ComfyUI-WeightFerry/RoPE Scale (large images)
ComfyUI Node

RoPE Scale (large images)

Redraw at 2x the trained size without tiling, if your model is Anima or Cosmos

By nyanmi-1828·Created 10 days ago·Updated 6 days ago· 1
RoPE Scale (large images)
  • model
  • MODEL
◄modeoff►
◄factor2.00►
◄beta8.0►
◄min_tokens0►

The reason your 2x redraw repeats itself

Upscale an image by redrawing the whole thing at double size - no tiles, one pass - and if the target is well outside the model's training resolution you get duplication. Extra eyes, extra fingers, a second hair ribbon that nobody asked for. The image is too big for what the model has seen.

The whole-image path avoids tile seams entirely, which is its big advantage over Ultimate SD Upscale. Its failure mode is position embeddings. Anima and Cosmos-Predict2 use rotary position embeddings, and those are computed for a token grid whose size is bounded by the training resolution. Cram four times as many tokens in there and the frequencies are all wrong for the shape you're using. RoPE Scale re-maps the frequencies so the extended range still behaves like the trained one. This is the same trick the LLM world invented for context extension - NTK-aware scaling, YaRN - transplanted to a DiT's image positions.

Reach for it on the pack's "no tiles" upscale path: Upscale Image (using Model) → resize → VAE Encode → KSampler, with the model passing through RoPE Scale first. Anima's native range is roughly 512–1536 square per side and holds together less consistently at 2048, so if you're going from a 1280-ish base pass to a 2x output, this is the difference between a redraw and a redraw that repeats.

It's off by default. mode defaults to off and does nothing until you change it. That's deliberate - it changes the image by design, and on sizes inside the trained range it would be a pure downgrade.

How it works

The node hooks the diffusion model's position-embedding generation and substitutes its own while a forward pass runs, then restores the original. That's per-call, so it doesn't leak to other passes sharing the model - bring your own node for each KSampler that needs it. The token count for min_tokens is computed from the latent's spatial size divided by the patch size, so "only apply on big images" is a real spatial test, not a pixel guess.

Inputs and outputs

  • model - the Anima or Cosmos-Predict2 model.
  • mode - off, interpolate, ntk, yarn. Per the tooltips: interpolate divides positions by the factor; ntk raises the RoPE base by the factor; yarn interpolates low frequencies and keeps high ones, ramping by periods across the base-size axis. Start with ntk - that's the one the pack's own upscale instructions name.
  • factor (default 2, range 1–8) - size over base size, per axis. 2.0 for a 2x upscale. Don't set it to 3 because your output is 3x the pixels; it's a ratio of the base resolution the model was trained on, and the author's guidance is the simple one: 2.0 for 2x.
  • beta (8) - YaRN only. Periods across the base-size axis from which a frequency is kept. Ignore it unless you're using yarn.
  • min_tokens (0 = always) - apply only above a token count. The tooltip gives the scale: 896×1472 is 5152 tokens. Useful if one KSampler in your graph does both the base and the big pass and you only want scaling on the second.

One output, model.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/nyanmi-1828/ComfyUI-WeightFerry

or Manager → WeightFerry → install → restart. Nothing extra to install, and no model files. NVIDIA, ComfyUI 0.38.0+. The node lives in WeightFerry/upscale and only supports Anima and Cosmos-Predict2 - the README's node table says so outright.

Where it goes wrong

Wiring it into a Flux or SDXL graph. The node requires a position embedder with the right attributes; without one it silently does nothing (the wrapper checks and falls through to the original call). So you get no error and no effect, which is the worst combination. It's Anima/Cosmos only.

Leaving mode off and blaming the node. This is the number one way to waste an afternoon with it. It's off by default; set ntk and factor 2.0.

Using it inside the tiled path. For Ultimate SD Upscale the tiles are the size the model expects, so position scaling is pointless there. Tiles solve extension spatially; RoPE scaling solves it positionally. Pick one path per upscale, not both.

Pushing factor past what your VRAM can carry. Scaling the positions lets the model handle more tokens; it doesn't make the attention cheaper. A 4x redraw is four times the tokens of the source squared-ish, and if you're on 8GB you'll be back to the pack's DiT streaming, activation streaming, and probably a tile pass anyway. If you have to tile it, you didn't need RoPE scaling.

Expecting batch-exact reproduction. This changes the image by design, and unlike the pack's streaming nodes it comes with no bit-exactness claim. Compare it at the same seed against the tiled path and decide; the tiled path's seams versus this one's possible repetition is the actual trade-off.

CategoryWeightFerry/upscale

Inputs (5)

NameTypeDefaultDescription
modelMODEL—
modeCOMBOoffoff: unchanged. interpolate: positions / factor. ntk: RoPE base raised by factor. yarn: low frequencies interpolated, high kept (ramp by periods across the base-size axis)
factorFLOAT2.001–8size / base size per axis (2.0 for a 2x upscale)
betaFLOAT8.01–64yarn: periods across the base-size axis from which a frequency is kept
min_tokensINT00–1000000apply only when the image has at least this many tokens (0 = always)

Outputs (1)

NameTypeDescription
MODELMODEL—