WanVideo RoPE Function
Pick Wan's RoPE implementation (and save VRAM)
- rope_function
This is a low-level knob for how Wan computes its rotary positional embeddings (RoPE) - the math that tells the model where each token sits in space and time. Most people never touch it. The reason it exists as a selectable node is that different implementations trade speed against VRAM, and the comfy_chunked option in particular can rescue a generation that's OOMing by computing RoPE in chunks instead of all at once. If you're wrestling a big clip onto a card that doesn't quite have the memory, this is one of the levers.
RoPE also underpins the frame-extension tricks. It's the same positional machinery that RIFLEx tweaks to push Wan past its trained length - the KB describes how "one particular frequency component in that encoding is what causes the repeating/looping artifact." This node doesn't do RIFLEx, but it exposes the RoPE function and its NTK scaling, which is the same family of controls.
How it works
You pick a RoPE implementation and set optional NTK scaling factors, and the node outputs that choice to wire into the Wan model setup. The implementations compute the same embeddings different ways; comfy_chunked splits the work to hold less in memory at once. The NTK scale factors stretch the positional frequencies per axis (frame/height/width) - a way to nudge how the model extrapolates positions, mostly of interest for length or resolution extension.
The inputs and output
rope_function(defaultcomfy) - the implementation:default,comfy, orcomfy_chunked.comfyis the standard choice; switch tocomfy_chunkedif you're memory-constrained and willing to trade a little speed.defaultis the reference path.ntk_scale_f/ntk_scale_h/ntk_scale_w(all default 1.0) - NTK-aware scaling for the frame (time), height, and width axes. Leave them at 1.0 unless you're deliberately experimenting with extrapolation; 1.0 means no scaling.
The single output is rope_function - the selected configuration, passed into the Wan model/patcher that consumes it.
How to install it
Bundled with Kijai's WanVideoWrapper. ComfyUI Manager: search ComfyUI-WanVideoWrapper, install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-WanVideoWrapper
pip install -r ComfyUI-WanVideoWrapper/requirements.txt
then restart. No download; it selects code paths already in the wrapper.
Common issues & troubleshooting
Out of memory on long or high-res clips. This is the node's best use: set rope_function to comfy_chunked. It computes positional embeddings in pieces so you don't materialize the whole thing at once. Slower, but it can be the difference between a finished render and an OOM.
You changed NTK scales and everything warped. The ntk_scale_* factors are not casual knobs - pushing them off 1.0 changes how the model interprets position and can distort geometry or motion. If you didn't set them deliberately, put them back to 1.0.
No visible difference between default and comfy. Expected in the common case - they compute the same embeddings. The choice matters for compatibility and memory behavior, not usually for the picture. Only reach for this node when you have a specific speed/VRAM problem to solve.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| rope_function | COMBO | comfy | 3 options: default, comfy, comfy_chunked |
| ntk_scale_f | FLOAT | 1.000–100 | — |
| ntk_scale_h | FLOAT | 1.000–100 | — |
| ntk_scale_w | FLOAT | 1.000–100 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| rope_function | default,comfy,comfy_chunked | — |