Nodes/Comfy-WaveSpeed/🚀Load & Quantize Diffusion Model
ComfyUI Node

🚀Load & Quantize Diffusion Model

Load the big model already in 4-bit

By chengzeyi·Created 2 years ago·Updated 5 days ago· 1,230
🚀Load & Quantize Diffusion Model
    • MODEL
    ◄unet_name▾►
    ◄weight_dtype▾►
    â—„lowvramtrueâ–º
    â—„full_loadtrueâ–º
    â—„quantizetrueâ–º
    â—„quantize_on_load_devicetrueâ–º
    ◄quant_type▾►
    â—„filter_fnfnmatch_matches_fqnâ–º
    â—„filter_fn_kwargs{"pattern": ["*"]}â–º
    ◄kwargs—►

    "🚀Load & Quantize Diffusion Model" (class VelocatorLoadAndQuantizeDiffusionModel) is the diffusion-model twin of the pack's 🚀 Load & Quantize CLIP node: load a model from your diffusion_models folder and quantize it to a compact scheme as it loads, all in one node. If you've ever watched a 7GB+ Flux file refuse to fit in VRAM and wished there was a way to shrink it on the way in - this is that way.

    It sits in a different lane than the pack's plain Load Diffusion Model+. That node gives you fp8, which is the community's default "halve your VRAM with near-zero quality loss" move. This node is for the next tier down: xelerate's int8, nf4, af4 and int4 weight-only schemes that get you further still, at the price of more visible trade-offs. Think "I need this 24B model on a 16GB card" territory.

    How it works

    Under the hood it's a fairly clever patch job. It calls ComfyUI's normal load_diffusion_model, but wraps the loading in a custom QuantizedModelPatcher (subclass of ComfyUI's own ModelPatcher) that intercepts the load. When the model loads, the patcher runs xelerate's quantize over the diffusion model's weights using your chosen quant_type, and in low-VRAM mode it sequences the work: load to CPU, quantize there, then push the shrunken result to the GPU. quantize_on_load_device toggles where the quantization happens.

    Because it patches during load, the quantized weights never sit around in full precision on your GPU. That sequencing is the whole trick - and it's why a node like this can matter when the obvious "just load it and quantize after" approach OOMs.

    Inputs that matter

    • unet_name - the model from models/diffusion_models.
    • weight_dtype - base load precision; default or float16/bfloat16 are the sensible starts. This is the precision the quantizer sees, not the final format.
    • quantize - the master switch. On by default; turn it off and the node is basically a plain loader, so leave it on.
    • quant_type - the scheme. The menu: int8_dynamic, e4m3_e4m3_dynamic, e4m3_e4m3_dynamic_per_tensor, int8_weightonly, e4m3_weightonly, e4m3_e4m3_weightonly, e4m3_e4m3_weightonly_per_tensor, nf4_weightonly, af4_weightonly, int4_weightonly. The "weightonly" ones compress just the weights (dequantized at compute time), which is where the real VRAM wins live; int4/nf4/af4 are the 4-bit aggressive tier.
    • lowvram - on by default; loads and quantizes on CPU first so peak GPU memory stays low. This is what makes big models fit.
    • full_load - whether to fully load before quantizing.
    • filter_fn / filter_fn_kwargs / kwargs - which layers get quantized (default: everything matching ["*"]), plus pass-through options for xelerate's quantizer.

    Output is a MODEL, ready for Apply First Block Cache, a compile node, or straight into the sampler.

    Install - the dependency you'll trip over

    Every 🚀 node hard-requires xelerate: if it's not installed you get an immediate velocator is not installed assert. The pack's pyproject.toml lists no dependencies and the README never mentions these nodes - they're a shipped but undocumented part of Comfy-WaveSpeed, and xelerate has essentially no community coverage, so there's no crowd-sourced install guide. You're following the xelerate project's own docs.

    cd ComfyUI/custom_nodes
    git clone https://github.com/chengzeyi/Comfy-WaveSpeed.git
    

    Where people get burned

    • "Fast" isn't free. The weight-only 4-bit schemes buy VRAM with dequantization overhead and real quality cost - the KB's GGUF notes are the same story in a different format: below Q5-ish, quality degrades visibly, and smaller quants can even run slower because of the dequant penalty.
    • Scope creep. If you only need fp8, Load Diffusion Model+ does it with zero extra dependencies. Reserve this node for when fp8 genuinely doesn't fit, and you're sure you want xelerate's aggressive schemes enough to adopt a new, barely-documented dependency for them.
    Categorywavespeed/velocator

    Inputs (10)

    NameTypeDefaultDescription
    unet_nameCOMBO0 options:
    weight_dtypeCOMBO8 options: default, float32, float64, bfloat16, float16, fp8_e4m3fn, +2
    lowvramBOOLEANtrue—
    full_loadBOOLEANtrue—
    quantizeBOOLEANtrue—
    quantize_on_load_deviceBOOLEANtrue—
    quant_typeCOMBO10 options: int8_dynamic, e4m3_e4m3_dynamic, e4m3_e4m3_dynamic_per_tensor, int8_weightonly, e4m3_weightonly, e4m3_e4m3_weightonly, +4
    filter_fnSTRINGfnmatch_matches_fqn—
    filter_fn_kwargsSTRING{"pattern": ["*"]}—
    kwargsSTRING—

    Outputs (1)

    NameTypeDescription
    MODELMODEL—