Nodes/ComfyUI-bleh/BlehSetSamplerPreset
ComfyUI Node

BlehSetSamplerPreset

Sneak a custom sampler into FaceDetailer and friends

By blepping·Created 3 years ago·Updated 2 months ago· 142
BlehSetSamplerPreset
  • sampler
  • any_input
  • override_sigmas_opt
  • dummy_opt
  • *
preset0
discard_penultimate_sigmafalse

FaceDetailer, and a handful of other convenience nodes across the ecosystem, only let you pick a sampler from ComfyUI's built-in dropdown - there's no SAMPLER input slot to plug a custom one into. This node is the workaround: it registers a custom sampler under a named slot that then shows up as an ordinary option inside that same dropdown, anywhere in your ComfyUI instance.

It's filed under bleh's "hacks" category, and that's an honest label. This isn't a graph connection in the normal sense - running the node assigns your sampler to a global preset slot (bleh_preset_0 by default) on the ComfyUI server itself. Anything downstream that later picks that preset name from its own built-in list will use whatever sampler you set here, even nodes that were never written with custom sampling in mind.

Because it's a server-side assignment rather than a data connection, it has to actually execute before whatever's using the preset. That's what any_input is for: it's a wildcard passthrough that exists purely to force execution order. Route something you're already passing through this stage of your graph - your model, your latent, whatever - into any_input, and take the identical value back out unchanged. ComfyUI's dependency graph then knows this node has to run before the downstream stage. Worth flagging the type-safety cost of that trick: since any_input and the output are both wildcard-typed, ComfyUI's normal "you can't wire a LATENT into a MODEL slot" protection is switched off here. Connect the output to something that actually expects what you fed in, or you'll trade a graph-time error for a confusing runtime one.

Other inputs: sampler (the SAMPLER you're registering), preset (which slot to assign - the widget's own range is capped by however many presets you've configured, controlled by the COMFYUI_BLEH_SAMPLER_PRESET_COUNT environment variable, which defaults to just 1; set it to 0 to disable the feature entirely, or raise it if you need more than one named slot), discard_penultimate_sigma (bundles in the same fix as the standalone BlehDiscardPenultimateSigma node - flip it on if your preset sampler is something prone to dumping noise on the last step, like dpmpp_3m_sde). Two optional inputs round it out: override_sigmas_opt lets you swap in your own SIGMAS (can't combine with the discard option above), and dummy_opt accepts anything - connect a string or integer here and change its value whenever you need to force the node to re-run.

That last input matters more than it looks like it should. The README calls out a genuinely sharp edge: in a workflow shaped like Set Preset 0 → KSampler1 (preset 0) → Set Preset 0 → KSampler2 (preset 0), editing only KSampler1 and re-running won't cause the first Set Preset node to re-execute - ComfyUI's caching sees nothing upstream changed. You'll silently sample KSampler1 with whatever preset the second Set Preset node assigned. Wiring something into dummy_opt and bumping it is the documented way to force a re-set when this bites you.

Install is the standard route - ComfyUI Manager, or a manual clone of blepping/ComfyUI-bleh into custom_nodes plus a restart. No extra dependencies for this node specifically.

Categoryhacks

Inputs (6)

NameTypeDefaultDescription
samplerSAMPLERSampler to use for this preset.
any_input*This input is simply returned as the output. Note: Make sure you connect this node's output to something that supports input connected here.
presetINT0-1–0Preset index to set. If set to -1, no preset assignment will be done. The number of presets can be adjusted, see the README.
discard_penultimate_sigmaBOOLEANfalseAdvanced option to allow discarding the penultimate sigma. May be needed for some samplers like dpmpp_3m_sde - if it seems like the generation has a bunch of noise added at the very last step then you can try enabling this. Note: Cannot be used when override sigmas are attached.
override_sigmas_optoptSIGMASAdvanced option that allows overriding the sigmas used for sampling. Note: Cannot be used with discard_penultimate_sigma. Also this cannot control the noise added by the sampler, so if the schedule used by the sampler starts on a different sigma than the override you will likely run into issues.
dummy_optopt*This input can optionally be connected to any value as a way to force the node to run again on demand. See the README.

Outputs (1)

NameTypeDescription
**This just returns the value of any_input unchanged. WARNING: ComfyUI's normal typechecking is disabled here, make sure you connect this output to something that allows the input type.