Nodes/ComfyUI-DiT360/Apply Circular RoPE
ComfyUI Node

Apply Circular RoPE

Teaching a flat-trained model that the panorama wraps

By cedarconnor·Created 10 months ago·Updated 9 months ago· 3
Apply Circular RoPE
  • model
  • model
enabletrue
modeshift
seam_width0
verbosefalse

This is the pack's experimental heart, and its honest answer to a real question: padding and blending fix the image, but the model's attention never knew the left edge was adjacent to the right edge. Apply Circular RoPE patches the model's rotary position embeddings so attention treats horizontal positions as wrapping - position 0 and position W−1 become neighbors inside the attention computation itself. If it works, you get seamless output straight from the sampler, no post-processing. It often doesn't work cleanly, and the pack knows it.

Inputs:

  • model - your diffusion model (FLUX UNet + DiT360 LoRA).
  • enable (default true) - an on/off switch so you can A/B test without rewiring. The tooltip's own recommendation: keep it OFF unless you're specifically testing attention-level seam handling.
  • mode - shift (default) or angle. shift wraps only a band of token columns near the right edge - conservative, which is what you want for a model trained on flat, non-wrapping images like FLUX. angle maps X positions onto a circle in radians: aggressive, and the pack warns it can degrade results.
  • seam_width (default 0 = auto) - shift mode only: how many token columns near the right edge to wrap. 0 (auto) or 4–16 is the recommended range; larger values distort the image.
  • verbose - prints one-time diagnostic info about the patch (inferred token width, mode, seam width). Turn it on once to see what the node actually inferred.

Output is the patched model, wired into your sampler. Under the hood it locates the RoPE position embedder on the diffusion model (probing for pe_embedder / pos_embed / rope_embedder), wraps its forward, and re-derives the positions so the horizontal axis is circular - either just at the seam band (shift) or globally (angle). Same family of idea as the circular RoPE experiments people have poked at for FLUX and other DiT models, just packaged as a node.

Install

Same as the whole pack - Manager (search "ComfyUI-DiT360"), or:

cd ComfyUI/custom_nodes
git clone https://github.com/cedarconnor/ComfyUI-DiT360
cd ComfyUI-DiT360
pip install -r requirements.txt

then restart. No extra model downloads for this node beyond FLUX.1-dev + the DiT360 LoRA (strength 1.0).

Where people get burned - take the README literally

  • Washed out or broken output → prefer full-precision FLUX dev over fp8 when testing RoPE. fp8 quantization plus a position patch is asking for trouble.
  • Use shift, start with seam_width 0 or 4–16. Larger values distort. The pack says this twice, in both tooltips.
  • If it's broken, turn the patch off and rely on padding + Edge Blender. That's the pack's own first-line recommendation, not a failure on your part.
  • Don't stack patches - if you're also patching the VAE, zero the decode padding, and don't run Apply Circular Panorama alongside a separate RoPE node unless you enjoy double-patching.

Honest take: keep expectations calibrated. RoPE patching on models trained for planar (non-wrapping) images is genuinely model-dependent, and the pack marks it experimental for a reason. It's a great node to have for testing - the enable switch makes A/B testing painless - but for a daily 360° workflow, circular padding in the sampler plus the Edge Blender is the reliable path. Use this when you want to know whether the attention-level fix helps your model, not as the default.

CategoryDiT360/position_encoding

Inputs (5)

NameTypeDefaultDescription
modelMODELConnect your diffusion MODEL (e.g., FLUX UNet + DiT360 LoRA).
enableoptBOOLEANtrueToggle the RoPE patch on/off (useful for A/B testing without rewiring). Recommended: OFF unless you are testing attention-level seam handling.
modeoptCOMBOshiftRoPE circularization strategy. Recommended: shift (safer for planar-trained models like FLUX). Angle is aggressive/experimental and may degrade results.
seam_widthoptINT00–4096Only for mode='shift': token columns near the right edge to wrap. Recommended: 0 (auto) or 4-16. Larger values can distort the image.
verboseoptBOOLEANfalsePrint one-time diagnostic info (inferred token width, mode, seam width). Enable for debugging.

Outputs (1)

NameTypeDescription
modelMODEL