GU Get Model Filename
Stop typing the checkpoint name — read it off the loader
- model
- filename
GU Get Model Filename is the sibling of GU Get Media Input Name, aimed at one specific object: the checkpoint. You loaded a model, and now you want its filename as a string - to bake into a save filename, an info file, or an image caption - without typing it and without it drifting out of sync when you swap checkpoints. Connect this node to the loader's MODEL output and it returns the checkpoint's name.
It reads like a tiny node, and it is. But like its media sibling, the interesting part is how it knows which file you mean.
What it does
- model - a
MODELinput. Wire it to any loader's model output: Checkpoint Loader, UNET Loader, Diffusers Loader, whatever. The node doesn't care about the loader type. - Output: filename, a STRING - the checkpoint name with the extension stripped.
dreamshaper_8.safetensorscomes out asdreamshaper_8.
There's no strip_ext toggle here - it always strips the extension. That's deliberate: model names in filenames almost always want to be clean.
How it knows the name
The node works backward through the graph using the workflow metadata, exactly like its media cousin. It traces the wire upstream from the MODEL socket (skipping reroutes), finds the actual loader node, and reads the checkpoint filename from its widget. It then checks that the value really is a model file - extensions .safetensors, .sft, .ckpt, .bin qualify - so a stray string won't masquerade as a model name. If it can't find or validate one, you get !unknown!.
Like several GU "getter" nodes, it always executes when the Queue runs - the IS_CHANGED-returns-NaN trick that keeps it out of ComfyUI's execution cache so it can't serve you a stale name from a previous run. That's the right call for a node whose whole job is "what's loaded right now," just be aware it's uncached by design (the KB's plumbing essay covers the NaN idiom in detail).
Why you'd bother
The payoff is automation and honesty. Feed the output into GU Image Label's model_name input and every caption automatically says which checkpoint produced the image. Feed it into a GU Project Path or filename builder and your saved files self-document. And because it reads the actual loader, changing the model in one place updates every label and filename that depends on it - no more hunting through text widgets to update a hardcoded name you typed three weeks ago.
Install
ComfyUI Manager → Custom Nodes Manager → search "GU Nodepack" → Install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/alexguryev/ComfyUI-GU_Nodepack
cd ComfyUI-GU_Nodepack
pip install -r requirements.txt
No model downloads - the pack only reads what's already in your models folder. Dependencies are psutil, requests, and gu-funclib>=1.9.0. Windows is the tested platform; the pack is built for a single-user ComfyUI instance.
Gotchas
The trace-back approach means it needs a clean, traceable upstream - put a reroute in the path and it handles it, but chain it through opaque passthrough nodes and it may come back !unknown!. And if you're using several of the GU "getter" nodes in one graph, the README's ordering caveat applies: keep them in separate branches rather than stacking them, since they all read from graph metadata.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| modelopt | MODEL | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| filename | STRING | — |