Nodes/ComfyUI-Keyframed/Evaluate Schedule At T (Batch)
ComfyUI Node

Evaluate Schedule At T (Batch)

All your frames' prompts in one tensor

By dmarx·Created 3 years ago·Updated 2 years ago· 92
Evaluate Schedule At T (Batch)
  • schedule
  • CONDITIONING
start0.00
step1.00
n24

Frame-by-frame prompting is elegant but slow. When you're running AnimateDiff-style sampling - a whole batch of frames through the sampler in one pass - you don't want to evaluate your prompt schedule once per frame and stitch the results; you want the whole batch of conditionings at once. KfGetScheduleConditionSlice is that batch version: give it a schedule plus start, step, and n, and it returns a single conditioning whose batch dimension is n frames, each one the interpolated prompt state for its frame. One node, one output, the entire animation's prompt timeline.

The intent is stated plainly in the README: use it with AnimateDiff to apply a different conditioning per frame. Its sibling KfGetScheduleConditionAtTime does the one-frame-at-a-time version; this is the one that matches a latent batch.

Why you'd reach for it

Any animation where you sample a batch of frames together and want the prompt to evolve across that batch. Wire the output into your KSampler's positive input where the batch of latents is [n, C, H, W], and each frame's conditioning lines up with its latent. If the schedule morphs from "a cat" to "a cat in a spacesuit" across 24 frames, this node hands the sampler 24 conditionings, frame 12 sitting halfway between the two prompts.

The inputs that matter

  • schedule - the SCHEDULE to sample, from Set Keyframe or Schedule Prompt.
  • start - a FLOAT, default 0. The first frame's time.
  • step - a FLOAT, default 1. The spacing between frames - 1 for consecutive frames, 2 for every-other.
  • n - an INT, default 24. The batch size / number of frames. This needs to match your latent batch. A 24-frame latent with n=24 is the happy path.

Output is a single CONDITIONING with batch size n. The internals are a bit unusual - the node torch.cats the interpolated tensors into one big tensor and wraps it in extra list layers - but what arrives at the sampler is a standard batched conditioning.

How it works

Under the hood it computes stop = start + n * step, builds n evenly spaced times with np.linspace(..., endpoint=True), evaluates the schedule at each one, then concatenates all the token tensors and all the pooled outputs into single batched tensors. One pass, one batch, all frames' prompts resolved.

Installing it

Part of ComfyUI-Keyframed (dmarx's pack wrapping his keyframed library). ComfyUI Manager: search "Keyframed". Or:

cd ComfyUI/custom_nodes
git clone https://github.com/dmarx/ComfyUI-Keyframed

Restart ComfyUI. The pack auto-installs keyframed and toolz on first load; no model downloads.

Troubleshooting

The classic failure is a batch mismatch: n=24 here but a 16-frame latent, and the sampler either errors or silently does something you didn't intend. Check the latent's batch with KfDebug_Latent - it's the perfect pairing. Second, watch step: a value that isn't 1 means you're sampling non-consecutive frames, which is only what you want if you're deliberately skipping. And the standing schedule rule applies - first keyframe at time=0, or early frames can evaluate to something unexpected.

Categorykeyframed/schedule

Inputs (4)

NameTypeDefaultDescription
scheduleSCHEDULE
startFLOAT0.00
stepFLOAT1.00
nINT24

Outputs (1)

NameTypeDescription
CONDITIONINGCONDITIONING