Nodes/Region Edit Toolkit/图像分区 · 必填离线英译
ComfyUI Node

图像分区 · 必填离线英译

A SAM prompt translator that never touches the internet — and refuses to give you broken text

By Liu-Bot24·Created 2 months ago·Updated about a month ago· 1
图像分区 · 必填离线英译
    • sam_english_prompt
    textblack cable

    SAM takes text prompts in English, and if you're a Chinese speaker building a smart-removal workflow, typing "black cable" works fine - but wiring your Chinese instruction straight into SAM's text encoder does not. RegionEditRequiredOfflineEnglish is the toolkit's dedicated translator for that slot: it converts Chinese SAM prompts to English using the locally-installed Argos Translate model, passes English through unchanged, and - this is the important part - refuses to hand you output that's still half-Chinese.

    The behavior is deliberately strict, and that strictness is the feature. The single input is text (default "black cable"). If it's already English, it comes back untouched. If it's Chinese, the node runs it through the installed zh → en Argos model and validates the result: if the translation still contains CJK characters, or comes back empty, it raises a clear error instead of forwarding broken text. The source code spells out why - a SAM prompt that's still Chinese will make the segmentation model do unpredictable things, and a loud failure is strictly better than a silent garbage mask. It also raises if the text is empty, because this is the required variant: no text, no SAM object, no point running.

    Setup is where people stumble. requirements.txt installs the argostranslate package itself, but the actual Chinese-to-English language model is a separate download the pack won't fetch automatically (it never calls the network at runtime - the tooltip says so explicitly: "不会联网或下载模型"). You check and install the model with the pack's script, using the Python that ComfyUI actually runs:

    & "<ComfyUI Python>" scripts\install_argos_zh_en.py --check
    & "<ComfyUI Python>" scripts\install_argos_zh_en.py
    

    then restart ComfyUI. If you never use these translation nodes, skip the model entirely - the README says plainly you only need it for the offline-translation path. If you do use them and the model is missing, expect the node to raise "未找到已安装的中文→英文离线翻译模型" (no installed zh→en offline translation model) rather than silently failing.

    The output is a single sam_english_prompt string, which feeds directly into whatever SAM-based region detector you're using (the pack's smart-removal examples use SAM3). The name says "Required" because this node is for the mandatory SAM object - if you have an optional protection-object prompt that's allowed to be blank, that's the sibling node RegionEditOptionalOfflineEnglish, which adds a has_text boolean for pruning the branch.

    Install: ComfyUI Manager → search Region Edit Toolkit (registry ID native-region-tile-planner-merge), or git clone https://github.com/Liu-Bot24/ComfyUI-Region-Edit-Toolkit.git into custom_nodes, pip-install requirements.txt into ComfyUI's actual Python, restart. Then do the Argos model step above.

    Privacy-minded people will like this node: no API key, no network call, no Chinese text leaving your machine - it's the pack's answer to the cloud-translation habit, and it fits the offline-first philosophy of the whole toolkit. This pack is new enough that there's no community lore on edge cases, but the failure modes here are all blunt and self-explanatory: no model, no text, or untranslated output each raise a different, readable error.

    CategoryRegion Edit Toolkit/Text

    Inputs (1)

    NameTypeDefaultDescription
    textSTRINGblack cable中文会在节点内部离线翻译成英文;英文原样通过。不会联网或下载模型。

    Outputs (1)

    NameTypeDescription
    sam_english_promptSTRING