Qwen3 翻译器(新版)
Translate prompts locally with Qwen3 — no API key, and the model might already be on your disk
- STRING
If you've spent any time in ComfyUI, you've hit the wall: a big slice of the best workflows come from Chinese creators, and the node labels, READMEs, and default prompts are in Chinese. You can paste text into DeepL and copy it back, but that breaks the flow and ships your prompts to a third party. This node is the fix: a Qwen3 model running entirely on your GPU, translating between Chinese, English, Japanese, and Korean. No API key, no account, no per-character billing. And the kicker - you may already own the weights it needs. Qwen3-4B is the text encoder inside Z-Image and friends, so if you've been generating with them, a translator-grade Qwen3 may already be on your disk.
How it works
Under the hood it's refreshingly direct. On startup the node scans ComfyUI/models/text_encoders, models/LLM, and models/prompt_generator for any folder containing a config.json and lists them in a dropdown. Pick one, give it text, and it reads the model's model_type to decide how to load it: plain Qwen3 text models go through AutoModelForCausalLM, and anything with "vl" in the type goes through Qwen3VLForConditionalGeneration, both at bfloat16 with device_map="auto" so it offloads when VRAM runs tight.
Then it builds a chat prompt via the model's own tokenizer template - "Translate the following text into X. Output ONLY the translation, preserve all details and formatting" - and generates. The cleanup after generation is where it earns its keep, because raw chat output is never clean. It strips Translation:-style preambles, pulls the last element out of a JSON array if the model got cute, and when your target is Chinese it grabs only the lines that actually contain Chinese characters. Markdown like **bold** and --- survives the trip.
One behavior to know: the model stays loaded in memory once it's up, and only reloads when you switch models. That's great for batch work and a trap for your VRAM budget - see below.
The inputs that matter
There are only a few, and they're all in the required list:
- text - the thing to translate, a big multiline box. Feed it a prompt, a negative prompt, a chunk of a workflow's documentation, whatever.
- source_lang - defaults to
auto, which detects from the characters. Or pin it to 中文 / English / 日本語 / 한국어. - target_lang - the output language, default English.
- model_choice and custom_path - the dropdown of scanned models, or an absolute path that overrides the dropdown entirely.
- max_new_tokens (default 16384) and temperature (default 0) - temperature 0 means greedy decoding, so the same text gives the same result every time. Raise it toward 0.5 if you want the translator to be less literal.
The output is a single STRING that wires into anything that takes text: a prompt text field, a conditioning node, a prompt-enhancer chain, or just a text display so you can copy the result.
Install
Easy, and there's no model auto-download to worry about:
cd ComfyUI/custom_nodes
git clone https://github.com/aduanyue/ComfyUI_Qwen3_Translator_Node
cd ComfyUI_Qwen3_Translator_Node
pip install -r requirements.txt
Or use ComfyUI Manager and search Qwen3 Translator, then restart. The requirements are plain torch/transformers/accelerate plus sentencepiece and protobuf - nothing exotic, and ComfyUI's own torch install usually covers most of it. The heavy step is the model, which is on you to download (the node is deliberately offline):
huggingface-cli download Qwen/Qwen3-4B --local-dir ComfyUI/models/text_encoders/Qwen3-4B
Qwen3-4B is the sweet spot; Qwen3-8B is noticeably better but chunky. Both are Apache 2.0 from Alibaba, no license games.
Gotchas
- VRAM. A bfloat16 4B model is ~8GB, an 8B ~16GB, and it stays resident while it's loaded. On a 8–12GB card you'll want the 4B and probably a restart of ComfyUI after translating, or the diffusion model won't fit. Batch your translations rather than running them one at a time.
- Transformers version. Vision-language models need a recent-enough transformers to ship
Qwen3VLForConditionalGeneration, and Qwen3.5-type configs need transformers ≥ 4.58.0. The node checks this and gives you a clear upgrade message instead of a cryptic traceback - if you see it,pip install --upgrade transformersand (per its advice) setTRANSFORMERS_DISABLE_FINEGRAINED_FP8=1before restarting. - Partial downloads are the classic failure. The node actually verifies every shard listed in the model's safetensors index before loading and tells you exactly which files are missing, with the download command to fix it. A corrupted or half-finished download is the most common reason local model loads die, and it just tells you - the nicest touch in the pack.
- The usual LLM-node caveat. Like every custom node, this is arbitrary Python with full access to your OS, and LLM nodes in particular have been weaponized before. It's a small, open, readable pack - glance at the source before you trust it with anything.
One last distinction, because it trips people up: this is the Qwen3 that translates your text, not the frozen Qwen3 text encoder inside a checkpoint like Z-Image or Klein. Same model family, completely different job. The one in here runs before generation, on your hardware, and its whole job is making foreign-language workflows legible - for a huge slice of the ComfyUI world, that's the thing between you and a usable workflow.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| source_lang | COMBO | auto | 5 options: auto, 中文, English, 日本語, 한국어 |
| target_lang | COMBO | English | 4 options: 中文, English, 日本語, 한국어 |
| model_choice | COMBO | [自定义路径] | 1 options: [自定义路径] |
| custom_path | STRING | — | |
| max_new_tokens | INT | 163841024–32768 | — |
| temperature | FLOAT | 0.000–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |