Nodes/ComfyUI-Apt_Preset/pre_sample_data
ComfyUI Node

pre_sample_data

Override sampler/scheduler/steps/cfg in the run context, or leave them alone

By cardenluoĀ·Created 2 years agoĀ·Updated 17 days agoĀ· 309
pre_sample_data
  • context
  • context
ā—„steps0ā–ŗ
ā—„cfg0.00ā–ŗ
ā—„samplereulerā–ŗ
ā—„schedulernormalā–ŗ

This is a small, sharp tool: it writes steps, cfg, sampler, and scheduler into the pack's shared context bundle, so every downstream sampler node in your graph reads from one place instead of four separate widgets scattered across the workflow. The clever bit is in the tooltip on the two numeric fields - 0 means "no change." Set steps or cfg to 0 and this node leaves whatever value was already sitting in context untouched, rather than overwriting it with zero. That makes it safe to drop into the middle of a graph as a partial override - bump just the cfg without having to also know and re-specify the right step count.

sampler and scheduler don't have that same escape hatch (there's no "leave unchanged" enum value), so if you only want to touch steps/cfg and leave the sampler pair alone, just set them to whatever the upstream loader already had.

The inputs and outputs that matter

  • context (required) - the pack's run-context bundle, read and re-emitted with the sampling settings folded in.
  • steps (required, default 0, range 0–10000, tooltip "0 == no change") - denoising step count.
  • cfg (required, default 0, range 0–100, tooltip "0 == no change") - classifier-free guidance scale.
  • sampler (required, default euler, one of 44 choices - the full stock ComfyUI sampler list: Euler, Euler ancestral, the DPM++ family, Heun, LMS, and so on).
  • scheduler (required, default normal, one of 9: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, normal, linear_quadratic, kl_optimal).
  • Output: context only - this node doesn't touch model, conditioning, or latent, just the sampling parameters riding along inside the bundle.

Worth knowing before you touch sampler/scheduler: which pair is right depends entirely on what architecture you're running. DDPM-style checkpoints (SD 1.5, SDXL and its anime finetunes) still want DPM++ 2M on karras, or euler_ancestral on default for the anime family. Flow-matching models (Flux, Qwen-Image, Z-Image) actively dislike karras and exponential - a large sweep across dozens of sampler/scheduler pairs on Z-Image Turbo found both failing across the board rather than merely underperforming - and want Euler-family samplers on beta, simple, or linear_quadratic instead. Don't carry an SDXL habit onto a flow-matching model by default.

How to install it

Search ComfyUI-Apt_Preset in ComfyUI Manager, or clone it manually:

cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset.git

install.bat is the Windows dependency script; on Linux or Mac, open it, read the pip commands, and run them yourself, or let ComfyUI Manager sort out anything missing on first load. Nothing to download for this node - it's pure parameter bookkeeping.

Common issues & troubleshooting

You set steps or cfg to 0 expecting it to actually mean zero. It doesn't, by design - 0 is the sentinel for "leave existing value alone" per the node's own tooltip. If you genuinely need a downstream sampler to run at CFG 0 or 0 steps (unusual, but not impossible in some experimental setups), this node can't express that; set it further downstream instead.

Sampler/scheduler choice looks fine but output quality is worse than expected. Check the architecture first, not the node. DPM++ 2M Karras is not a universal default any more - it's the right call on SD 1.5/SDXL and actively wrong on flow-matching models. If you're on Flux, Qwen-Image, or Z-Image and something looks off, swap off karras/exponential before touching anything else.

Overriding partway through a long context chain and the change doesn't seem to apply. Confirm this node sits before the sampler that reads context in your graph's execution order, and that nothing further downstream re-overrides the same fields with another pre_sample_data or equivalent node.

CategoryApt_Preset/chx_tool/😺backup

Inputs (5)

NameTypeDefaultDescription
contextRUN_CONTEXT—
stepsINT00–10000 0 == no change
cfgFLOAT0.000–100 0 == no change
samplerCOMBOeuler44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38
schedulerCOMBOnormal9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3

Outputs (1)

NameTypeDescription
contextRUN_CONTEXT—