Translator
Translate your prompt locally, no API and no key
- model
- string
The name sounds like it phones home to Google Translate. It doesn't. UL_Translator runs a translation model locally - no API, no key, no network call once the model's downloaded - and hands back the translated string. It's the working half of the pack's translation pair: UL_TranslatorLoader loads the model, this node feeds text through it.
Why it's here: AnyText's world is often Chinese, but the SD 1.5 checkpoints under it respond best to English prompts. Rather than translating your prompt in a browser tab and pasting it back, you drop this node in the graph and the translation happens inline, every run, offline.
How it works
You connect a loaded TRANSLATE_MODEL, type or wire in a string, and set the source and target languages. The node runs the text through the model and returns the result as a STRING you can route into a prompt input. Both language dropdowns list 22 options - Chinese (Simplified and Traditional), Yue/Cantonese, Tibetan, Japanese, Korean, Spanish, Russian, Arabic, French, German and more - though which pairs actually work depends on the model you loaded. The lightweight default T5 covers English/Russian/Chinese; if you picked an NLLB model in the loader, the broader list comes alive.
The inputs and outputs that matter
model(TRANSLATE_MODEL) - fromUL_TranslatorLoader. Required; this node has no model of its own.string(multiline STRING) - the text to translate. Wire it from a prompt node or type directly.src_language/tgt_language- from and to. Set these to a pair your loaded model actually supports; a mismatch is the usual cause of junk output.max_new_tokens(default 512) - the length cap on the translation. Long prompts can get truncated if this is too low; bump it for paragraph-length text.use_fast(default off) - use the fast tokenizer. Leave off unless a specific model complains.keep_model_loaded/keep_model_device- hold the translator in memory / on device between runs. On is convenient; off frees VRAM if you're tight.
Output is a single string (STRING) - the translated text.
How to install it
Ships with the pack. ComfyUI Manager, search ComfyUI_Anytext, or:
cd ComfyUI/custom_nodes
git clone https://github.com/zmwv823/ComfyUI_Anytext
then restart. The translation model itself is loaded by UL_TranslatorLoader (into ComfyUI/models/prompt_generator); this node needs no separate download.
Common issues & troubleshooting
Output is garbage or unchanged. Almost always a language-pair problem. The 22-entry dropdowns are the same regardless of model, but a given model only handles some pairs - the small T5 does EN/RU/ZH and not much else. Match src_language/tgt_language to what you loaded, or load an NLLB model for wider coverage.
Long prompt gets cut off. Raise max_new_tokens. The 512 default is fine for a sentence, thin for a paragraph.
Nothing runs. Check the model wire from UL_TranslatorLoader - without a loaded model, this node has nothing to translate with.
Do I even need translation? If AnyText encodes your Chinese directly (via the miaobi_clip option on the loader), you can skip translating the rendered text - you only want to translate the scene prompt into English for the base checkpoint's benefit. Keep the two separate in your head: the text you're drawing versus the prompt describing the picture around it.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| model | TRANSLATE_MODEL | — | |
| string | STRING | — | |
| src_language | COMBO | For nllb. | |
| tgt_language | COMBO | For nllb、t5. | |
| max_new_tokens | INT | 5120–18446744073709550000 | For mt5、nllb. |
| use_fast | BOOLEAN | false | For nllb. |
| keep_model_loaded | BOOLEAN | true | Warning: do not delete model unless this node no longer needed, it will try release device_memory and ram. if checked and want to continue node generation, use ComfyUI-Manager `Free model and node cache` to reset node state or change parameter in Loader node to activate. 注意:仅在这个节点不再需要时删除模型,将尽量尝试释放系统内存和设备专用内存。如果删除后想继续使用此节点,使用ComfyUI-Manager插件的`Free model and node cache`重置节点状态或者更换模型加载节点的参数来激活。 |
| keep_model_device | BOOLEAN | true | Keep model in comfy_auto_unet_offload_device (HIGH_VRAM: device, Others: cpu) or device_memory after generation. 生图完成后,模型转移到comfy自动选择设备(HIGH_VRAM: device, 其他: cpu)或者保留在设备专用内存上。 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| string | STRING | — |