Nodes/Comfy-WaveSpeed/🚀Load & Quantize CLIP
ComfyUI Node

🚀Load & Quantize CLIP

Text encoders, pre-shrunk, in one node

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

    "🚀Load & Quantize CLIP" (class VelocatorLoadAndQuantizeClip) does exactly what its name says: loads your text encoder(s) and quantizes them to a smaller weight format while loading, in a single node. The pitch is familiar to anyone who's fought to fit Flux or SD3 on a mid-range card - the diffusion model gets all the attention, but the text encoder is often the thing that tips you over your VRAM budget. The KB's quantization notes say it plainly: on LLM-encoded models, the encoder is frequently what decides whether anything fits at all.

    This node hands you the encoder side of the equation.

    How it works

    It calls ComfyUI's own comfy.sd.load_clip with up to three text encoder files, a type from ComfyUI's CLIPType enum (that's where flux, sd3, hunyuan_video, ltxv and the rest come from), and your chosen weight_dtype. If quantize is on, it runs xelerate's quantize over the loaded weights - that's the important part - converting them to one of the quant_type schemes as the model loads.

    For low-VRAM setups there's a tidy dance under the hood: with lowvram on, weights load on CPU first, get quantized, then move to the GPU. quantize_on_load_device handles where that quantization happens. That's the whole "fits on my card" magic, and it's the reason this node exists rather than "just use the stock loader."

    Inputs that matter

    • clip_name1 / clip_name2 / clip_name3 - up to three text encoder files from your models/text_encoders folder. For Flux, that's typically a T5 (or a smaller alternative) plus a CLIP; for SD3, three. Leave the slots you don't need empty - this is how you load multi-encoder architectures in one go.
    • type - the architecture: flux, sd3, hunyuan_video, ltxv, stable_diffusion, stable_cascade, mochi, pixart, cosmos, and more.
    • weight_dtype - the load precision, from default through float16 to the fp8 variants.
    • quantize - the on/off switch for the whole quantization step. Leave on; it's the point.
    • quant_type - which quantization scheme xelerate applies. The menu runs from int8_dynamic through the e4m3 family (e4m3_e4m3_dynamic, e4m3_weightonly, …) down to nf4_weightonly, af4_weightonly and int4_weightonly. If you don't know what to pick, int8_dynamic is the gentle default and the weight-only options are the aggressive ones for tight VRAM.
    • filter_fn / filter_fn_kwargs - which weights get quantized, via a matching function (default fnmatch_matches_fqn with pattern ["*"], meaning everything). You can target specific layer names to keep sensitive layers in full precision.
    • kwargs - passed through to xelerate's quantizer.

    The single CLIP output plugs into your CLIP Text Encode node exactly where the stock CLIP loader's output went.

    Install - read this before you get excited

    The node requires xelerate installed in ComfyUI's Python environment - assert HAS_VELOCATOR, "velocator is not installed" if it isn't. The pack does not install it (its pyproject.toml lists no dependencies), and the README never mentions the Velocator nodes at all. They're a shipped but undocumented corner of the pack, and xelerate has close to zero community presence, so you're installing it from its own project docs, sight unseen.

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

    Where people get burned

    The realistic footgun is expectation-setting. If you're on a 30-series card or just want fp8 encoders without the xelerate detour, you can get most of the value with plain weight_dtype = fp8_e4m3fn on the stock loader - this node's real selling point is the aggressive int8/int4/nf4 weight-only schemes and the load-time quantization pipeline, which is where xelerate's niche is. Know which one you're actually after before you wrestle a brand-new dependency into your environment for it.

    Categorywavespeed/velocator

    Inputs (13)

    NameTypeDefaultDescription
    clip_name1COMBO1 options:
    clip_name2COMBO1 options:
    clip_name3COMBO1 options:
    typeCOMBO35 options: stable_diffusion, stable_cascade, sd3, stable_audio, hunyuan_dit, flux, +29
    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
    CLIPCLIP—