MinusZone - Flux1UnetLoader_cpuDynOffload
The Flux UNet loader that trades speed for a tiny VRAM footprint
- MODEL
If you're running Flux with a separate UNet file - the flux1-dev.safetensors style setup where the text encoders come from a different checkpoint or loader - this node is your drop-in UNETLoader replacement with a superpower: it loads the model and pages its transformer blocks between CPU and GPU on the fly. Full precision and a small footprint, at the cost of speed. It's the most practical of the MinusZone loaders because it's the one that combines with fp8, which is the community's default way to run Flux on 12GB-class cards.
What it is
Like the other loaders in this pack, it wraps a ComfyUI built-in - here UNETLoader - and then applies the same core patch as MZ_Flux1PartialLoad_Patch. Flux's transformer is 19 double blocks plus 38 single blocks; the patch keeps them on CPU and moves them to CUDA in chunks right before they execute, evicting the previous chunk back to CPU. The result is a MODEL whose peak VRAM is a fraction of what the whole 12B transformer would need.
What makes this version interesting is the weight_dtype dropdown, inherited from ComfyUI's own UNet loader: default, fp8_e4m3fn, fp8_e4m3fn_fast, fp8_e5m2. fp8 is the settled sweet spot for Flux - half the VRAM of fp16 at near-zero visible loss - and fp8_e4m3fn is the one people actually reach for. Stack fp8 weights with block paging and you've got a genuinely small VRAM footprint while keeping fp8's speed and LoRA-friendliness. fp8_e5m2 is the looser 8-bit encoding; use it only if the e4m3fn variant gives you trouble.
Inputs and outputs
unet_name- dropdown of UNet files inComfyUI/models/unet.weight_dtype-default,fp8_e4m3fn,fp8_e4m3fn_fast, orfp8_e5m2.double_blocks_cuda_size- INT, 0–16, default 7.single_blocks_cuda_size- INT, 0–37, default 7.
One output: MODEL, which wires straight into your sampler. No CLIP, no VAE - this loads only the transformer, the same contract as the built-in UNETLoader.
Installing it
ComfyUI Manager (search ComfyUI-FluxExt-MZ) or:
cd ComfyUI/custom_nodes
git clone https://github.com/MinusZoneAI/ComfyUI-FluxExt-MZ
Restart. No pip dependencies - this pack has no requirements.txt and installs bare. GPL-3.0, a single August 2024 commit, README in Chinese. For loading a UNet with paging, it's about as simple as it gets.
Gotchas
- The T5 encoder isn't your problem here, but it's still a problem. This node only pages the transformer. If your workflow loads T5-XXL as part of a checkpoint, that encoder still eats VRAM - run it fp8 or quantized.
- Don't set either block size to 0. The patch's
range(0, depth, 0)throws; 0 looks allowed in the UI but isn't. - Changing the sizes after a run "has bugs" - author's own README wording. The hooks mutate the model in place; restart ComfyUI before tweaking.
- Paging is slow by construction - every chunk swap is a PCIe transfer. Great for squeezing a 20-step image onto a small card, less fun if you batch 100 images.
- The model must fit in system RAM, since that's where the parked chunks live. fp8 cuts that requirement in half too.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| unet_name | COMBO | 0 options: | |
| weight_dtype | COMBO | 4 options: default, fp8_e4m3fn, fp8_e4m3fn_fast, fp8_e5m2 | |
| double_blocks_cuda_size | INT | 70–16 | — |
| single_blocks_cuda_size | INT | 70–37 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |