ComfyUI Node

LLM Model Loader

The plain LLM loader this whole pack is built around

By NeuroSenko·Created about a year ago·Updated 10 months ago· 69
LLM Model Loader
    • model
    • tokenizer
    • info
    model_name
    deviceauto
    force_reloadfalse

    LLMModelLoader is the boring, dependable one - the loader the README's example workflow uses and the one that gives you the best-quality input to the whole chain. If LLMGGUFModelLoader is the low-VRAM compromise, this is the reference path: it loads a full HuggingFace checkpoint from your ComfyUI/models/llm/ folder at bfloat16 with hidden states enabled, and hands you the LLM_MODEL and LLM_TOKENIZER that LLMTextEncoder wants.

    It's a genuinely thin node. Its one real job is calling AutoModelForCausalLM.from_pretrained on the directory you point it at, with output_hidden_states=True (that's the bit that matters - without hidden states the encoder has nothing to slice), plus the matching AutoTokenizer. Because it's a plain Transformers load, it works with any architecture the library supports: Gemma (the intended one), Llama, Mistral, whatever you can find in the folder.

    What you actually set

    • model_name - a dropdown of every model directory in ComfyUI/models/llm/. Each entry must be a folder containing config.json and model.safetensors (or pytorch_model.bin); the node only lists directories that look like real models. Note this is a folder selector, not a single-file one - this loader wants the whole HF layout, which is exactly the "you need ALL files, not just the safetensors" warning in the README.
    • device - auto (default), cuda:0, cuda:1, or cpu.
    • force_reload - default off. The loader caches whatever it loaded and only re-reads when the path changes. Set it true if you swap the model mid-session.

    Outputs: model (LLM_MODEL), tokenizer (LLM_TOKENIZER), and info - a string with the resolved path, device, and a "Loaded: True/False" status you can stick in a text viewer when things aren't working.

    The honest trade-off

    There's no quantization anywhere in this node, so a 1B Gemma at bf16 is a real chunk of VRAM sitting on your card for the whole generation - even though the encoder only runs once per encode, before sampling. If your card is tight, LLMGGUFModelLoader is the escape hatch, at the cost of quantized hidden states that slightly shift your results. If it fits, use the full model: the trained adapter was fit on exactly these states, so this is the path that matches what the adapter expects.

    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 ComfyUI. Dependencies are transformers>=4.53.1, einops, safetensors, and torch - no GGUF package needed on this path. Then get gemma-3-1b-it (from HuggingFace, or the non-gated unsloth/gemma-3-1b-it mirror) into ComfyUI/models/llm/gemma-3-1b-it/, complete with tokenizer.json, tokenizer_config.json, and the rest.

    Troubleshooting

    • "Model not found" - the folder name has to match a directory under models/llm/ that actually contains config.json. Case matters.
    • Node loads but encoding fails downstream - you almost certainly grabbed only the safetensors. Get the full folder.
    • Forgetting to change models in a running session - the cache hits and you keep encoding with the old model; that's what force_reload is for.
    Categoryllm_sdxl

    Inputs (3)

    NameTypeDefaultDescription
    model_nameCOMBO0 options:
    deviceoptCOMBOauto4 options: auto, cuda:0, cuda:1, cpu
    force_reloadoptBOOLEANfalse

    Outputs (3)

    NameTypeDescription
    modelLLM_MODEL
    tokenizerLLM_TOKENIZER
    infoSTRING