Nodes/Basic data handling/create SET from STRINGs
ComfyUI Node

create SET from STRINGs

The string-set node you'll actually reach for

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

    create SET from STRINGs is the one from this family you'll actually reach for in a real workflow, because strings are what tags are made of. Feed it a list of prompt tags or style keywords and it hands you back a Python set - unique members only. Duplicate "cinematic" in three different places and the set says "yeah, we heard you the first time."

    The practical use case: you're building workflows that compare or filter tag lists - checking whether a prompt contains a banned token, merging tag sets from two sources without double-counting, or keeping a canonical list of style keywords. Feed the set into contains for membership tests, union or intersection to combine or align tag pools, and convert to Data List when you want to push each tag through something individually.

    How it works

    The inputs are dynamic - item_0 in the schema, then item_1, item_2, … that you add from the node's input menu. Every string gets cast with str() and added to the set. Two behaviors matter:

    • Deduplication is automatic. "photorealistic", "photorealistic", "cinematic"{"photorealistic", "cinematic"}.
    • Order is arbitrary. Sets are unordered collections, so don't expect the tags to come out in the order you typed them. If you need a specific order later, you'll have to sort after converting to a list.

    One caveat that trips people: dedup is exact. "Photorealistic" and "photorealistic" are different elements. If your tags arrive inconsistently cased, normalize them first - this pack has a casefold node in its STRING category for exactly that job.

    Inputs and output

    • item_0 (STRING) - the first string; add item_1, item_2, … for more. All optional.
    • SET (output) - a single Python set of strings, ready to wire into the pack's other SET nodes.

    Installing

    It ships in Basic data handling by StableLlama. ComfyUI Manager is the easy path: search "Basic data handling", install, restart ComfyUI. Manual route:

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

    Restart and you're done. The pack lists no runtime dependencies and downloads no models, which is a rare luxury in this ecosystem - nothing here is going to conflict with your sampler pack.

    Common issues

    The usual complaint is "why is my set the wrong size?" - usually because a string you thought was unique was actually identical to another one (case or trailing whitespace), and the set correctly collapsed them. Check for hidden whitespace with the pack's strip node. And if you expect order out the other end, you're misusing a set - that's a LIST's job.

    CategoryBasic/SET

    Inputs (1)

    NameTypeDefaultDescription
    item_0optSTRING

    Outputs (1)

    NameTypeDescription
    SETSET