Nodes/ComfyUI Checkpoint Rotation Node/Checkpoint Rotation Loader (Advanced)
ComfyUI Node

Checkpoint Rotation Loader (Advanced)

The full-fat rotation loader, when you want modes and filters

By trunksn1·Created 10 months ago·Updated 3 months ago· 1
Checkpoint Rotation Loader (Advanced)
    • model
    • clip
    • vae
    • checkpoint_name
    • info
    subfolder
    change_interval1
    batch_index0
    rotation_modesequential
    seed0
    checkpoint_filter

    The one that does everything

    CheckpointRotation (shown in ComfyUI as Checkpoint Rotation Loader (Advanced)) is the kitchen-sink loader of this pack. Instead of hiding the rotation logic behind a counter you don't control, it hands you an explicit batch_index input and lets you pick how the next checkpoint is chosen: sequential, random, or shuffled. You tell it which subfolder to look in, optionally filter by name, and it returns the model, clip, and VAE like any checkpoint loader - plus the name of the checkpoint it actually loaded.

    Why would you reach for it over the simpler nodes? When you want a reproducible random sequence with a seed, or when you've got so many checkpoints you need a name filter to keep things sane. The other rotation nodes in this pack are deliberately dumber; this is the one you graduate to.

    How it works

    The core arithmetic is one line, and the author documents it in the README:

    rotation_index = (batch_index // change_interval) % num_checkpoints
    

    Take batch_index = 7, change_interval = 4, and 5 checkpoints: 7 // 4 = 1, so it uses checkpoint index 1. Images 0–3 use checkpoint 0, 4–7 use checkpoint 1, and so on, wrapping around when it runs past the end of the list.

    The three modes differ in how the list is walked:

    • sequential - alphabetically sorted file order, cycling forever.
    • random - for each interval slot it seeds a fresh random.Random(seed + rotation_index) and picks one checkpoint. Deterministic given a seed, but note it can pick the same checkpoint two intervals in a row; it's a per-slot pick, not a draw-without-replacement.
    • shuffle - shuffles the list once with random.Random(seed), then walks it in order. Every checkpoint appears exactly once per cycle, in a seed-controlled order. This is the "fair" version of random and the one I'd actually use.

    It also caches the checkpoint list per subfolder, so it's not re-scanning your disk every execution, and it only looks at .safetensors, .ckpt, .pt, and .pth files. One nice touch: the checkpoint_name output is a relative path with forward slashes (like sdxl/anime/model.safetensors), which is exactly the format ComfyUI's own loader expects and what the pack's Save Image (with Checkpoint Info) writes into PNG metadata.

    The inputs that matter

    • subfolder - relative to models/checkpoints/. Empty string means the root folder; "sdxl/anime" restricts to that subfolder.
    • change_interval - images per checkpoint. Default 1 means change every image.
    • batch_index - the driver. The tooltip says it plainly: "use BatchIndexCounter node." This is what makes the node re-execute, because IS_CHANGED returns the batch_index - if you wire a static value, nothing ever rotates.
    • rotation_mode and seed - mode as above; seed only matters for random/shuffle.
    • checkpoint_filter (optional) - case-insensitive substring match on filename, e.g. "turbo".

    Outputs: model / clip / vae wire into your sampler and text encoders, checkpoint_name into a saver or Checkpoint to Filename, and info is a read-only string with the current checkpoint, index, and batch - handy for a Text node or debugging.

    Gotchas

    The big one is the batch trap that hits this whole pack: this loader runs once per graph execution. A KSampler with batch_size: 1 inside a loop gives you true per-image rotation; a single queue with batch_size: 20 gives you one checkpoint for all 20. If it returns "No checkpoints found in: ..." the node outputs a None model and everything downstream errors - check the console, your subfolder path, and the filter.

    Install

    cd ComfyUI/custom_nodes/
    git clone https://github.com/trunksn1/comfyui-change-checkpoint-randomly
    

    Restart, confirm the Checkpoint Rotation Node loaded successfully! line. No pip dependencies, no models to download - you just need at least two checkpoints in models/checkpoints/ or a subfolder for rotation to be meaningful. It'll be under Add Node → loaders → Checkpoint Rotation Loader (Advanced).

    Categoryloaders

    Inputs (6)

    NameTypeDefaultDescription
    subfolderSTRING
    change_intervalINT11–10000Number of images to generate before switching checkpoint
    batch_indexINT00–1000000Current batch index (use BatchIndexCounter node)
    rotation_modeCOMBOsequentialHow to select next checkpoint
    seedINT00–18446744073709550000Seed for random/shuffle modes
    checkpoint_filteroptSTRING

    Outputs (5)

    NameTypeDescription
    modelMODEL
    clipCLIP
    vaeVAE
    checkpoint_nameSTRING
    infoSTRING