Nodes/ComfyUI LLM SDXL Adapter/LLM Adapter Loader
ComfyUI Node

LLM Adapter Loader

Where the trained weights actually come in

By NeuroSenko·Created about a year ago·Updated 10 months ago· 69
LLM Adapter Loader
    • llm_adapter
    • info
    adapter_name
    typegemma
    deviceauto
    force_reloadfalse

    The LLM loader gives you a brain, the text encoder gives it words, but neither of them knows anything about SDXL. LLMAdapterLoader is where the trained knowledge lives: it loads the .safetensors adapter file from your ComfyUI/models/llm_adapters/ folder, builds the matching adapter network, and hands you the LLM_ADAPTER object that ApplyLLMToSDXLAdapter needs to finish the job.

    You can't skip this node and you can't fake it. An untrained adapter network would output garbage - the weights are the entire point. The README's setup is specific about where they come from: the RouWei-Gemma adapter, trained against RouWei v0.8, downloadable from CivitAI (model 1782437) or HuggingFace (Minthy/RouWei-Gemma). That single file (rouweiGemma_g31b27k.safetensors in the README's example) is the difference between "SDXL with a strange new encoder" and "an SDXL that actually understands sentences."

    The one input that matters: type

    adapter_name picks the file from llm_adapters/, but type is where people break things. The dropdown has exactly two choices and they map to hard-coded architecture presets:

    • gemma - llm_dim 1152 (Gemma-3-1b's hidden size), target sequence 308, 2 wide + 3 narrow blocks, dropout 0.1. This is the default and the RouWei-Gemma setup.
    • t5gemma - llm_dim 2304, 3 wide + 3 narrow blocks, dropout 0.0. The T5Gemma branch of the pack.

    The type must match the model that produced your hidden states. Run a Gemma model through a t5gemma adapter and the first linear projection throws a shape mismatch. The info output tells you what config it actually used, so when something's wrong, read it.

    The rest is familiar: device (auto default, or cuda:0/cuda:1/cpu) and force_reload (default off, flips true when you swap adapter files mid-session). Outputs are llm_adapter (LLM_ADAPTER) and info (STRING).

    Why you'd pick this over the Custom variant

    The pack ships LLMAdapterLoaderCustom with every architecture knob exposed. This loader is the safe path: presets that are known to match the published weights. Unless you trained your own adapter, use this one. Custom is for people who know the exact dims of their own experiment; guessing on this node just produces an error you don't need.

    Install

    Part of the ComfyUI LLM SDXL Adapter pack - ComfyUI Manager, search "ComfyUI LLM SDXL Adapter", or:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/NeuroSenko/ComfyUI_LLM_SDXL_Adapter.git
    

    Restart, then drop the adapter file into ComfyUI/models/llm_adapters/ and it appears in the dropdown. Dependencies: transformers, safetensors, einops, torch (no GGUF package needed here).

    Troubleshooting

    • Empty dropdown: the file isn't .safetensors, or it isn't in llm_adapters/. Both are checked by the node's scan.
    • "Adapter loading failed": a malformed or mismatched checkpoint - the state dict didn't fit the preset architecture. Double-check which adapter you downloaded and that type matches the model in the chain.
    • Shape mismatch on apply: you already know - type vs. the LLM that encoded the text.
    Categoryllm_sdxl

    Inputs (4)

    NameTypeDefaultDescription
    adapter_nameCOMBO0 options:
    typeCOMBOgemma2 options: gemma, t5gemma
    deviceoptCOMBOauto4 options: auto, cuda:0, cuda:1, cpu
    force_reloadoptBOOLEANfalse

    Outputs (2)

    NameTypeDescription
    llm_adapterLLM_ADAPTER
    infoSTRING