Nodes/comfyui-gemma4translate-gguf/Gemma4 Translate GGUF Mini
ComfyUI Node

Gemma4 Translate GGUF Mini

No API key, no uploads, just a GGUF

By jkmq-f·Created 5 months ago·Updated 5 months ago· 0
Gemma4 Translate GGUF Mini
    • translated_text
    input_text
    target_languageEnglish
    gguf_model_path
    load_strategyreload_every_run

    The name is a lie in the best way: Gemma4 Translate GGUF Mini doesn't call any API and needs no key. It's a single node that runs a Gemma 4 instruct model locally through llama.cpp and translates whatever text you feed it, fully on your machine. One input, one output, four knobs. That's the whole pack.

    Why would you want a translator inside a diffusion graph? Because prompt workflows get multilingual fast. You write prompts in your native language and need them in English before the CLIP encoder sees them; you're building an automation that reads tags or captions in Japanese and rewrites them; you want a UI that says "translate" instead of "paste into DeepL, copy back." This node slots in front of your text encoder and closes that loop without leaving ComfyUI. It's a fork of rookiestar28/ComfyUI-TranslateGemma, stripped to the essentials: GGUF-only, local-file-only, text-only.

    How it works

    Under the hood it's llama_cpp.Llama loading a .gguf file with chat_format="gemma", 8192 tokens of context, and all layers offloaded to GPU. It builds a translation prompt - "Translate the following text into [target]. Detect the source language automatically. Return only the translation." - and a system prompt that explicitly tells the model to suppress reasoning ("Do not show thinking. Return only the final translated text."). Generation is run at temperature 0.1 with a 512-token cap, which is the right call: you want a dry, deterministic translation, not the model editorializing. There's no image input here - Gemma 4's vision side is deliberately left out, so don't expect manga text rendering from this node.

    The clever bit is load_strategy. With the default reload_every_run, the node unloads the model in a finally block after every translation - deleting it, running gc.collect(), and flushing the CUDA cache. That keeps the LLM out of VRAM while your sampler runs. Pick keep_loaded and the model stays resident, which makes chained translations far snappier at the cost of holding your GPU hostage between runs.

    The inputs that matter

    • input_text - the text to translate (multiline).
    • target_language - a 35-language dropdown, English by default. Source language is always auto-detected; you only pick the destination.
    • gguf_model_path - the path to a .gguf file, the file itself. This is where people get burned.
    • load_strategy - reload_every_run (default) vs keep_loaded.

    The output is translated_text (a STRING), which you wire into a text display, a prompt-builder node, or a CLIP text encoder.

    Installing it

    From ComfyUI Manager, search "Gemma4 Translate GGUF Mini", or the manual way:

    cd ComfyUI/custom_nodes
    git clone https://github.com/jkmq-f/ComfyUI-Gemma4Translate-GGUF-Mini
    cd ComfyUI-Gemma4Translate-GGUF-Mini
    python -m pip install -r requirements.txt
    

    Then restart ComfyUI. The dependencies are light - llama-cpp-python, langcodes, Pillow - but llama-cpp-python is the one that can bite: it usually installs a prebuilt wheel, but on unusual platforms it compiles from source and needs a toolchain.

    Troubleshooting

    • "must point to a .gguf file, not a directory" - the #1 trap. The path needs the file (e.g. .../gemma-4-E4B-it-Q5_K_M.gguf), not the folder you downloaded it into. Leave the field empty to fall back to the GEMMA4_GGUF_MODEL environment variable instead.
    • CUDA memory instability - the README explicitly suggests launching ComfyUI with python main.py --disable-cuda-malloc if you hit weird allocation errors.
    • The node always re-executes (IS_CHANGED returns NaN), so it'll re-run even if your input is unchanged - expected, not a bug.

    Is it the best translator in the world? No - a cloud API or a beefier LLM beats a quantized 4B-class model on nuance. But for prompt localization it's quietly excellent: private, free, and one node away. If you already keep a Gemma 4 GGUF around, this is the leanest way to put it to work.

    Categorylanguage

    Inputs (4)

    NameTypeDefaultDescription
    input_textSTRING
    target_languageCOMBOEnglish35 options: Arabic, Bulgarian, Chinese (Simplified), Chinese (Traditional), Czech, Danish, +29
    gguf_model_pathSTRING
    load_strategyCOMBOreload_every_run2 options: keep_loaded, reload_every_run

    Outputs (1)

    NameTypeDescription
    translated_textSTRING