Nodes/XB_ToolBox/XB-BOX - 🎯 Wan 采样器
ComfyUI Node

XB-BOX - 🎯 Wan 采样器

The Wan sampler that cleans up after itself

By wjluoxiao·Created 5 months ago·Updated 6 days ago· 302
XB-BOX - 🎯 Wan 采样器
  • model
  • image_embeds
  • text_embeds
  • samples
  • samples
  • denoised_samples
steps20
cfg6.0
shift8.0
seed0
force_offloadtrue
schedulerunipc
riflex_freq_index0
cleanup单次缓存清理
denoise1.00
batched_cfgfalse

This is the sampling step in XB-BOX's Wan chain. Feed it the WANVIDEOMODEL from XB_WanModelLoader (or the wrapper's own loader), your image_embeds and text_embeds, and it runs the actual diffusion loop that turns all that conditioning into a video latent. The name in your node list is "🎯 Wan 采样器", and the reason to reach for it over the plain wrapper sampler is that it's built for small GPUs and flaky drivers: on AMD/ROCm it synchronizes to catch async HIP errors and, if the first attempt blows up, clears the cache and retries once before it gives up. On NVIDIA it's essentially a thin, tidy wrapper - nothing wrong with that, just know what you're getting.

How it works

Under the hood it's a pass-through to ComfyUI-WanVideoWrapper's WanVideoSampler, which is kijai's port of the official Wan sampling code. XB's version adds the VRAM hygiene: the cleanup dropdown has three settings - do nothing, "单次缓存清理" (single cache cleanup, a torch.cuda.empty_cache()), and "双次缓存清理" (double cleanup: soft_empty_cache + empty_cache + gc.collect()). On a 8–16GB card running a 14B Wan model, that post-run sweep is the difference between your next segment starting clean and starting one step from OOM.

The inputs that matter

Most of these are standard sampler fare, so here's the short list worth touching:

  • steps / cfg / seed - the usual. Wan likes cfg around 5–6.
  • shift - default 8; leave it alone unless your workflow tells you otherwise.
  • scheduler - default unipc, which is what most Wan workflows want.
  • force_offload (default on) - moves model weights off the GPU between steps; keep it on unless you're chasing speed on a big card.
  • riflex_freq_index - only relevant if you're doing RiFLEX long-context generation. Leave 0 otherwise.
  • denoise and samples (optional) - wire these in to do img2vid-style partial denoising instead of a full generation.
  • batched_cfg - off by default; flip it if your wrapper setup uses batched classifier-free guidance.

Outputs are samples (the latent you decode to video) and denoised_samples (a cleaner estimate; most workflows just use the first one).

Install

Same install as the whole pack - ComfyUI Manager (search XB_ToolBox) or:

cd ComfyUI/custom_nodes
git clone https://github.com/WJLUOXIAO/XB_ToolBox

Restart ComfyUI. One thing the README glosses over: the Wan nodes in this pack need ComfyUI-WanVideoWrapper installed as a separate custom node - the code literally raises an error if it can't find a folder starting with ComfyUI-WanVideoWrapper. Install that too, and drop your Wan 2.1/2.2 diffusion model into ComfyUI/models/diffusion_models.

Common issues

The most common failure is the missing-wrapper error I just mentioned - the message names ComfyUI-WanVideoWrapper outright and tells you to install it. Second: an immediate HIP/CUDA failure on the first run, then success on the retry. That's the fallback working; it means your card was borderline on memory. Give the 双次缓存清理 cleanup option a try so the next run starts from a clean slate.

CategoryXB_ToolBox/Wan

Inputs (14)

NameTypeDefaultDescription
modelWANVIDEOMODEL
image_embedsWANVIDIMAGE_EMBEDS
stepsINT201–1000
cfgFLOAT6.00–30
shiftFLOAT8.00–100
seedINT00–18446744073709550000
force_offloadBOOLEANtrue
schedulerCOMBOunipc5 options: unipc, dpmpp_2m, dpmpp_sde, euler, heun
riflex_freq_indexINT00–1000
cleanupCOMBO单次缓存清理3 options: 不做任何清理, 单次缓存清理, 双次缓存清理
text_embedsoptWANVIDEOTEXTEMBEDS
samplesoptLATENT
denoiseoptFLOAT1.000–1
batched_cfgoptBOOLEANfalse

Outputs (2)

NameTypeDescription
samplesLATENT
denoised_samplesLATENT