Nodes/deforum-comfy-nodes/Accumulate | Deforum
ComfyUI Node

Accumulate | Deforum

Collect anything, one loop iteration at a time

By deforum·Created about a year ago·Updated 3 months ago· 29
Accumulate | Deforum
  • to_add
  • accumulation
  • ACCUMULATION

If you've ever tried to grab a value from every frame of an animation, you know the annoyance: ComfyUI's core has no "append to a list inside a loop" node, and hand-typing each frame's seed or latent doesn't work when the values only exist while the loop is running. Accumulate is the Deforum pack's answer - a growable list you feed from inside a For Loop Open / Close pair, and read back out after the loop ends.

It lives in the Deforum/Lists category and works on this pack's own ACCUMULATION type. That's worth knowing before you reach for it: ACCUMULATION isn't a ComfyUI core type like IMAGE or LATENT. It's a Python dict wrapping a list ({"accum": [...]}), and it only means something to the other Deforum accumulation nodes. No other pack's list node will accept it on the wire.

How it works

The mechanism is exactly two lines of logic. You give it to_add (the * wildcard type, so it accepts a latent, a number, a string, an image batch - anything), plus an optional accumulation input:

  • Wire nothing into accumulation and it starts a fresh list containing just to_add.
  • Wire an existing ACCUMULATION into it (which is the standard loop pattern) and it returns that list with to_add appended.

That single ACCUMULATION output is what you feed back into itself on the next loop iteration, so every pass adds one more item. It's a trivial node and it's meant to be.

The inputs that matter

  • to_add - the value you're collecting. One per iteration.
  • accumulation (optional) - the running list. Feed the output back in here to accumulate across a loop.

Output: ACCUMULATION, the updated list bundle.

Why you'd actually reach for it

In a Deforum animation workflow you usually want all the things a loop produced - every frame's latent, or every seed, or every prompt - to do something with after the fact, like batch-upscale or stitch frames in the order they were made. The canonical pattern is: For Loop Open → generate → AccumulateFor Loop Close, then Accumulation to List to hand the collected items to anything that takes a real list.

The trap

Because values pile up, an accumulation over a long animation holds everything in RAM - 1000 latents will happily eat multiple gigabytes. If you only need a couple of frames, don't hoard the whole video: use Accumulation Get Item to pluck one out, or Accumulation Head/Tail if you're consuming as you go. And remember this is a Deforum-specific type: to hand the result to a non-Deforum node, convert with Accumulation to List first.

Installing it

The node ships inside the deforum-comfy-nodes pack, so you're getting the whole Deforum toolkit whether you want it or not. Easiest via ComfyUI Manager: search for "deforum" (the pack shows up as comfyui-deforum), install, restart.

Manual path:

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

Then restart ComfyUI. No pip install and no model download for this node - the pack is plain Python on top of torch, numpy and Pillow, all of which ComfyUI already ships. The one install gotcha people actually hit: an old orphaned deforum pip package in your Python environment can shadow this pack and throw errors at load. pip uninstall deforum and restart clears it.

CategoryDeforum/Lists

Inputs (2)

NameTypeDefaultDescription
to_add*
accumulationoptACCUMULATION

Outputs (1)

NameTypeDescription
ACCUMULATIONACCUMULATION