ComfyUI Node

to SET

Dedupe anything in one step — order be damned

By StableLlama·Created about a year ago·Updated about 15 hours ago· 48
to SET
  • input
  • SET

Sometimes you don't care about order, duplicates, or anything except "is this value in here or not?" That's what a SET is for, and to SET is how you get one out of whatever ComfyUI hands you. The single most useful thing it does: dedupe a list in one step.

It's part of Basic data handling, StableLlama's zero-dependency utility pack. Like its sibling to LIST, it's a cast node - pure conversion, no knobs.

How it works

Three rules, straight from the source:

  • Already a set? Passed through untouched.
  • A list (including a data list)? Converted with set(input) - which removes duplicates and discards order.
  • Anything else? Wrapped into a one-element set.

The important consequence of using a set: there are no duplicates and no meaningful order. If your input was [3, 1, 3, 2], the output is {1, 2, 3} (order not guaranteed). If you need to preserve duplicates or ordering, reach for to LIST instead - a set is only the right tool when uniqueness and fast membership checks are what you actually want.

The input and output

  • input (*) - a list, a data list, a scalar, anything.
  • SET (output) - the deduped Python set.

Why sets exist in this pack at all

ComfyUI itself has no SET type, so this pack defines one as a custom data type - a set travels as a single opaque value, and the SET family of nodes (add, remove, contains, union, intersection, subset checks…) operates on it. The typical flow: cast a messy list to SET to clean it up, run a couple of set operations, then convert back to a data list with convert to data list when you need individual items to flow again.

Installing it

ComfyUI Manager → search "Basic data handling", or:

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

Restart. No dependencies, no models.

Common issues

  • "My order got scrambled." Sets don't have order. If position matters, this is the wrong node - that's not a bug, it's the definition of a set.
  • "My duplicates vanished and I wanted them." Same answer. Use a LIST when duplicates matter.
  • "The connection is an unusual color." SET is a custom type, so it only plugs into nodes that understand it - mostly this pack's SET family and its own cast nodes.
CategoryBasic/cast

Inputs (1)

NameTypeDefaultDescription
input*

Outputs (1)

NameTypeDescription
SETSET