Nodes/ComfyUI-KwaiKolorsWrapper/Load ChatGLM3 Model
ComfyUI Node

Load ChatGLM3 Model

The local-file option for the biggest piece of Kolors

By kijai·Created 2 years ago·Updated 2 years ago· 592
Load ChatGLM3 Model
    • chatglm3_model
    chatglm3_checkpoint

    Load ChatGLM3 Model is the sibling of the auto-downloading ChatGLM3 loader, and the one you use when you'd rather manage the encoder yourself. Instead of pulling the whole HuggingFace diffusers folder, it loads ChatGLM3 from a single .safetensors file sitting in ComfyUI/models/LLM/checkpoints. Same output, different diet.

    Why does this variant exist? The pack's README has a whole section about it. Loading from a local file is nicer for people who want to pre-download once, keep a quantized copy around, or sidestep the auto-downloader when their connection (or HuggingFace) is being difficult. Kijai even published a matching repo, Kijai/ChatGLM3-safetensors, with pre-converted fp16 and quantized checkpoints that drop straight into that folder.

    How it works

    This is the clever bit: the node doesn't need the full HuggingFace layout because the configs are bundled in the pack. text_encoder_config.json and the tokenizer files ship inside the repo, so from one weights file it can reconstruct the whole model - ChatGLMConfig from the bundled JSON, weights loaded with ComfyUI's load_torch_file, and the tokenizer from the included config folder.

    Two details worth knowing:

    • Quantization is filename-driven. The loader checks the checkpoint name for 4bit or 8bit and quantizes automatically. Name your file chatglm3-fp16.safetensors and it stays fp16; chatglm3-4bit.safetensors and you get 4-bit. There's no precision dropdown here - the filename is the setting.
    • It uses accelerate's init_empty_weights to build the model skeleton without blowing up memory, then moves the loaded tensors onto the offload device. If accelerate isn't installed, the code falls back to a plain load - which is why accelerate is in the pack's requirements.txt.

    The input

    • chatglm3_checkpoint - a dropdown listing whatever .safetensors files are in ComfyUI/models/LLM/checkpoints. If the folder's empty, the dropdown's empty and the node can't do anything, so drop a file in and hit refresh first.

    The output is the same chatglm3_model as its sibling - wire it into Kolors Text Encode and the rest of the chain is identical.

    Installing it

    Same pack, same install:

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

    Restart ComfyUI. ComfyUI Manager also has it under "KwaiKolorsWrapper". Then grab the checkpoint: either convert it yourself or download from Kijai/ChatGLM3-safetensors on HuggingFace and put the file at ComfyUI/models/LLM/checkpoints/. The folder gets registered automatically when the pack loads - ComfyUI may need a restart after you add the file for the dropdown to see it.

    Gotchas

    • The empty-dropdown loop is the #1 first-run frustration: file not in place yet, or ComfyUI didn't refresh. Restart after dropping the file in.
    • Filename spelling matters for quantization - 4bit/8bit are literal substrings, so don't name a quantized file q8 and expect it to be detected.
    • This node is only for the encoder. You still need the Kolors UNet loader, Text Encode, Sampler, and an SDXL VAE decode to get a picture.
    • If the pack itself won't import, it's usually the known transformers/diffusers version clash with other packs - the community fallback there is the MinusZoneAI/Kolors-MZ wrapper.
    CategoryKwaiKolorsWrapper

    Inputs (1)

    NameTypeDefaultDescription
    chatglm3_checkpointCOMBO0 options:

    Outputs (1)

    NameTypeDescription
    chatglm3_modelCHATGLM3MODEL