Nodes/ComfyUI-KwaiKolorsWrapper/(Down)load ChatGLM3 Model
ComfyUI Node

(Down)load ChatGLM3 Model

The node where Kolors' VRAM bill gets paid

By kijai·Created 2 years ago·Updated 2 years ago· 592
(Down)load ChatGLM3 Model
    • chatglm3_model
    precisionfp16

    (Down)load ChatGLM3 Model is where the VRAM bill for Kolors gets paid - roughly 13 GB of it in fp16. ChatGLM3 is the large language model Kuaishou bolted onto Kolors as its text encoder (a GLM-family model from Zhipu's crew), and it's the reason Kolors understands Chinese prompts better than almost anything that uses CLIP. It's also the reason a mid-range card chokes: the text encoder is the single biggest memory consumer in the whole pipeline, bigger than the UNet, bigger than sampling.

    This node is the easy path: it downloads the encoder for you and loads it, with a precision dropdown that decides whether you run fp16 or quantize it down to 8-bit or 4-bit.

    How it works

    The node pulls text_encoder/* from the same Kwai-Kolors/Kolors HuggingFace repo into ComfyUI/models/diffusers/Kolors/text_encoder (the (Down)load Kolors Model node deliberately skipped this folder). It loads the model in fp16 first, then - only if you asked - calls ChatGLM's built-in quantize(8) or quantize(4) on top. The result is packaged with its tokenizer as a chatglm3_model, which is what Kolors Text Encode consumes.

    The README's own math, which lines up with what people actually see:

    | Precision | Text encoder VRAM | |---|---| | fp16 | ~13 GB | | quant8 | ~8 GB | | quant4 | ~4 GB |

    There's one practical takeaway there: quant8 is basically fp16 quality at two-thirds the size, so if you've got 10 GB or so to spare, just use it. Quant4 is the "make it fit on a consumer card" option, and the quality hit on prompt understanding is real but tolerable - it's the difference between running Kolors and not running it.

    The one input that matters

    • precision - fp16, quant8, or quant4. Default is fp16, which is the trap: if you're on 8–12 GB VRAM and just click through, this node will happily blow your card before the sampler ever runs. Pick quant8 or quant4 first, then decide if you miss the quality.

    Output is a single chatglm3_model that wires into the chatglm3_model input of Kolors Text Encode.

    Installing it

    It's part of Kijai's pack, so:

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

    Restart, and look for the KwaiKolorsWrapper category (ComfyUI Manager can install it by searching "KwaiKolorsWrapper"). The quantized modes rely on cpm-kernels being in your environment - it's in requirements.txt, so a normal install covers you, but a clean portable install that skipped deps will fail on the quantized paths with an import error.

    Where people get burned

    • Default fp16 is the OOM trap. The encoder alone is 13 GB; if you're not on a 24 GB card, choose quant4/quant8 before you do anything else. This is the node to blame when "the model won't run," not the sampler.
    • The README calls for transformers 4.38.0 minimum - older versions can break the ChatGLM path. And because the pack pins diffusers >= 0.28.2, it can fight other packs over versions; if the whole pack fails to import, that clash is the usual suspect and the MinusZoneAI/Kolors-MZ wrapper is the community fallback.
    • First run downloads the text encoder, which is a multi-GB fetch. Nothing renders until it's done, and it needs HuggingFace reachable.
    CategoryKwaiKolorsWrapper

    Inputs (1)

    NameTypeDefaultDescription
    precisionCOMBOfp163 options: fp16, quant4, quant8

    Outputs (1)

    NameTypeDescription
    chatglm3_modelCHATGLM3MODEL