Nodes/ComfyUI_Dif_GGUF/CLIP_GGUF_Loader
ComfyUI Node

CLIP_GGUF_Loader

Your text encoder is quietly eating your VRAM — feed it GGUF

By smthemex·Created 2 months ago·Updated 25 days ago· 20
CLIP_GGUF_Loader
    • CLIP
    gguf
    type
    device

    Everyone quantizes the big diffusion transformer. Almost nobody quantizes the text encoder, which is a shame, because on modern models the encoder is the second-largest bill you're paying. T5-XXL alone is 4.7B parameters - around 10GB at fp16 - and on Flux 2-class models the encoder is a big enough chunk that it decides whether the whole stack fits your card. This node is the fix: it loads a single text encoder straight from a .gguf file, keeping the quantized weights quantized instead of inflating them back to fp16.

    It comes from smthemex's ComfyUI_Dif_GGUF pack, a small but current take on the GGUF idea that city96 popularized for the Flux generation. Same lazy-dequant trick, same Q4-Q8 ladder, rewritten against the newer ComfyUI node API and aimed at the new-school models (Klein, Flux 2, the Qwen-encoder generation) that older packs sometimes trail on.

    How it works

    A GGUF text encoder is produced by llama.cpp's convert scripts, which is why its tensor names are llama.cpp names (blk.0.attn_q.weight, token_embd.weight) rather than the ones ComfyUI's T5 or CLIP code expects. This node reads the file, remaps those keys back to the names ComfyUI knows, and hands the state dict to ComfyUI's own text-encoder loader with custom ops attached. The quantized tensors stay quantized and get dequantized lazily at forward time - you never materialize the fp16 version in VRAM, which is the whole point.

    The inputs that matter

    The node is nearly a one-pick widget, but that one pick is easy to get wrong.

    • gguf - the text encoder file. The dropdown lists .gguf files from your text_encoders, clip_gguf, and gguf model folders. Note that "none" appears in the list but will just error out - pick a real file.
    • type - this is the one that bites. It must match what's actually inside your .gguf. The dropdown spans the whole modern zoo: stable_diffusion, sd3, flux2, wan, hidream, qwen_image, ltxv, mochi, and more. If you pick the wrong architecture the conditioning comes out wrong, so check what encoder your checkpoint actually pairs with.
    • device - default or cpu. Forcing cpu parks the encoder's weights in system RAM, handy when VRAM is the constraint.

    The single CLIP output wires straight into a CLIP Text Encode (Prompt) node, same as any other text-encoder loader.

    Installing it

    Via ComfyUI Manager, search ComfyUI_Dif_GGUF, or clone it manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/smthemex/ComfyUI_Dif_GGUF
    cd ComfyUI_Dif_GGUF
    pip install -r requirements.txt
    

    The requirements file is just torch and gguf. If you already run city96's ComfyUI-GGUF, the gguf library is already installed and you can skip the pip step. Put the encoder .gguf in ComfyUI/models/text_encoders/ (or models/gguf/) and restart.

    Where people get burned

    • Missing gguf package - if you skip requirements and don't have another GGUF pack installed, you'll hit ModuleNotFoundError: gguf at startup. One pip install gguf fixes it.
    • The pack targets the new node API. It's written against comfy_api.latest and the extension entry-point system, so if the nodes don't appear in your palette, update ComfyUI before debugging anything else.
    • Wrong type gives silent garbage rather than an error, so match it to the encoder.

    One honest caveat: this is a niche pack with little community traffic. If you're just running vanilla Flux on a budget and already have city96's pack working, its text-encoder loaders do the same job with more battle testing. Reach for this one when you're on the newest models or a very fresh ComfyUI. And the usual GGUF rules still apply: Q8 is basically fp16 at half the size, and the encoder is the one place where squeezing to Q4-Q6 costs you almost nothing visible.

    Categorymodel/loaders

    Inputs (3)

    NameTypeDefaultDescription
    ggufCOMBO1 options: none
    typeCOMBO28 options: stable_diffusion, stable_cascade, sd3, stable_audio, mochi, ltxv, +22
    deviceoptCOMBO2 options: default, cpu

    Outputs (1)

    NameTypeDescription
    CLIPCLIP