Unet Bnb Model Loader
The UNet loader that finally makes BitsAndBytes NF4 usable
- MODEL
You want to run a 12B+ model like Flux, HiDream-I1, or Qwen-Image on a card that can't hold the fp16 weights, but you don't want to deal with GGUF. That's the exact gap this node exists to fill. ComfyUI's official ComfyUI_bitsandbytes_NF4 plugin has been basically abandoned, and the forks floating around had two recurring problems: they refused to load most of the quantized models people actually publish on HuggingFace, and they broke LoRAs. UnetBnbModelLoader is a from-scratch replacement that claims to fix both - and as of writing, it's the most credible NF4 loader in the ecosystem.
What it actually does
BitsAndBytes 4-bit quantization (NF4 and FP4) is a prequantized format: the weights are already packed down to 4-bit when the model file is created, so you don't need 12GB of VRAM to load the thing. This node is just a loader, but it's an unusually smart one. It's architecturally agnostic - it works on any model ComfyUI can load as a diffusion model, which is why the README's supported list spans Flux dev/schnell, HiDream-I1, and the Qwen-Image family all at once.
Mechanically, here's what happens when you pick a model:
- It scans the state dict for the telltale
.quant_state.bitsandbytes__nf4orbitsandbytes__fp4keys. Found them? It's a 4-bit model. - If yes, it loads it through its own
LazyOpsclass, which usesParams4bit.from_prequantizedandbnb.matmul_4bitso inference actually runs at 4-bit instead of silently dequantizing everything. - If no, it falls back to ComfyUI's normal UNet loader. A plain fp16 model in the same folder just works.
The interesting bit is the LoRA handling. Quantized weights and LoRA don't mix directly, so the node ships a custom ModelPatcher that keeps bnb LoRA patches in a separate registry. When a LoRA targets a quantized layer, it dequantizes that layer on the fly, applies the patch in fp32, and rounds back down with stochastic rounding. You pay the dequantization tax only where a LoRA actually touches - everywhere else you keep the speed. That's why the author calls it the first genuinely usable bnb LoRA support, and it's a genuinely neat piece of work.
The one input and the one output
The whole node is two fields:
- model_name - an enum populated from your
unetanddiffuser-modelsfolders. Multi-shard models show up as the directory, not individual files, and the node auto-assembles shards in the classic-00001-of-0000N.safetensorsnaming. That shard handling alone beats ComfyUI's stock loader, which just chokes. - MODEL - the output, wired straight into the
modelinput of a KSampler/KSamplerAdvanced.
Installing it
Via ComfyUI Manager, search "Unet Bnb Model Loader" and hit install. Or the manual way:
cd ComfyUI/custom_nodes
git clone https://github.com/mengqin/ComfyUI-UnetBnbModelLoader
pip install --upgrade bitsandbytes
That bitsandbytes>=0.45.3 dependency is the whole show - it's the only requirement. Two caveats from the README: you need a recent-enough ComfyUI to support custom ops when loading a UNET-only, and bitsandbytes doesn't run on macOS, so this is a Windows/Linux NVIDIA thing (there's a merge in the git history fixing quant-state issues on AMD, so ROCm users may be okay, but don't count on it).
Where people get burned
- The model isn't in the dropdown. It goes in
unetordiffuser-models, and every shard has to sit in the same directory with the proper shard naming. If HF published it as a folder, drop the whole folder in. - "mmdit conversion failed" - you grabbed one of the models on the README's unsupported list. Some quantizations were made directly on the original checkpoint instead of converting to a diffusers model first, and ComfyUI can't recognize the bnb quantized vector format in that case. The README names
gradjitta/flux.1-schnell-nf4andsayakpaul/sd35-large-nf4specifically. Stick to the supported list. - Expecting GGUF-style file sizes. NF4 packs are smaller than fp16 but not as aggressively shrunken as GGUF Q4, and quality-wise NF4 is generally considered the lowest of the common quantization tiers. The trade for the smaller footprint is a bit more speed than GGUF at comparable VRAM - that's the whole pitch.
If you just want the thing to work and don't care about format purity, city96's GGUF pack is still the community default for a reason. But if you have bnb models already downloaded, or you need working LoRA on a 4-bit Flux, this is the loader to reach for.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| model_name | COMBO | 0 options: |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |