translator_m2m100(mki-多语言翻译-m2m100)
Translate text locally in ComfyUI with M2M100 — no API key, no prompts leaving your machine
- STRING
You want to translate a prompt, a caption, or a batch of tags inside a workflow - not paste it into a web page. Most translation nodes in ComfyUI are thin wrappers around online services, which means your prompts are going through someone else's API. This one is different: translator_m2m100_makki (display name "translator_m2m100(mki-多语言翻译-m2m100)") runs Meta's M2M100 translation model on your own machine. No key, no API, no rate limits. Once the model is downloaded it works fully offline, and honestly that's the whole reason to reach for it.
It's the pack's most-searched node for a reason. If you work with Chinese/Japanese/Korean prompts, or you're building a workflow that captions images and then translates the captions into another language for a LoRA training set, this is a genuinely useful thing to have in your graph.
How it works
M2M100 is Facebook's multilingual seq2seq model - one model, 100 languages, no language pair needed. The node wraps the HuggingFace implementation (M2M100ForConditionalGeneration + M2M100Tokenizer) and downloads whatever repo you pick into ComfyUI/models/m2m100/ on first run. After that it's local.
Two details make it nicer than a bare transformers call. First, it auto-detects the source language with langdetect when you set from_language to "auto". Second, it preserves format: paragraphs and line breaks are translated segment by segment and stitched back together, so a list of tags comes back as a list of tags, not a wall of text.
The inputs that matter
- query_text - the text to translate (multiline, so paste a whole prompt block).
- from_language - pick from ~100 languages, or
autoto letlangdetectfigure it out. - to_language - the target. Defaults to English.
- model - five options, default
facebook/m2m100_418M. The 418M is the sensible default; the 1.2B and 12B variants are heavier but noticeably better on hard languages. The 12B "avg" checkpoints are enormous downloads - don't pick them by accident. - quantization -
none,4bit, or8bit(default 8bit). 8bit on the 418M is plenty accurate for prompt work and halves the VRAM footprint. - attention -
sdpa(default),eager, orflash_attention_2. Leave it onsdpaunless you know you haveflash-attnbuilt.
One output: a STRING with the translated text. Wire it into whatever consumes the prompt.
Installing it
It ships in ComfyUI-MakkiTools, so:
cd ComfyUI/custom_nodes
git clone https://github.com/MakkiShizu/ComfyUI-MakkiTools
cd ComfyUI-MakkiTools
pip install -r requirements.txt
Then restart ComfyUI. The pack's requirements.txt only lists translators, langdetect, and sentencepiece - it assumes you already have transformers and huggingface_hub, which almost every ComfyUI install does. The one thing it does not assume is bitsandbytes, which the default 8bit quantization needs.
Where people get burned
- The first run downloads gigabytes. The 418M model is roughly 2.4GB; the 1.2B is over 7GB. It hangs for a while and looks broken. It isn't - check the
models/m2m100/folder. - 8bit is the default, and 8bit needs
bitsandbytes. On Windows that's the classic pain point. If you hit an import error, install it (pip install bitsandbytes) or just set quantization tonone- the 418M fits in a few GB of VRAM unquantized. flash_attention_2fails if you don't have flash-attn compiled. Stick withsdpa.- No network, no first run. The download needs a connection to HuggingFace once. After that it's fully offline.
Is this the most advanced translator in the ecosystem? No. But it's local, it's private, and it Just Works once you get past the initial download. For prompt and caption translation that's usually the right trade.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| query_text | STRING | Text to translate 要翻译的文本 | |
| model | COMBO | facebook/m2m100_418M | M2M100 model to use 要使用的M2M100模型 |
| from_language | COMBO | auto | Source language (auto for automatic detection) 源语言(auto为自动检测) |
| to_language | COMBO | English (en) | Target language 目标语言 |
| quantization | COMBO | 8bit | Model quantization level 模型量化级别 |
| attention | COMBO | sdpa | Attention implementation to use 要使用的注意力实现 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |