Hy-MT2 Translate 🌍 (GGUF)
Translate Your Prompt Without Booting Your Checkpoint Out of VRAM
- text
ComfyUI mostly speaks English. The booru tag vocabulary is English, most Civitai prompts are English, and the LLM-encoded bases that read your prompt as an instruction were trained on English instructions. If you write in Chinese, Japanese or German, you either hand your prompt to a browser tab or you bolt a chat model into the graph.
That second option has a cost the KB spells out: an LLM in a ComfyUI graph means budgeting memory for two models at once. Hy-MT2 Translate 🌍 (GGUF) is the cheap version of that bet. Tencent's Hy-MT2 translation model at 1.8B in Q4_K_M is 1.1GB on disk and around 1.4GB of VRAM, so it can sit in the graph while SDXL or Flux keeps the rest of the card.
What it actually is
A thin wrapper around llama-cpp-python running the GGUF quants from tencent/Hy-MT2-1.8B-GGUF and tencent/Hy-MT2-7B-GGUF. The dev is 1038lab - ComfyUI-QwenVL, JoyCaption, QwenTTS - one of the more prolific authors in ComfyUI's local-LLM corner, which is a decent signal it won't be abandoned in three weeks.
Mechanically: load the GGUF at n_ctx=8192 with full GPU offload, wrap your text in an instruction prompt, call create_chat_completion. Generation settings are baked in and match the ones Tencent documents on its own model card (temperature 0.7, top_p 0.6, top_k 20, repeat_penalty 1.05, 4096 max tokens). Output gets sanitized - <think> blocks, leaked <|hy_...|> tokens, code fences and stray assistant: prefixes stripped, because raw chat-model output is chat, not a prompt.
The real work is the syntax shielding. Anything in angle brackets (<lora:...>, <Picture 1>, <d>[French] "..."</d> dialogue blocks), [Shot ...] headers and __wildcards__ get swapped for <<TAGn>> placeholders before the model sees them and pasted back afterwards. Note (word:1.2) weights are not masked - only the words inside get translated. Text over 3000 characters is split on paragraph, then line, then sentence boundaries and reassembled.
The inputs that matter
Three dropdowns, a boolean and a text box. model is the preset or any local .gguf it can find. translate_style gives 14 options, each a real sentence injected into the prompt - AI Prompt / Visual Tags is the one for prompts, Anime & ACG for booru-adjacent work, Literary & Novel or Cinematic & Visual Arts for prose headed into an LTX or Wan shot. translate_to is Auto or one of 37 languages. text is the required STRING, and you can convert it to an input to feed it from another node. unload_after_run is off by default; turn it on if diffusion has to run right after.
One output: text. Wire it into CLIPTextEncode for a translate-and-generate graph, or into a save-text node for batch prompt conversion.
Install
ComfyUI Manager, search ComfyUI-Hy-MT2, or:
cd ComfyUI/custom_nodes
git clone https://github.com/1038lab/ComfyUI-Hy-MT2
Dependencies are llama-cpp-python, huggingface-hub and torch. Weights download themselves on the first run into models/LLM/GGUF from Hugging Face, falling back to ModelScope if HF is unreachable - so expect a quiet minute and a console progress bar rather than an error. 1.1GB for the default, 7.5GB if you go for a 7B Q8.
Where people get burned
Auto is not language detection. Text containing CJK, kana, hangul, Cyrillic, Arabic or Thai characters goes to English; everything else goes to Chinese. A French or Spanish prompt sails past Auto and comes back in Mandarin. Set the language explicitly unless you're doing the CN⇄EN dance.
A CPU-only llama-cpp-python will silently "work". Plain pip install llama-cpp-python compiles without CUDA unless you point it at a prebuilt wheel index or set CMAKE_ARGS=-DGGML_CUDA=on. The node's gpu_layers=-1 then becomes decoration, and a paragraph takes minutes.
The model stays resident. It's cached while the model choice is unchanged, so your card is ~1.4GB lighter than you remember. unload_after_run flushes Comfy's cache and calls torch.cuda.empty_cache() - the polite thing to do before a 14B video model.
Long pastes get reformatted. Chunks are rejoined with blank lines, so single-spaced paragraphs can come back spaced differently, and terminology drifts between chunks because each one is translated cold.
Local files are filtered by name. The scanner only lists GGUFs with "hy" and "mt" in the filename (or under a hy-mt/hymt path). Rename one and it vanishes from the dropdown.
Skip the STQ files. The 440MB 1.25-bit and 600MB 2-bit Hy-MT2 GGUFs aren't in the preset list on purpose - they need a custom llama.cpp build with Tencent's STQ kernel, and unmodified you get tensor decoding errors.
What I'd actually run
Keep Hy-MT2-1.8B-Q4_K_M. It's the default for a reason, and for a 40-word prompt the 7B isn't worth 5GB of VRAM - step up to Hy-MT2-7B-Q6_K only for long prose or literary text where you can feel the difference. Tencent's card claims 33 languages while the dropdown offers a couple more, so if one comes back odd, that's why.
Finally, the honest caveat the KB would raise: this is arbitrary Python with full OS access that downloads its own weights on first run - exactly the shape of node that got the ecosystem burned once. This one is a single readable file from a pack author with a track record. Read it anyway. The one pleasant surprise: unlike almost everything else Tencent ships, these GGUF repos are Apache-2.0, not the Hunyuan community license that excludes the EU, UK and South Korea.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| model | COMBO | Hy-MT2-1.8B-Q4_K_M.gguf (1.1 GB) | Hy-MT2 GGUF model. |
| translate_style | COMBO | Default | Target translation style. |
| translate_to | COMBO | Auto | Target language. Auto translates non-English to English and English to Chinese. |
| text | STRING | Text to translate. | |
| unload_after_run | BOOLEAN | false | Unload model from VRAM after translation. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |