ComfyUI Node

create SET

Build a SET from scratch — the dedup engine for your workflow

By StableLlama·Created about a year ago·Updated 4 days ago· 48
create SET
  • item_0
  • SET

Most ComfyUI collections are lists, and lists keep duplicates. Sets don't - that's the entire point of the type, and create SET is the front door to using it. You drop in a handful of items and it hands back a SET with duplicates collapsed: cat, dog, cat, bird becomes {cat, dog, bird}. If your workflow has ever produced a list of tags, seeds, or filenames with accidental repeats, this is the two-second fix.

It's also the seed of everything else in the pack's SET family. Create the SET here, grow it with add, ask it questions with contains, all, and any, and combine with the union/intersection/difference nodes. The node's inputs are dynamic - you start with one item_0 slot and add more by connecting or toggling, so the count grows to fit your data rather than being fixed at build time.

How it works

set(values) over whatever items you supplied. The semantics that matter:

  • Duplicates collapse - {"a", "a", "b"} is {"a", "b"}. That's the feature.
  • Order is not preserved. Sets are unordered, so don't expect item_0 to come back first; if position matters, use a LIST instead.
  • The items must be hashable. Strings, ints, floats, booleans - fine. A raw list or dict as an item will raise. Feed it scalars.
  • This generic variant takes * items, so mixed types are allowed - which also means 1 and True count as the same member. The pack's typed variants (create SET from STRINGs, from INTs, from BOOLEANs) exist exactly to prevent that class of mixup.

Inputs and output

item_0 (and dynamically more) - any type, all optional. One output, the SET.

Installing it

Ships in Basic data handling by StableLlama:

cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling

Restart, or install via ComfyUI Manager (search "Basic data handling"). The pack declares zero dependencies and downloads no models - pure stdlib, which is why it's a safe "just install it" pick among utility packs.

Gotchas

  • Order loss is the thing people hit first. If "first in, first out" matters, you want a LIST, not a SET - the pack has both for a reason.
  • The 1 vs True collision (and 0 vs False) is real and silent. Mixed-type generic SETs are where it bites; the typed create nodes keep you honest.
  • Unhashable items (a LIST or DICT as an item) fail at runtime. Convert them to something hashable first.
CategoryBasic/SET

Inputs (1)

NameTypeDefaultDescription
item_0opt*

Outputs (1)

NameTypeDescription
SETSET