Random Checkpoint Loader with Names
Rotate or Randomize Checkpoints Without Rewiring a Thing
- model
- clip
- vae
- checkpoint_name
- vae_name
You want to run the same prompt through five checkpoints to compare them, or sweep a whole folder of models in one batch. The manual way: swap the checkpoint dropdown, note the name, generate, repeat, and pray you remember which image came from which model. Random Checkpoint Loader with Names automates exactly that - point it at a folder, pick sequential or seed-based random, and it loads the checkpoint and hands you its name as a string so your metadata stays honest.
It's part of ComfyUI-ImageWithMetadata, the small MIT pack by shin131002 built around batch image load/save with metadata. Same install as its sibling node, same zero-dependency story, and the loader internals trace back to WAS Node Suite's proven BatchImageLoader pattern.
How it works
On every run it globs your chosen folder for checkpoint files (.safetensors, .ckpt, .pt), filters by a glob pattern, then loads through ComfyUI's own CheckpointLoaderSimple under the hood. Selection is where the two modes split:
singlemode -index % number_of_checkpoints. Drive an Integer node (withcontrol_before_generate: increment) intoindexand each run steps to the next model, wrapping around at the end of the list.randommode - it seeds Python'srandomwith yourseedand picks one. Same seed, same model, every time. That determinism is the feature: a failed run is rerunnable.
It also keeps a tiny JSON "counter DB" in ComfyUI's temp folder, keyed by label. Its only real job here is detecting when you've changed the path or pattern and resetting stale state - the actual selection comes from index or seed.
The inputs that matter
mode-single(sequential, recommended) orrandom.path- folder of checkpoints. Empty means all checkpoints folders - the README explicitly warns against it.pattern- glob filter:*for everything,anime_*,*.safetensors.sub_folders-false/true, recursive search into subfolders.index- used insinglemode; feed it from an incrementing Integer.seed- model-selection seed inrandommode.label- namespace for this node's state; use a distinct label per folder/batch.vae_name- "Baked VAE" (default) or an external VAE.
Outputs: model, clip, vae plus checkpoint_name and vae_name as strings. Pipe those strings into the pack's Save Image with Metadata and every PNG records which checkpoint actually produced it.
Installing it
Search "ImageWithMetadata" in ComfyUI Manager, or:
cd ComfyUI/custom_nodes/
git clone https://github.com/shin131002/ComfyUI-ImageWithMetadata.git
Restart, done. No requirements.txt, no model downloads. Small personal project, MIT, quiet support policy - stable but don't expect rapid fixes.
Where people get burned
- Empty path is BaseModel roulette. SD1.5, SDXL, and Illustrious checkpoints all live in ComfyUI's checkpoints folder, and loading a model from the wrong family mid-batch errors out or gives garbage. Set
pathto a folder holding one BaseModel family and keep the others out. patternis glob, not regex.anime_*works;anime_.*doesn't.- Same seed = same model. In
randommode the seed picks the checkpoint, and if you also reuse the sampler's seed you can paint yourself into identical output on purpose. Give the loader its own seed when you want variety. indexwraps silently. index 100 with 10 models loops back to model 0 - fine for a batch, confusing when you thought you were on model 10.- "Model not found." Verify the path exists,
sub_foldersmatches your layout, the pattern matches, and the folder is actually registered (external drives usually needextra_model_paths.yaml). A path outside the registered bases degrades to a basename lookupCheckpointLoaderSimplecan't resolve.
Worth it? If you A/B test models or run folder-wide batch generations, yes - it turns a tedious dropdown dance into one Integer node, with model names captured for free. If you only ever run one model, skip it; the plain Checkpoint Loader with Names gives you the same outputs with fewer knobs.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| mode | COMBO | 2 options: single, random | |
| seed | INT | 00–18446744073709550000 | — |
| path | STRING | — | |
| sub_folders | COMBO | 2 options: false, true | |
| pattern | STRING | * | — |
| label | STRING | Batch 001 | — |
| index | INT | 00–150000 | — |
| vae_nameopt | COMBO | 1 options: Baked VAE |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| model | MODEL | — |
| clip | CLIP | — |
| vae | VAE | — |
| checkpoint_name | STRING | — |
| vae_name | STRING | — |