get step by unet model name
Let your model filenames decide the step count
- model
- model
- steps
Everyone who switch-checks checkpoints knows the pain: this model wants 25 steps, that one wants 40, and your KSampler just sits there with whatever number you last typed. GetModelStep (display name "get step by unet model name") is a tiny node from SimpleToolsNodes that reads the loaded model's filename and feeds your sampler the step count baked into it. No manual tuning per checkpoint - you set the convention once and the name does the remembering.
How it works
Here's the thing: it never touches the model weights. GetModelStep is an output node, so ComfyUI hands it a copy of the whole workflow (via the hidden extra_pnginfo), and it does a bit of graph surgery: it traces its model input back to the loader that feeds it, reads that loader's unet_name widget, and regex-scans the filename for a number immediately followed by "step"/"steps" (or the Chinese 步). Found one, that's your step count. Not found, it falls back to the step value you set. Then it emits the filename and the number.
The inputs that matter
Only two, and one is a decoy:
model(MODEL) - the node doesn't consume the tensor at all. It's there to force a connection so the node has something to trace back to the loader. Wire it straight from a UNetLoader.step(INT, default 20, range 1–99) - the fallback used when the filename carries no step marker.
Outputs
name(STRING) - the model filename it detected.steps(INT) - the extracted step count, or your fallback.
Wire steps into your KSampler's steps input and you're done.
The catch: filename convention
The regex is (\d+)(steps?|步) - digits before the word. So realvisxl_25steps.safetensors or juggernaut_30步.safetensors gets picked up, but the very common _step20 suffix is not, because there the digits come after "step". If auto-detection isn't firing, rename the file or just lean on the fallback. Same reason it only works wired directly from a UNetLoader - feed it from a LoRA stack or merged loader and you'll hit the node's NameError: Widget not found: ...unet_name. The README is upfront that only UnetLoader is tested.
Install
ComfyUI Manager (search "SimpleToolsNodes"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/Mcmillian/ComfyUI-SimpleToolsNodes.git
The README's path is install.bat on Windows, then restart. This node itself imports only re, so it needs nothing heavy - the zhipuai/json_repair in requirements.txt belong to the pack's other node, GlmPromptNode. One real quirk: install.bat is Windows-only, and its Aki-install branch references a repair_dependency_list.txt that isn't in the repo, so that branch can error - the portable and system-python branches are fine.
Honest take: it's a niche utility, but a genuinely nice one if you're a checkpoint collector. If you live on one model forever, skip it. If you rotate downloads weekly and keep forgetting what each wants, two nodes kill a whole class of "oh right, steps" mistakes.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| step | INT | 201–99 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| model | STRING | — |
| steps | INT | — |