ComfyUI Node

KSamplerXYZ

Sweep seeds, steps, CFG, and even models in one run

By CYBERLOOM-INC·Created 3 years ago·Updated 2 years ago· 11
KSamplerXYZ
  • setting
  • model
  • LATENT
seed
steps
cfg
sampler_name
scheduler

If you've ever used A1111's X/Y/Z plot script, you know the drill: run the same prompt across a sweep of seeds, steps, or CFG values, tile the results into a grid, and eyeball which settings win. KSamplerXYZ is that script for ComfyUI - and it goes one step further, because the hnmr pack can sweep models too, not just numbers.

It takes a setting dict (built by KSamplerSetting) as the baseline, then reads five optional text fields: seed, steps, cfg, sampler_name, and scheduler. Anything left empty is ignored, so the dict value stands. Type a comma-separated list into a field - "10, 15, 20, 30" in steps - and the sampler runs each one. Ranges work too: "10-30(5)" parses to 10, 15, 20, 25, 30 (inclusive), and float ranges like "4-9(1.5)" are supported for cfg. Every combination across every field is sampled, then all the results are concatenated into one giant LATENT batch.

Here's the part to plan around: the output batch is the cartesian product of your sweeps. Sweep 5 steps × 4 CFG values × 3 seeds and you get a 60-image batch in one pass. That's a lot of VRAM if you decode it in one shot - feed the output to VAEDecodeBatched (batch 4 or 8) rather than a plain VAE Decode, then stack them with GridImage and set x to your number of columns. That readback loop is the standard way to actually look at an XYZ result.

The model-sweep trick comes from the pack's ModelIter, CLIPIter, and VAEIter nodes. Chain ModelIter (or CLIPIter, or VAEIter) into the sampler and the same prompt gets run against each model/CLIP/VAE in the chain, all in the same pass. That's the killer feature - compare two checkpoints or two VAEs on identical seeds without babysitting the graph.

Install via ComfyUI Manager (search "ComfyUI-nodes-hnmr") or:

cd ComfyUI/custom_nodes
git clone https://github.com/CYBERLOOM-INC/ComfyUI-nodes-hnmr

Restart and you're set - no models to download, no dependencies beyond ComfyUI's own. This fork exists because the original pack broke with newer ComfyUI (No module named 'comfy.ldm.models.diffusion.ddpm'); if you hit that, you installed the unmaintained original.

Pitfalls, from experience. Big sweeps are slow by design - a 60-sample run is 60 full generations, so keep test prompts short. Forgetting to leave a field empty when you don't want to sweep it is the classic mistake; an empty string means "use the dict." And if a range doesn't behave, check the syntax - steps and seed parse as integers, cfg as floats, and a typo like a missing ) raises a clear "failed to process" error naming the offending value. Start with one axis, confirm the grid layout, then add dimensions.

Categorysampling

Inputs (7)

NameTypeDefaultDescription
settingDICT
modeloptMODEL
seedoptSTRING
stepsoptSTRING
cfgoptSTRING
sampler_nameoptSTRING
scheduleroptSTRING

Outputs (1)

NameTypeDescription
LATENTLATENT