ComfyUI Node

AF - Model Switch

A/B test checkpoints without rewiring a single connection

By alFrame·Created 11 months ago·Updated 9 months ago· 4
AF - Model Switch
  • model_1
  • clip_1
  • vae_1
  • model_2
  • clip_2
  • vae_2
  • model
  • clip
  • vae
number_of_rails2
selected_rail0
status💡 Active Rail: auto

AF - Model Switch is the "which model do I actually want" node. Instead of building three identical branches or dragging new connections every time you want to compare checkpoints, you wire up to ten checkpoint loaders into one switch node and pick which one is live with a number. It outputs the model, clip, and vae of the selected loader, so everything downstream - KSampler, CLIP encode, VAE decode - stays wired once, and you flip between models like you're changing a setting. If you've ever spent a whole evening A/B testing checkpoints by hand, this is the node that turns that into a knob.

How it works

Think of it as rails. Each rail is a trio of inputs - model_N, clip_N, vae_N - that you feed from a checkpoint loader (or an AIO loader). The node routes whichever rail is selected out to its three outputs. Two things make it nicer than the obvious "just use a switch":

1-based indexing, and 0 = AUTO. selected_rail set to a number 1-10 forces that rail. Set it to 0 and the node walks the rails and picks the first one with actual data - which means it skips rails whose loaders are bypassed or muted, since those contribute nothing. No data anywhere? It falls back to rail 1 and tells you.

Rails 1-2 are permanent. You can grow and shrink the visible rail count with number_of_rails (2 to 10) without ever losing the connections on rails 1 and 2 - handy when you're testing a draft model on rail 3 and want to remove it later without touching the A/B pair that matters. Rails 3-10 are added and removed on the fly by the node's front-end code.

The status field is a read-only readout that updates live: orange-ish "auto → N", a targeted "rail N" when you pick manually, or a warning when nothing's connected. You don't need to run the workflow to see which rail is active.

The inputs and outputs that matter

  • number_of_rails - how many rails are visible. Default 2, up to 10.
  • selected_rail - the one you'll actually fiddle with. 0 = AUTO (first connected rail), 1-10 = manual.
  • status - read-only display. Not something you set.
  • model_1/clip_1/vae_1, model_2/clip_2/vae_2, and up to rails 10 - the loader outputs you're switching between.

Three outputs: model, clip, vae. Wire them exactly where your checkpoint loader's outputs would have gone.

Where people get burned

Two things. First, the AUTO mode only considers rails within the current number_of_rails - a model connected on rail 7 does nothing while number_of_rails is 2. Second, and more important: this node routes data, it doesn't manage VRAM. A model whose loader feeds an unused rail can still sit in memory, because ComfyUI loaded it to produce that input. The README's own tip is to pair the switch with something like rgthree's Group Bypasser and bypass the unused loader groups - that's what actually frees the memory. The switch picks which model runs; the bypasser decides which models are even loaded. Use both, or the "save memory by switching models" promise quietly evaporates.

Install

Part of the AF - Pack Prompt Nodes pack: no dependencies, no model downloads. ComfyUI Manager, search "AF - Pack Prompt Nodes", install, restart - or:

cd ComfyUI/custom_nodes/
git clone https://github.com/alFrame/ComfyUI-AF-Pack-Prompt-Nodes.git

It lives under AF - Nodes → AF - Prompt Pack. Start with two rails and AUTO, get comfortable, then grow to three when the "quality vs. speed" experiment calls for it.

CategoryAF - Nodes/AF - Prompt Pack

Inputs (9)

NameTypeDefaultDescription
number_of_railsINT22–10Number of visible rails (2-10)
selected_railINT00–10Active rail: 0=AUTO (first connected), 1-10=manual selection
statusSTRING💡 Active Rail: auto
model_1optMODEL
clip_1optCLIP
vae_1optVAE
model_2optMODEL
clip_2optCLIP
vae_2optVAE

Outputs (3)

NameTypeDescription
modelMODEL
clipCLIP
vaeVAE