Nodes/ComfyUI-LuminaWrapper/DownloadAndLoadGemmaModel
ComfyUI Node

DownloadAndLoadGemmaModel

Where Lumina's text encoder comes from (and why it wants an HF login)

By kijai·Created 2 years ago·Updated 2 years ago· 196
DownloadAndLoadGemmaModel
    • gemma_model
    precisionbf16

    First node in every Lumina workflow. This one loads Google's Gemma-2b, the LLM that Lumina-Next uses instead of a CLIP or T5 text encoder, and hands it to you as a GEMMAODEL. It's small (2B parameters, ~4GB in bf16), but it's the part of the pipeline that trips up more first-timers than the actual image model - because Gemma is gated.

    How it works

    The node downloads Gemma-2b from HuggingFace into ComfyUI/models/LLM/gemma-2b, ignoring anything with gguf in the name (you want the raw safetensors, not a quantized llama.cpp file), then loads it as GemmaForCausalLM. Note the repo it pulls from is alpindale/gemma-2b, a mirror - that's deliberate, so the node can auto-download without you juggling tokens. If flash_attn is installed it loads with flash attention; otherwise it falls back to torch SDP, which the pack's README calls out as "at least twice as slow and memory hungry."

    Your only real choice is precision:

    • bf16 (default) - half precision, roughly 4GB, and the sensible choice on any GPU from the RTX 3000 series up. bf16 doesn't exist on older cards (GTX 1000/2000, early Turing), which is when you hit the other option.
    • fp32 - double the memory, roughly 8GB, and the workaround if bf16 won't run. Slower too.

    Output: gemma_model, which feeds either LuminaGemmaTextEncode (the normal path - it encodes your prompt into Lumina embeddings) or GemmaSampler (the prompt-rewriting node).

    The gating gotcha

    Google requires you to accept the Gemma license terms before you can download the model. The README says it plainly: you need a HuggingFace account and to request access - "it's instant once you do it." If the auto-download fails with a 401 or an access-denied error, that's what's happening. Fix it by going to the Gemma model page on HF, accepting the terms, and then either letting the node retry or downloading the model yourself into ComfyUI/models/LLM/gemma-2b. If you download by hand, you'll want huggingface-cli login first, and you don't need the gguf file.

    Installing the pack

    Via ComfyUI Manager (search "ComfyUI-LuminaWrapper"), or:

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

    Then restart ComfyUI. Requirements are light - torchdiffeq, accelerate, tqdm, transformers>=4.38.0 - the heavy optional one is flash_attn (prebuilt Windows wheels from the bdashore3 flash-attention releases if you don't want to compile for an hour).

    One thing to know before you run

    The node's keep_model_loaded isn't a thing here - unloading happens on the encode nodes downstream. And if you're on a 3060-class card, this ~4GB model plus the ~4GB Lumina model plus an SDXL VAE is a comfortable fit at 1024×1024. Don't let the two-download setup scare you off; the pack's autodownload does both, and the first run just takes a while.

    This is a kijai wrapper, so "trust Kijai to already be on it" - same author behind KJNodes, the Wan and LTX-Video wrappers, and a dozen other model releases that hit ComfyUI before most people finished reading the announcement.

    CategoryLuminaWrapper

    Inputs (1)

    NameTypeDefaultDescription
    precisionCOMBObf162 options: bf16, fp32

    Outputs (1)

    NameTypeDescription
    gemma_modelGEMMAODEL