Nodes/comfyui-hymt2/Hy-MT2 Translate
ComfyUI Node

Hy-MT2 Translate

The node that makes local translation feel like a feature

By aadebuger·Created 3 months ago·Updated 3 months ago· 0
Hy-MT2 Translate
  • model
  • translation
source_text今天天气真好。
target_langEnglish
prompt_langen
temperature0.70
top_p0.60
top_k20
repetition_penalty1.05
max_new_tokens4096
seed-1
terminology
target_style
background_text

Hy-MT2 Loader does the heavy lifting, but this is the node you actually get your text back from. HyMT2Translate takes a string, translates it into one of 38 languages on your own GPU, and hands you the result - no API call, no subscription, no per-character invoice at the end of the month. If you've ever bounced between Google Translate and an LLM chat to localize a prompt, captions, or subtitles, this is the version that stays inside the graph.

Where does it sit in a workflow? The KB frames LLM-as-a-node as a tool running before or alongside generation, and translation is the cleanest example of that pattern: text in, text out, no diffusion involved. Concretely, people wire it up to translate a prompt into the language a checkpoint's training data favors, or to localize a caption stream before it hits a text-overlay node. Since the model runs locally, private or weird content never leaves your box - the same reason anyone runs a local LLM worker instead of an API.

How it works

The node takes the HYMT2_MODEL socket from HyMT2Loader, builds one of Hy-MT2's seven prompt templates (in English or Chinese form), and runs the model with the sampling settings you choose. The templates are the interesting part: beyond a plain default, there's terminology-guided, style-controlled, and background-aware translation. Precedence when multiple are set is background_text > target_style > terminology > default. The default sampling values - temperature 0.7, top_p 0.6, top_k 20, repetition penalty 1.05 - are straight from the model card for the 1.8B and 7B sizes.

The inputs that matter

  • source_text - the text to translate. Multiline, so paste whole paragraphs.
  • target_lang - defaults to English. The dropdown is big (76 entries) because every one of the 38 languages appears under both its English and Chinese name. Match it to prompt_lang: English names with prompt_lang=en, Chinese names with prompt_lang=zh.
  • terminology (optional) - a glossary that pins specific words. One pair per line, separated by =>, ->, |, or a tab; lines starting with # are ignored. This is the feature that makes it usable for technical docs:
    # tech terms
    API => 接口
    endpoint => 端点
    
  • target_style (optional) - a free-text style descriptor like 正式书面语 or casual colloquial.
  • background_text (optional) - a context paragraph so the model can disambiguate references and tone.

Leave the sampling sliders alone unless you have a reason. The one exception is baked into the top_k tooltip: the 30B-A3B model card recommends top_k=-1 (disabled), so if you swap the loader's model_path to the 30B variant, set top_k=-1, top_p=1.0, and repetition_penalty=1.0 - and plan for ~60 GB of VRAM in bf16, or use the FP8 checkpoint on a 24 GB card.

The output

translation, a plain STRING. Wire it into any text display node (rgthree or WAS "Show Text"), into a prompt field, or down to a file saver. It's not an output node itself, so it won't render anything on its own - you decide what happens to the text.

Installing and the one real gotcha

Same story as the loader: ComfyUI Manager, search "Hy-MT2", or the manual route:

cd ComfyUI/custom_nodes
git clone https://github.com/aadebuger/ComfyUI-HyMT2.git
cd ComfyUI-HyMT2 && ./scripts/install_deps.sh

then restart. The gotcha is the pack's transformers>=5.6.0 requirement, which conflicts with nodes pinning transformers==4.57.3 (Qwen3TTS, Sonic, some VibeVoice forks) - the README's fix is a second ComfyUI instance on a different port. If translations come back odd, your most likely culprits are a prompt_lang/language-name mismatch or a first-run download that made you think the node hung. The model is real and recent - Hy-MT2 only landed in May 2026, so the community hasn't stress-tested this pack much yet. It's new; treat it as new.

CategoryHyMT2

Inputs (13)

NameTypeDefaultDescription
modelHYMT2_MODEL
source_textSTRING今天天气真好。
target_langCOMBOEnglish76 options: Chinese, English, French, Portuguese, Spanish, Japanese, +70
prompt_langCOMBOen2 options: en, zh
temperatureFLOAT0.700–2
top_pFLOAT0.600–1
top_kINT20-1–200Use -1 to disable (the 30B-A3B model card recommends top_k=-1).
repetition_penaltyFLOAT1.050.5–2
max_new_tokensINT409616–16384
seedINT-1-1–4294967295-1 = no fixed seed.
terminologyoptSTRINGOptional glossary. One pair per line. Separators: '=>', '->', '|', or tab. Lines starting with '#' are ignored. Example: API => 接口 endpoint => 端点
target_styleoptSTRINGOptional style descriptor (e.g. '正式书面语', 'casual colloquial').
background_textoptSTRINGOptional background paragraph to disambiguate the translation.

Outputs (1)

NameTypeDescription
translationSTRING