Gemmax Translate
Translate 28 languages inside ComfyUI, no API key required
- translations
GemmaxRun (labeled "Gemmax Translate" in your node menu) is a machine-translation node that runs a real multilingual LLM entirely on your machine. No API calls, no key, no cloud - the "translate" in the display name is a lie only in the sense that it does the work locally. You feed it a string, pick a source and target language from 28 options, and it hands you the translated text back as a string you can wire anywhere. It's one of two nodes in the tiny billwuhao/ComfyUI_gemmax pack, and it's the generalist: 28 languages, a real transformer model, and all the VRAM and load times that come with that.
Why would you bother translating inside ComfyUI instead of pasting into DeepL? Because you're already here. The classic move is bulk-localizing prompts for batch runs, or translating a pile of training captions from their original language into clean English before you feed them to a LoRA trainer. Anything that means "text goes in, different-language text comes out" inside a graph. It's not a node the community talks about - this pack gets single-digit impressions, so you're early - but it does one job cleanly.
How it works
Under the hood GemmaxRun loads one of Xiaomi's GemmaX2 translation models (gemmax, Xiaomi Research's multilingual model family built on Google's Gemma X base - hence the name) through plain HuggingFace transformers. The node builds a Chinese prompt scaffold - literally hardcoded as "将文本从{source}翻译成{target}:\n\n{source}:{text}\n\n{target}:" - runs a standard model.generate() call, then slices the decoded output at \n\n{target}: to strip the prompt echo. The scaffold being in Chinese is a quirk, not a bug; it works regardless of which languages you pick.
The inputs that actually matter
You get six inputs and one output. The full list is short, so here's the whole set:
- model - 4 choices, default
GemmaX2-28-2B-4bit: the 2B and 9B v0.1 releases, plus 4bit and 8bit quants of the 2B. The 4bit default is the one you want: the README's own framing is that it uses less VRAM and runs faster, and for translation output quality barely moves. - source_language / target_language - two 28-entry dropdowns, default English → 中文. Chinese is in there as 中文; there's no separate "Chinese" entry.
- text - a STRING input with
forceInput, so you wire it from a text source. The example workflow feeds it from aMultiLinePromptATnode; any string works. - max_new_tokens - default 200, and it's a hard cap on output length. Long paragraphs will get truncated at 200 tokens; raise it if you translate big blocks.
- unload_model - default true, and this is the trap: the model is evicted from VRAM after every single run. Great for keeping a 2B LLM from squatting on your card while you sample; miserable if you're translating fifty captions, because each run reloads from disk.
The translations output is a plain STRING. Preview it with a PreviewAny/Show Text node, or feed it to anything else that consumes text - a text-overlay node, a caption writer, whatever.
Installing it
Install once, and both nodes in the pack come along:
cd ComfyUI/custom_nodes
git clone https://github.com/billwuhao/ComfyUI_gemmax.git
cd ComfyUI_gemmax
pip install -r requirements.txt
(Windows embeddable Python: ./python_embeded/python.exe -m pip install -r requirements.txt.) ComfyUI Manager works too - search "MW-ComfyUI_gemmax". Then download one of the models from HuggingFace - ModelSpace/GemmaX2-28-2B-v0.1, Tonic/GemmaX2-28-2B-4bit, etc. - and drop it in ComfyUI/models/TTS. Yes, TTS. It's a translation node that looks in the text-to-speech folder; that's just where the pack reads, so that's where it goes.
Common issues & troubleshooting
- It looks hung on first run. The first translate call downloads and loads a multi-GB model. It's not frozen, it's loading.
transformersimport errors. The shippedrequirements.txtcovers quickmt's stack (ctranslate2, sentencepiece, blingfire) but doesn't pin transformers, which GemmaxRun actually needs - the pack assumes it's already in your environment from some other node. If it fails,pip install transformersfixes it.- Repeated runs are slow. That's
unload_modelset to true. Flip it off when doing batch work. - Output gets cut off. Raise
max_new_tokens; 200 is conservative. - Out of memory. The 9B model wants real VRAM. On a small card, the 2B 4bit is the escape hatch - see the usual VRAM guidance for ComfyUI.
One last thing worth saying about any custom node, this one included: installing it runs arbitrary Python on your machine with no sandbox. Grab it from the official repo, don't chase a "fixed fork," and you're fine - but that's the deal with the whole ecosystem.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| model | COMBO | GemmaX2-28-2B-4bit | 4 options: GemmaX2-28-2B-v0.1, GemmaX2-28-9B-v0.1, GemmaX2-28-2B-4bit, GemmaX2-28-2B-8bit |
| source_language | COMBO | English | 28 options: Arabic, Bengali, Czech, German, English, Spanish, +22 |
| target_language | COMBO | 中文 | 28 options: Arabic, Bengali, Czech, German, English, Spanish, +22 |
| text | STRING | — | |
| max_new_tokens | INT | 200 | — |
| unload_model | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| translations | STRING | — |