Nodes/XB_ToolBox/XB-BOX - 高级采样器(原版优化)
ComfyUI Node

XB-BOX - 高级采样器(原版优化)

KSamplerAdvanced with the pre-run memory sweep

By wjluoxiao·Created 5 months ago·Updated 6 days ago· 302
XB-BOX - 高级采样器(原版优化)
  • model
  • positive
  • negative
  • latent
  • LATENT
add_noise
noise_seed0
steps20
cfg8.0
sampler
scheduler
start_at_step0
end_at_step10000
return_with_leftover_noise
cleanup不做任何清理

The advanced sibling of XB_ROCmKSampler: ComfyUI's stock KSamplerAdvanced, wrapped with the same cleanup dropdown bolted on the front. If you need step-range control - start at step 40, stop at 80, keep leftover noise for a chained pass - this is the one, and it brings the same pre-run memory cleanup the basic version offers.

Everything the basic node does, this does with the extra dials. And because it's a wrapper around the official KSamplerAdvanced (same "原版优化" family, same legacy-alias lineage as XB_ROCmKSampler), there's no custom sampling logic to distrust - the official node does the sampling, the wrapper just cleans up before handing over.

The inputs that matter

All the KSamplerAdvanced staples, plus cleanup:

  • model, positive, negative, latent - standard.
  • add_noise (enable/disable) and noise_seed - decide whether this pass adds fresh noise; disable it when the pass continues from a prior latent's noise state.
  • start_at_step / end_at_step - the range of steps this node runs. The advanced sampler's whole point: run steps 0–20 with one model/prompt, then a second node from 20–40 with another.
  • return_with_leftover_noise (disable/enable) - keep the last step's noise so a subsequent pass can chain. Enable when this is the first half of a two-stage denoise.
  • steps, cfg, sampler (44), scheduler (9) - same as stock.
  • cleanup - the four-level memory sweep: 不做任何清理单次缓存清理卸载显存模型卸载全量模型. For a two-node advanced setup, running the cleanup on both halves is usually overkill; set the heavy level on the node where the graph actually OOMs.

Output is LATENT.

Where the advanced dials earn their keep

The two-node refiner pattern - that's the classic. High-noise model for steps 0–N with return_with_leftover_noise enabled, low-noise model for N–end with add_noise disabled. XB_ToolBox even sells a dual loader (XB_ModelLoaderV2) built around exactly that setup. If you're on AMD and the refiner pass keeps dying to fragmentation, this node's cleanup is the guardrail that setup needs.

How it works under the hood

Same design as its sibling: it copies the official INPUT_TYPES, injects cleanup, and on execution pops the cleanup level, runs the memory sweep, then forwards your kwargs (with the legacy latentlatent_image and samplersampler_name remaps) to nodes.KSamplerAdvanced().sample(). Nothing custom about the math, everything custom about the hygiene.

Install & usage

cd ComfyUI/custom_nodes
git clone https://github.com/WJLUOXIAO/XB_ToolBox.git
# or: ComfyUI Manager → "XB_ToolBox"

No extra deps. The same practical ladder as the basic node: leave cleanup off until you see an OOM, then step up one level at a time. For chained advanced setups, remember the leftover-noise contract - if you disable return_with_leftover_noise on a pass the next one expects to continue, the handoff breaks and you get a jump-cut in your denoise, cleanup or no cleanup.

CategoryXB_ToolBox/原版优化

Inputs (14)

NameTypeDefaultDescription
modelMODEL
add_noiseCOMBO2 options: enable, disable
noise_seedINT00–18446744073709550000
stepsINT201–10000
cfgFLOAT8.00–100
samplerCOMBO44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38
schedulerCOMBO9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3
positiveCONDITIONING
negativeCONDITIONING
latentLATENT
start_at_stepINT00–10000
end_at_stepINT100000–10000
return_with_leftover_noiseCOMBO2 options: disable, enable
cleanupCOMBO不做任何清理4 options: 不做任何清理, 单次缓存清理, 卸载显存模型, 卸载全量模型

Outputs (1)

NameTypeDescription
LATENTLATENT