Nodes/ComfyUI_kkTranslator_nodes/LoadMarianMTCheckPoint
ComfyUI Node

LoadMarianMTCheckPoint

The model loader behind offline prompt translation — pick your language pair

By kingzcheung·Created 3 years ago·Updated about a year ago· 24
LoadMarianMTCheckPoint
    • model
    • tokenizer
    checkpointopus-mt-zh-en

    The downloader half of the translation duo

    LoadMarianMTCheckPoint does exactly one job: it loads a Helsinki-NLP OPUS-MT translation model into your ComfyUI graph so PromptTranslateToText has something to translate with. It's the Load Checkpoint of the prompt-translation world - you pick a model from a dropdown, it pulls the weights, and out come the two objects the translate node needs. On its own it does nothing; wired to PromptTranslateToText, it's what makes offline, no-API prompt translation possible.

    The models are from Helsinki-NLP's OPUS-MT family on HuggingFace: small, per-language-pair transformer models that run fine on CPU. You pick the pair that matches your source language → English, and the whole thing becomes a genuinely local translate button.

    How it works

    It's a thin wrapper around HuggingFace's MarianTokenizer.from_pretrained and MarianMTModel.from_pretrained, pointed at Helsinki-NLP/<your checkpoint>. On the first use of a given pair, it downloads the weights into your HuggingFace cache; after that it reads from disk. Worth knowing: there's no ComfyUI-level model cache here, so the model gets re-instantiated every time you run the workflow. For these small models that's a second or two, not a problem - just don't expect it to be free on every queue run.

    The input and outputs

    One input, ten choices:

    • checkpoint - a dropdown hardcoded to ten Helsinki pairs: opus-mt-zh-en, opus-mt-rn-en, opus-mt-taw-en, opus-mt-az-en, opus-mt-ru-en, opus-mt-ja-en, opus-mt-en-zh, opus-mt-en-ru, opus-mt-en-jap, and opus-mt-en-rn. Default is zh-en (Chinese → English), which tells you the pack's audience.

    Outputs are model (MODEL) and tokenizer (TOKENIZER) - feed both into PromptTranslateToText. These types are pack-specific; nothing else in ComfyUI produces or consumes them.

    The choice matters more than you'd think. zh-en is the obvious one, but notice the oddballs: rn-en is Kirundi, taw-en is Thai, az-en is Azerbaijani. Someone clearly added pairs they personally needed. If your language isn't in the list - Turkish, German, Spanish, most of the world - you're stuck, because unlike the Baidu node there's no arbitrary-language path here.

    Installing it

    Same pack install as everything else:

    cd ComfyUI/custom_nodes
    git clone https://github.com/AIGCTeam/ComfyUI_kkTranslator_nodes
    python -m pip install -r requirements.txt
    

    Restart ComfyUI. Or just use ComfyUI Manager and search ComfyUI_kkTranslator_nodes. The pack also ships a ready-made marian_mt_workflow.json - drag it onto the canvas to see the whole thing wired up, then tweak the checkpoint to your pair.

    The gotchas

    The big one is the "works offline" claim. It only works offline after the first download. The initial load of each checkpoint fetches hundreds of MB from HuggingFace, and if you're in mainland China, HuggingFace is unreachable without the mirror the pack's Chinese README documents:

    HF_ENDPOINT=https://hf-mirror.com python main.py
    

    Second: the dropdown is hardcoded, and the author's commented-out code shows the original plan was to let you load from a local models folder instead. That never shipped, so adding a pair (say opus-mt-tc-big-tr-en, which the community recommends for Turkish) means editing marian_list in nodes.py. Annoying but easy - the list is right at the top of the file.

    Third: transformers is pinned to 4.26.1, an ancient version. It's the most common source of "this pack broke my other nodes" reports, because anything newer than that can clash with it. It's a small pack with a simple job - just budget for these quirks and it does the job quietly.

    CategorykkTranslator

    Inputs (1)

    NameTypeDefaultDescription
    checkpointCOMBOopus-mt-zh-en10 options: opus-mt-zh-en, opus-mt-rn-en, opus-mt-taw-en, opus-mt-az-en, opus-mt-ru-en, opus-mt-ja-en, +4

    Outputs (2)

    NameTypeDescription
    modelMODEL
    tokenizerTOKENIZER