Nodes/deforum-comfy-nodes/Accumulation Set Item | Deforum
ComfyUI Node

Accumulation Set Item | Deforum

Replace one entry in an accumulation without touching the rest

By deforum·Created about a year ago·Updated 3 months ago· 29
Accumulation Set Item | Deforum
  • accumulation
  • value
  • ACCUMULATION
index0

Most of the Deforum list nodes are about building an accumulation - appending in a loop, reading back, popping ends. Accumulation Set Item is the one that edits in place: give it an index and a value, and it returns the same list with that one slot swapped out.

Why would you want that? A few honest cases. You accumulated a hundred prompts and spot a bad one at index 40 - fix just that entry instead of rerunning the loop. You want to pin frame N's latent to a known image without rebuilding the whole collection. Or you're doing the "collect everything, then refine" pass where some iterations legitimately need different values than the loop produced. Editing one cell beats unrolling and re-collecting every time.

Inputs and output

  • accumulation - the ACCUMULATION bundle to edit.
  • index - INT, default 0, step 1. Zero-based, like everything else in this family.
  • value - the * replacement. Same wildcard freedom as Accumulate: latent, number, string, whatever you stored.
  • Output: ACCUMULATION - a new bundle with the slot replaced.

Under the hood it copies the list, swaps the entry, and wraps it back up - so the input accumulation is left untouched and you can keep a "before" version around by holding two wires. That's a nice property for debugging: compare the original and edited bundles side by side.

The gotchas

Same two as the read-accessor nodes: go out of bounds and it's a hard IndexError that kills the run, so size-check with Accumulation Get Length if your index is computed. And the index is the position in the list as accumulated, which is usually (but not always) the loop iteration number - if your loop appends once per iteration, they're the same thing.

The subtle one: value must match the list's content type in practice. Nothing stops you from writing an INT into a slot holding latents, and nothing will save you from the weirdness downstream when a latent-position silently holds a number. Keep one type per accumulation.

Installing it

Ships in deforum-comfy-nodes, the official Deforum ComfyUI pack. Install through ComfyUI Manager (search "deforum" → comfyui-deforum) and restart, or:

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

Restart ComfyUI after cloning. No extra Python packages, no model files - the pack runs on torch/numpy/Pillow, all already present. If you hit load errors, an orphaned deforum pip package is the known culprit; pip uninstall deforum fixes it.

CategoryDeforum/Lists

Inputs (3)

NameTypeDefaultDescription
accumulationACCUMULATION
indexINT0
value*

Outputs (1)

NameTypeDescription
ACCUMULATIONACCUMULATION