Nodes/Basic data handling/create DICT from INTs
ComfyUI Node

create DICT from INTs

Integer values, locked in — build a dict that won't turn your counts into floats

By StableLlama·Created about a year ago·Updated 4 days ago· 48
create DICT from INTs
    • DICT
    key_0
    value_0

    "create DICT from INTs" is the typed builder for the values that have to stay whole numbers: step counts, batch sizes, seeds, frame numbers. It does one job - every value in the dict gets passed through Python's int() - and it does that job reliably, which is more than you can say for letting any-type coercion decide for you.

    Why a whole node for this? Because ComfyUI treats INT and FLOAT ports as interchangeable, and once a number goes through certain operations it quietly becomes a float. 8 and 8.0 look the same on screen and behave differently in code: if a downstream node indexes into a list with cfg["frames"], a float will crash or truncate in ways an int won't. This node pins the type at creation so the rest of your graph doesn't have to guess.

    How it works

    Identical skeleton to its siblings: key_0 (STRING) + value_0 (INT) to start, more key_N/value_N pairs added through the dynamic-input system as needed. Each connected pair becomes a key → int(value) entry; disconnected pairs are skipped silently. The docstring is again the generic "creates a new empty dictionary" leftover - the source shows the actual int() cast, so judge the node by what it does, not what its description claims.

    Inputs and outputs

    • key_0 (STRING) - the entry name.
    • value_0 (INT) - the integer value.
    • Output: DICT - a dict whose values are all int.

    When you'd reach for it

    Any settings dict where the fields are counts rather than measures. A sampler config dict with steps, batch, seed, and width/height is the textbook case - all integers, all things you'd rather not have drift into float territory. It's also the right pick when the dict will be handed to code (a script, an API payload, another node) that's strict about types.

    Worth a moment's honesty: the pack also has create DICT from FLOATs, and the two are easy to confuse. If a value could legitimately be a decimal (denoise 0.6), use the float variant; if it's a count that must stay whole, use this one. Mixing both in one graph is normal - they're the same node with a different int()/float() cast.

    Install

    Comes with Basic data handling - no dependencies, no models, pure Python. Install via ComfyUI Manager (search "Basic data handling") or:

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

    then restart ComfyUI. If you only need one or two ints bundled, the generic create DICT is simpler; reach for this when the dict is mostly numbers and correctness beats convenience.

    CategoryBasic/DICT

    Inputs (2)

    NameTypeDefaultDescription
    key_0optSTRING
    value_0optINT

    Outputs (1)

    NameTypeDescription
    DICTDICT