Nodes/Custom Node Kit/锚定+步内滚动(极简)
ComfyUI Node

锚定+步内滚动(极简)

The Wan Seam Fixer With Exactly One Switch

By user2318·Created 6 months ago·Updated 9 days ago· 58
锚定+步内滚动(极简)
  • model
  • anchor_frames
  • anchor_mask_frames
  • vae
  • model
◄enabledtrue►

Every long Wan video gets stitched, and every stitch is where things go wrong. You ask for 20 seconds, the model does 81 frames at a time, so a context-window node splits the sequence into overlapping windows and blends the overlap. Two windows each predict the same few frames slightly differently, and the weighted average gives you the classic seam: a ghost of the character doubled over itself, motion soft for half a second, background drifting.

锚定+步内滚动(极简) - "Anchor + Intra-step Rolling (Minimal)" - is a one-switch attempt at that problem. If you found it inside a Chinese-language Wan workflow, this is what it does.

Where it sits

Not a sampler - this generates nothing. It patches a model that has already been wrapped by a context-window node:

[Wan model] → Wan SCAIL-2 Context Windows / Custom Context Windows
            → 锚定+步内滚动(极简) → KSampler

Feed it a model that hasn't been through a window node and it raises immediately - it looks for the handler the window node installs, and names it in the error.

The two halves

The anchor half exists because Wan's rotary position encoding restarts at zero for every window: nothing knows where it sits in the clip, so each window infers its own baseline. On SCAIL-2, where driving frame and generated frame are paired rigidly by position, two baselines means two motion predictions in the overlap - and averaging that is how you get a double image. So the node gives every window a shared "what came before":

  • Anchor frames - a short run of frames from the start of your driving video, VAE-encoded and handed to every window as the same prefix. How many you feed is how many get used; no count parameter.
  • Read-only head context, 2 latent frames - a peek at the real neighbours. They attend, but they're cut before fusion, so they never become a second author.
  • Long-range memory group, 4 frames - driving frames spanning clip start to current window, at an automatic stride so later windows still reach frame zero.

The rolling half is the cleverer bit. Normally each window only sees the fused value from the previous denoising step, so a later window has no idea what the earlier one just decided this step. Rolling fixes that: before window k runs, the frames it shares with window k-1 get nudged toward k-1's current-step prediction, blended at β. Both windows share the same seeded noise for a frame, so at σ≈1 the commit degenerates into "that shared noise block" and the first step is untouched - the hook only develops an opinion as the sampler gets serious, which is why β switches on late (σ ≤ 0.5). The author's sweep put β=0.30/0.60/1.00 at 26–40 px seam jumps against 0.45 as the healthy band.

Inputs and output

Required: model (post-window-node) and enabled. Optional: anchor_frames (5–9 pixel frames from the head of the driving video, per the author), anchor_mask_frames (SCAIL-2 only - same frame numbers, coloured driving mask, no VAE needed), vae (the same Wan VAE your conditioning node used, required once anchor_frames is connected). Output: model, into your sampler.

Everything else - read-ahead, memory group, both betas, scope, curve - is pinned in FIXED_ANCHOR / FIXED_ROLL at the top of context_anchor_rolling.py. Want dials? Use the older 窗口锚定 and 步内滚动 nodes. This one is production; those are the lab.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/user2318/ComfyUI-CustomNodeKit

Restart. No model downloads - it works on whatever Wan or SCAIL-2 model you already have. The pack's install.py runs on import and pip-installs groundingdino-py and transformers on first boot for its pose nodes; harmless here, just don't panic at the wait.

Things that will bite you

  • One anchor-type node per workflow. The anchor pool is module-level state, so stacking this with the older anchor node gives two writers.
  • SCAIL-2 wants anchor_mask_frames. Anchors without it get refused, because the driving mask and video would disagree about the time base. Non-SCAIL models degrade instead: memory group off, anchors injected differently.
  • The token budget is real. Window + anchors + read-ahead is bound by the 21 latent frames the model trained on, which is why read-ahead is 2 - the source notes 6 pushes a window to 27 tokens and you get limb deformation.
  • Editing the pinned values needs a restart. The position-encoding patch is a process-level monkey patch, so changing a constant and re-queuing does nothing.
  • It's experimental, but deterministic. Same seed + same config = same result, so test it honestly: two or three seeds, each with enabled on and off. One "looks better" run tells you nothing. For diagnostics, an empty CWA_DEBUG.on file in the pack directory logs seam-level detail, no restart needed.

Cheap experiment, no new weights - and if your seams are fine, leave them alone.

Categorycontext

Inputs (5)

NameTypeDefaultDescription
modelMODEL已接入上下文窗口节点的模型(`Wan SCAIL-2 Context Windows` 或 `Custom Context Windows (Manual)` 的输出)。Model that already has a context windows node applied.
enabledBOOLEANtrue总开关;关闭时模型直接透传(并清空锚定池)。Master switch. 本节点只有一个设置项:只读前文 2 / 记忆组 4(自动间距)/ 锚定帧数量跟随输入 / 提交强度 0.45 / 继承帧 0.6,全部按实测基线固定。 需要调这些量时,请改用老节点「窗口锚定」/「步内滚动」(保留全部控件)。
anchor_framesoptIMAGE【基准帧】驱动/pose 视频里你想当统一基准的那几帧(例如整段视频开头几帧)。**给多少就用多少**(没有数量参数):会 VAE 编码成 latent,给每个窗口一份共同的「前文/基准」运动。不接=不做锚定(仍有只读前文与长程记忆组)。 Anchor basis frames (driving/pose video): how many you feed is how many are used. Leave unconnected to skip anchoring.
anchor_mask_framesoptIMAGE【仅 SCAIL-2】与 anchor_frames 同帧号的彩色遮罩帧(内部转成 28 通道,不需要 VAE)。SCAIL-2 下建议一起接,否则驱动遮罩与驱动视频的时间基准可能不一致。 SCAIL-2 only: colored mask frames matching anchor_frames (no VAE needed).
vaeoptVAE【接了 anchor_frames 时必接】与 conditioning 节点**同一个** Wan VAE(用于把基准帧编码成 latent;接错 VAE 会得到无意义的条件)。 Same Wan VAE as the conditioning node; required when anchor_frames is connected.

Outputs (1)

NameTypeDescription
modelMODEL—