Mpi Upscale Model Scale
Stop trusting filenames for the upscale factor
- upscale_model
- scale_int
- scale_float
Every upscale workflow needs to know one number that almost nobody computes properly: what factor is this model, actually? Most people read it off the filename - 4x-UltraSharp is 4x, obviously - and hardcode it into a node. That works until a filename lies, or a model is repackaged under a different name, or you're building an automated pipeline that has to handle whatever model happens to be loaded. Mpi Upscale Model Scale solves it by asking the model itself instead of parsing a string.
It's a two-socket utility from the ComfyUi-MpiNodes pack. You feed it the output of a Load Upscale Model node (any UPSCALE_MODEL input) and it reads the native scale - 1x, 2x, 4x, 8x - from the model's descriptor metadata. Under the hood it's a one-liner philosophy: the loaded object carries a .scale attribute (it's a spandrel ImageModelDescriptor), and this node reads that instead of trusting the name. If the metadata is absent, it falls back to a fallback_scale widget you set, and if the result is ever non-positive it raises rather than letting a division-by-zero lurk downstream. That last bit is the design telling you: a wrong scale is worse than an error.
The inputs and outputs that matter:
upscale_model(UPSCALE_MODEL) - wire in whatever Load Upscale Model gives you.fallback_scale(INT, default 1) - the author's tooltip says it plainly: "Used only if the model exposes no .scale metadata." Set it to the factor you know the model is when a model lacks metadata.- Outputs:
scale_int(INT) andscale_float(FLOAT), the same number twice. Wire the FLOAT into any math that treats the factor as a multiplier; wire the INT into dimension math that wants whole factors.
Where this earns its keep is automation and the more-pixels side of upscaling (the KB's upscaling.md distinguishes "more pixels" from "more detail" - this node is firmly about the former, the ESRGAN-family rung). If you're building a repeatable workflow that scales an image to a target size, chaining scale_float into a multiply is how you compute source_width * scale without ever hardcoding a factor. Change the upscale model and the math follows automatically. That's also exactly why the file sits in the same pack as Mpi Grid Dimensions and the other tile-math utilities - it's plumbing for tiled and automated upscale pipelines.
Install - it ships in ComfyUi-MpiNodes. ComfyUI Manager → search "ComfyUi-MpiNodes" → Install, then restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/MadPonyInteractive/ComfyUi-MpiNodes
No extra dependencies, no models to download - the upscale model itself is the only thing it needs, and you're already loading that.
The failure modes are all about the fallback. If you see the wrong factor coming out of a model, it almost certainly has no .scale metadata and your fallback_scale is wrong - check the model's actual native factor and set it. And keep fallback_scale at 1 or above; a zero will make the node raise on purpose, so a sudden error is the node catching a bad config for you, not a crash to chase.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| upscale_model | UPSCALE_MODEL | — | |
| fallback_scale | INT | 11–64 | Used only if the model exposes no .scale metadata |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| scale_int | INT | — |
| scale_float | FLOAT | — |