Nodes/Deforum Nodes/(deforum) KSampler
ComfyUI Node

(deforum) KSampler

The KSampler that takes its orders from the Iterator

By XmYx·Created 3 years ago·Updated 3 months ago· 198
(deforum) KSampler
  • model
  • latent
  • positive
  • negative
  • deforum_frame_data
  • LATENT

You already know what a KSampler does. (deforum) KSampler is the version of that node that doesn't make you set seed, steps, CFG, sampler, scheduler or denoise by hand - it reads all of them from the DEFORUM_FRAME_DATA that the (deforum) Iterator Node emits each pass. In a Deforum loop those values change every frame (that's the whole point of the schedules), so a sampler that ignores per-frame data would break the animation. This one is built to consume it.

What it replaces

In a normal graph you'd wire a standard KSampler and set everything in the widget. In the node-based Deforum workflow, the widget values live in schedules - cfg_scale_schedule, steps_schedule, strength_schedule and the rest in the parameter nodes - and the Iterator resolves them into per-frame numbers. The Deforum KSampler simply reads those resolved values out of the frame data: seed, steps, cfg, sampler_name, scheduler, and denoise. If a value isn't in the frame data, it falls back to sensible defaults (euler_a, normal, denoise 1.0).

Mechanically it's a thin wrapper around ComfyUI's own common_ksampler - the exact sampler machinery you already trust - with the widget inputs replaced by the frame-data input. If you've built your own Deforum graph and want a specific sampler for one frame type, you can still use a stock KSampler; this node is just the path of least resistance.

The inputs and outputs that matter

  • model - your checkpoint.
  • latent - the latent to sample, typically the Iterator's latent output or a Load Cached Latent.
  • positive / negative - CONDITIONING, usually from the (deforum) Blend Conditionings node or CLIP Text Encodes fed from the Iterator's prompt outputs.
  • deforum_frame_data (DEFORUM_FRAME_DATA) - the per-frame payload from the Iterator. This is the input that makes it a Deforum KSampler. Without it, nothing is set and the defaults take over.

Output:

  • LATENT - the sampled latent. Wire it back into (deforum) Cache Latent to close the loop, into a VAE Decode to preview, or into the Frame Warp / Cadence nodes.

Installing this pack

Part of Deforum Nodes by XmYx. ComfyUI Manager: search Deforum Nodes, or:

cd ComfyUI/custom_nodes
git clone https://github.com/XmYx/deforum-comfy-nodes

Restart, let install.py pull the deforum-studio backend from GitHub plus the scientific-Python stack (numpy < 2.0, Python 3.10 required). No extra model downloads - sampling uses your loaded checkpoint.

Common issues

  • Sampler settings seem to be ignored. You're probably changing values in the widgets of a stock KSampler instead of the schedules, or the frame data isn't wired in. With the Deforum KSampler, per-frame values always win; if you want a hard override, put it in the schedules.
  • Black/garbage frames. Classic latent/sampler mismatch - check the Iterator's latent_type matches your model family, and that the latent is float (the node converts internally, but a NaN source latent won't recover).
  • Everything samples with euler_a/denoise 1.0. That's the default fallback when the frame data doesn't carry those keys - usually means the frame data is stale or empty. Verify the Iterator is upstream and running.
  • Steps too low / too high. steps comes from steps_schedule in (deforum) Diffusion Parameters, but only when enable_steps_scheduling is on. Otherwise the per-frame steps default applies.
Categorydeforum/sampling

Inputs (5)

NameTypeDefaultDescription
modelMODEL
latentLATENT
positiveCONDITIONING
negativeCONDITIONING
deforum_frame_dataDEFORUM_FRAME_DATA

Outputs (1)

NameTypeDescription
LATENTLATENT