ComfyUI Extension: ComfyUI-TranslationNode

Authored by petr-pr

Created

Updated

0 stars

Offline translation node for ComfyUI, powered by Facebook's M2M-100 multilingual model. Translate text between 100+ languages β€” completely offline and private.

Custom Nodes (0)

    README

    🈯 ComfyUI Translation Node (Offline)

    Offline translation node for ComfyUI, powered by Facebook's M2M-100 multilingual model. Translate text between 100+ languages β€” completely offline and private.

    πŸš€ Features

    • 🌍 Translate between 100+ languages
    • 🧠 Automatic source language detection
    • ⚑ Works entirely offline once the model is downloaded
    • 🧩 Seamless integration with text/image/video workflows in ComfyUI
    • πŸ’Ύ Cached model for faster reuse

    πŸ› οΈ Installation

    1. Copy or clone this repository into your ComfyUI custom nodes folder:
      ComfyUI/custom_nodes/ComfyUI-TranslationNode/
      
    2. Install dependencies:
      pip install -r requirements.txt
      
    3. Prepare the model files (see the next section).
    4. Restart ComfyUI and look for 🈯 Translation Node (Offline) under the Text category.

    🧱 Local Model Setup

    This node uses Facebook’s M2M-100 (418M) multilingual translation model.

    1. Download the model manually from Hugging Face: πŸ”— https://huggingface.co/facebook/m2m100_418M
    2. Create the following folder structure inside your ComfyUI installation:
      ComfyUI/
      β”œβ”€β”€ custom_nodes/
      β”‚   └── ComfyUI-TranslationNode/
      └── models/
          └── translation/
              └── facebook/
                  └── m2m100_418M/
      
    3. Place all downloaded files into that final folder (m2m100_418M/):
      pytorch_model.bin
      rust_model.ot
      config.json
      source.spm
      target.spm
      tokenizer_config.json
      special_tokens_map.json
      
    4. When you launch ComfyUI, you should see this in the console:
      [TranslationNode] Using local model: models/translation/facebook/m2m100_418M
      

    βœ… Once the model is in place, the node will never download anything β€” it will always load from your local drive.

    πŸ’‘ Usage

    1. Add the Translation Node to your workflow.
    2. Enter any text you want to translate.
    3. Choose a target language (default: en).
    4. The source language can be set to auto for automatic detection.
    5. Connect the output (translated_text) to other nodes β€” for example, to an image generation prompt.
    6. Enjoy entering prompts in your own language β€” the node will handle the translation automatically!

    🧠 Model Details

    • Model: facebook/m2m100_418M
    • Type: Multilingual encoder-decoder transformer
    • Languages supported: 100+
    • Size on disk: ~3.6 GB (pytorch_model.bin ~1.8 GB, rust_model.ot ~1.8 GB)
    • Framework: PyTorch via Hugging Face Transformers

    πŸ”’ Privacy & Security

    This node runs entirely offline.

    • 🧩 All translations are processed locally on your computer.
    • πŸ’Ύ The model is loaded from ComfyUI/models/translation/facebook/m2m100_418M.
    • 🚫 No text, metadata, or user data is ever sent to external servers or APIs.
    • πŸ” Safe to use with confidential or private content.
    • πŸ”Œ Once installed, you can use it without any internet connection.

    βš™οΈ Requirements

    transformers>=4.41.0
    sentencepiece
    torch
    langdetect
    

    πŸ‘€ Author

    Petr ProvaznΓ­k – 2025

    πŸ“„ License

    MIT License Β© 2025
    Created for the ComfyUI community.