Nodes/Nukun_ComfyUI_Nodes/Checkpoint Pair Cycler Loader (Nukun)
ComfyUI Node

Checkpoint Pair Cycler Loader (Nukun)

The A/B checkpoint matrix, driven by one counter

By OnekoSL·Created 3 months ago·Updated 11 days ago· 1
Checkpoint Pair Cycler Loader (Nukun)
    • MODEL_1
    • CLIP_1
    • MODEL_2
    • CLIP_2
    • VAE
    • modelname_1
    • modelname_2
    • combined_modelname
    • ckpt_name_1
    • ckpt_name_2
    • folder
    • pair_index
    • model_index_1
    • model_index_2
    • total_pairs
    pair_index0
    checkpoint_folder
    vae_namecheckpoint
    model_index_start0
    model_index_end18446744073709550000

    Sometimes one checkpoint isn't the unit you want to batch over - you want pairs. Two different checkpoints fed into the same graph, crossed against each other, every combination tested. That's the "all-with-all" matrix, and doing it by hand in ComfyUI means managing two loaders, two counters, and praying they stay in sync.

    NukunCheckpointPairCyclerLoader turns the whole matrix into a single pair_index. One number steps through every ordered pair of checkpoints in a folder, and the node handles the indexing so you don't have to.

    How the matrix works

    Give it a checkpoint_folder - the dropdown only lists checkpoint subfolders, and each folder is a separate choice - and it builds an ordered matrix of N × N pairs from the checkpoints inside. The indexing is the thing to get your head around: MODEL_2 advances fastest, one step per pair_index increment, while MODEL_1 advances only after a full pass through the folder.

    And the matrix is full: it includes self-pairs and reversed pairs. So with models A, B, C you'll get A×A, A×B, A×C, then B×A, B×B, ... - every ordered combination, which matters if your workflow treats the two model inputs asymmetrically (say, one drives a reference, one drives composition).

    Two extra inputs shape the sweep:

    • model_index_start / model_index_end - restrict the matrix to an inclusive global index range, e.g. 20..49. Handy when you're resuming a long run that died at pair 20, or splitting a giant matrix across multiple queues.
    • vae_name - checkpoint keeps the VAE from MODEL_2 (which is the last model loaded), or pick an external VAE to override the shared output.

    What comes out

    The full bus: MODEL_1/CLIP_1 and MODEL_2/CLIP_2, a shared VAE, and the metadata you need for filenames - modelname_1, modelname_2, and a combined_modelname that joins them as modelname_1__x__modelname_2 (filename-safe, directly usable as a save prefix). pair_index, model_index_1, model_index_2, and total_pairs come out too, and total_pairs is the one that matters for chunking: it tells you the size of the full matrix so you know where your wrap point is.

    The README's tip for long runs: set pair_index to increment-wrap, and wrap it over the reduced total_pairs value when you're using an index range. That way the counter loops cleanly inside your restricted slice.

    Installing it

    Same one-time pack install:

    cd ComfyUI/custom_nodes
    git clone https://github.com/OnekoSL/Nukun_ComfyUI_Nodes.git
    

    Restart ComfyUI or install via ComfyUI Manager ("Nukun").

    The honest caveat

    The all-with-all matrix is a blunt instrument - for 10 checkpoints that's 100 runs, 50 of them A×A self-pairs you may not care about. That's not a defect, it's the design: it guarantees complete coverage. If you only want directed A/B tests without the self-pairs, you're better off with the single CheckpointCyclerLoader and a second fixed loader. But when you genuinely want every combination tested and can let the queue run overnight, this node is the cleanest way to get it - one counter, zero index math on your part.

    CategoryNukun/Loaders

    Inputs (5)

    NameTypeDefaultDescription
    pair_indexINT00–18446744073709550000Single matrix index. The second checkpoint advances fastest; the first advances after one full folder pass.
    checkpoint_folderCOMBOCheckpoint subfolder used to build the ordered all-with-all matrix.
    vae_nameCOMBOcheckpointUse 'checkpoint' to keep the second checkpoint VAE, or select an external VAE to override it.
    model_index_startINT00–18446744073709550000First global model index included in the checkpoint matrix.
    model_index_endINT184467440737095500000–18446744073709550000Last global model index included in the checkpoint matrix. Values past the folder end use the last model.

    Outputs (15)

    NameTypeDescription
    MODEL_1MODEL
    CLIP_1CLIP
    MODEL_2MODEL
    CLIP_2CLIP
    VAEVAE
    modelname_1STRING
    modelname_2STRING
    combined_modelnameSTRING
    ckpt_name_1STRING
    ckpt_name_2STRING
    folderSTRING
    pair_indexINT
    model_index_1INT
    model_index_2INT
    total_pairsINT