Nodes/comfyui-toml-prompt/KSamplerFromString
ComfyUI Node

KSamplerFromString

A KSampler you can wire a config into

By morino-kumasan·Created 2 years ago·Updated a day ago· 1
KSamplerFromString
  • model
  • positive
  • negative
  • latent_image
  • LATENT
denoise1.00
steps20
cfg1.0
sampler
scheduler
seed0

Take the stock KSampler, keep every setting, and make each one an input socket instead of a widget. That's KSamplerFromString: steps, cfg, sampler, scheduler and seed all arrive as inputs, so a TOML prompt file's exports - or a chain of JsonExtract* nodes - can set your sampling parameters from outside the graph.

It's the same node you already know, wrapped. The reason to reach for it is the reason this pack exists: if your prompt file already knows that this character's render wants 28 steps at cfg 5 on euler_ancestral/karras, you shouldn't have to retype that into three widgets every time you switch keys.

How it works

Under the hood it instantiates core KSampler and passes your values straight through:

return self.sampler.sample(
    model, seed, steps, cfg, sampler, scheduler,
    positive, negative, latent_image, denoise=denoise,
)

No reimplementation of the sampling loop, no altered defaults in the engine - the creative part is entirely in what feeds those arguments. And because sampler and scheduler are plain STRING inputs rather than dropdowns, the values come from anywhere: a typed-in name, a JsonExtractString off a config, a StringConcat. That flexibility is also the main hazard, covered below.

denoise stays a normal widget-style input with a 0.01.0 range and a default of 1.0, so a hires-fix second pass can dial it down without touching the config.

Inputs and outputs

Required: model, positive, negative, latent_image, denoise, steps (1–10000, default 20), cfg (0–100, step 0.1, default 1.0), sampler (string, tooltip "sampler name."), scheduler (string, tooltip "scheduler name."), seed. One LATENT output, which goes to a VAEDecode - or to a second sampler if you're doing a two-stage pass, as this pack's own hires-fix samples do.

Install

Manager search for the pack, or:

cd ComfyUI/custom_nodes
git clone https://github.com/morino-kumasan/comfyui-toml-prompt

restart ComfyUI. Nothing gets pip-installed; the repo's requirements.txt is empty and the node only needs ComfyUI's own nodes.py classes. The README's install instructions are stale (old comfyui-utils repo name, SSH URL) - the HTTPS clone above is the correct one.

Where people get burned

Typos in sampler and scheduler fail at run time, not in the graph. There's no dropdown here, so no validation and no autocomplete, and the name just gets handed to core KSampler. Spell them exactly as the stock node's dropdown spells them (euler_ancestral, dpmpp_2m, karras, beta). Worth knowing: if a scheduler name isn't in stock ComfyUI at all - beta57, res_2m, bong_tangent and friends - you're looking at a RES4LYF dependency that the workflow assumed you had installed, not a typo.

cfg default is 1.0. That's not a mistake, it's the modern default, but understand it: on a guidance-distilled model at CFG 1 ComfyUI skips the unconditional pass entirely, so whatever is in your negative input is discarded on the floor. A negative prompt that "does nothing" here is expected behaviour, not a broken node.

It is a queue-time error, not a silent one, so read the traceback. The failure surfaces at the sampler node even when the bad string came from three nodes upstream - from a config file, or from a JsonExtractString whose path stopped resolving. Check the source of the string, not the sampler.

Categorysampling

Inputs (10)

NameTypeDefaultDescription
modelMODEL
positiveCONDITIONINGPositive.
negativeCONDITIONINGNegative.
latent_imageLATENT
denoiseFLOAT1.000–1
stepsINT201–10000
cfgFLOAT1.00–100
samplerSTRINGsampler name.
schedulerSTRINGscheduler name.
seedINT00–18446744073709550000

Outputs (1)

NameTypeDescription
LATENTLATENTLATENT