Nodes/ComfyUI_RWKV_Studio/RWKV Translator
ComfyUI Node

RWKV Translator

English ⇄ Chinese Translation in Your Graph — No API Key, No Cloud

By No-22-Github·Created 11 months ago·Updated 11 months ago· 0
RWKV Translator
    • translated_text
    model_path
    direction
    text_to_translateWelcome use RWKV series models. Beyond Transformer!

    Every so often you want the prompt you just wrote in English handed back in Chinese (or the reverse) - for a bilingual workflow, a prompt you're about to post, or just to see what a model thinks your words mean. RWKV Translator does exactly that, on a real language model, on your own machine. The name isn't lying about the API: there's no API, no key, no network involved at all.

    It's the workhorse of ComfyUI_RWKV_Studio, a small pack for running RWKV-7 models inside a ComfyUI graph. Feed it any RWKV-7 checkpoint and your text; it wraps the text in a fixed prompt template and generates a translation. Note that this isn't a fine-tuned translation model - it's a general multilingual LLM being pointed at a translation task. That's about the right amount of engineering for "translate my prompt," and a lot less than wiring up a separate translation service.

    How it works

    The node uses the official rwkv pip package from the RWKV-LM project. You pass in a model_path (a path to a .pth checkpoint), it builds an RWKV model with a cuda fp16 / cpu fp16 strategy and constructs the tokenizer from the bundled rwkv_vocab_v20230424. For en2zh it builds the prompt English: <text>\n\nChinese: and generates until the end token; zh2en mirrors it. Sampling is hardcoded - temperature 1.0, top-p 0, a 4096-token context window - so there are no quality sliders to fiddle with. Models are cached in memory per path, so the second translation of a session is fast; the first one pays the weight-load cost.

    The inputs that matter

    • model_path (STRING, forceInput): wire it from the pack's RWKV Model Loader. This is where the real loading happens, so it's the slow node in the chain.
    • direction: en2zh or zh2en. Self-explanatory.
    • text_to_translate (multiline): the string to translate.
    • translated_text (STRING, output): wire it into any string input - a CLIP text encode, a text box, a display node, even the input of another LLM node.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/No-22-Github/ComfyUI_RWKV_Studio
    

    Or just search "ComfyUI_RWKV_Studio" in ComfyUI Manager. Restart, then install the one dependency into ComfyUI's Python environment: pip install rwkv (it's the entire requirements.txt). Drop an RWKV-7 "Goose" checkpoint - the multilingual "World" one, needed for Chinese - into ComfyUI/models/RWKV; the .pth files live on Hugging Face. This node handles any V7 size, though the 0.1B is the sweet spot for a translation side-quest.

    Where people get burned

    • Don't expect GPU speed. The pack's __init__.py sets RWKV_CUDA_ON=0 before importing anything, so the rwkv package's CUDA path is disabled even on a GPU box - this node is effectively CPU-bound. The separate "DE (CUDA)" node in the same pack exists partly because of this.
    • Failures come back as text, not errors. If the model path is wrong or the file is missing, you don't get a popup - the output string reads Translation failed: .... Fine once you know it, confusing the first time.
    • V7 only. The pack forces RWKV_V7_ON=1, so older RWKV-6 checkpoints won't load here.

    Honest take: this is a niche utility, not an LLM workstation. For serious text work you'd reach for a proper LLM node pack. But for "translate this prompt, locally, in the graph," it does the job with one dependency and one model file - and that's a genuinely nice thing to have in a workflow.

    CategoryRWKV_Studio

    Inputs (3)

    NameTypeDefaultDescription
    model_pathSTRING
    directionCOMBO2 options: en2zh, zh2en
    text_to_translateSTRINGWelcome use RWKV series models. Beyond Transformer!

    Outputs (1)

    NameTypeDescription
    translated_textSTRING