ModelComputeDtype_motorway_edition
Force a compute dtype on a model, in the Motorway
- MOTORWAY 🚌💨
- MOTORWAY 🚌💨
Sometimes a model refuses to run, or runs but eats VRAM like it's free, and the fix is to tell ComfyUI which precision to compute in. That's ModelComputeDtype, a stock debug/model node that exists for exactly this - and this is its Motorway-ed clone, so the model comes in by key and the patched model goes back out by key.
What "compute dtype" means
There's a difference between the dtype your weights are stored in and the dtype your GPU computes in, and this node only touches the second one. It takes a clone of the model and sets model.compute_dtype, so the forward pass happens in the precision you pick:
default- leave whatever the model/ComfyUI decided alone.fp32- full precision. The safest, the slowest, the VRAM-hungriest. Pull it out when a half-precision run is producing NaNs or you're chasing a precision bug.fp16- half precision, classic speed/VRAM win, but the risky one: fp16's narrow range can overflow in some architectures and you'll see infinities or black outputs.bf16- the modern default for most backends. Half the bits of fp32 with the same exponent range, so it's the sweet spot for video and transformer-ish models. If you're forcing anything for VRAM, this is usually the right force.
It's a debug node by category - you typically add it temporarily, watch a problem disappear (or not), and decide whether to keep it. It patches a clone of the model, so your original in the Motorway is untouched.
The inputs
INPUT_model_key(defaultmodel) - the key holding yourMODEL.dtype- the dropdown above:default,fp32,fp16,bf16. Default isdefault, which means the node does nothing until you change it, which trips people up more than it should.OUTPUT_MODEL_key(defaultMODEL) - where the patched clone lands. Point your sampler's model input at this key.
Widgets stay widgets, model input becomes a key string, output becomes a keyed write - the standard Motorway-ed treatment, with runtime behavior identical to the built-in node.
Install
One install for the whole pack. ComfyUI Manager, search "ComfyUI_agilly1989_motorway", or:
cd ComfyUI/custom_nodes
git clone https://github.com/agilly1989/ComfyUI_agilly1989_motorway
Restart ComfyUI. No requirements.txt, no model downloads.
Troubleshooting
- The classic trap: leave
dtypeondefaultand nothing changes, then you wonder why you added the node. It's a pass-through until you pick a precision. - If forcing fp16 gives you NaNs/black output, switch to bf16 before you give up on half precision entirely - fp16's limited exponent range is a known footgun, bf16 has fp32's range.
'MotorwayClass' object has no attribute 'hash_'= the model key doesn't exist yet; check that the loader ran and the key spelling matches (case-sensitive).- Pack caveats: BETA, and the newest published version (1.1.7) disabled clone generation, so on a fresh install these
_motorway_editionnodes may be missing from the menu. Present in the 1.1.0–1.1.6 builds comfy.icu indexed.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| MOTORWAY 🚌💨 | MOTORWAY 🚌💨 | — | |
| INPUT_model_key | STRING | model | — |
| dtype | COMBO | 4 options: default, fp32, fp16, bf16 | |
| OUTPUT_MODEL_key | STRING | MODEL | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MOTORWAY 🚌💨 | MOTORWAY 🚌💨 | — |