Nodes/ComfyUI_agilly1989_motorway/ModelComputeDtype_motorway_edition
ComfyUI Node

ModelComputeDtype_motorway_edition

Force a compute dtype on a model, in the Motorway

By agilly1989·Created 2 years ago·Updated about a year ago· 7
ModelComputeDtype_motorway_edition
  • MOTORWAY 🚌💨
  • MOTORWAY 🚌💨
INPUT_model_keymodel
dtype
OUTPUT_MODEL_keyMODEL

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 (default model) - the key holding your MODEL.
  • dtype - the dropdown above: default, fp32, fp16, bf16. Default is default, which means the node does nothing until you change it, which trips people up more than it should.
  • OUTPUT_MODEL_key (default MODEL) - 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 dtype on default and 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_edition nodes may be missing from the menu. Present in the 1.1.0–1.1.6 builds comfy.icu indexed.
Categoryagilly1989 Nodes/Motorway-ed/advanced/debug/model

Inputs (4)

NameTypeDefaultDescription
MOTORWAY 🚌💨MOTORWAY 🚌💨
INPUT_model_keySTRINGmodel
dtypeCOMBO4 options: default, fp32, fp16, bf16
OUTPUT_MODEL_keySTRINGMODEL

Outputs (1)

NameTypeDescription
MOTORWAY 🚌💨MOTORWAY 🚌💨