A fail-safe translation node designed for ComfyUI that primarily utilizes Google Translate. In cases where Google is inaccessible or encounters rate limits, it seamlessly switches to local CPU-based translation models without requiring external services or API keys.
- Primary Google Integration: The tool prioritizes Google Translate for its speed and efficiency, ensuring quick translations under normal circumstances.
- Local CPU Fallback: It provides a backup translation mechanism using lightweight Marian/OPUS models that run on the CPU, enabling translations even when external services fail.
- Efficient Resource Management: The tool intelligently manages memory and caching, ensuring that only the most recent models are kept in RAM while others are stored on disk, optimizing performance.
Context
This tool functions as a translation node within the ComfyUI framework, offering a reliable method for translating text. Its primary role is to ensure that users can continue to receive translations even when the primary Google service is unavailable, thereby enhancing the robustness of text processing tasks.
Key Features & Benefits
The fail-safe translate node includes several practical features that enhance its utility:
- Google First Approach: It uses Google Translate as the default method, providing fast and reliable translations.
- Local CPU Models: When Google fails or is rate-limited, it can automatically switch to local models for specified languages, ensuring continuity in translation.
- Configurable Cache and Cooldown: Users can adjust settings for caching translations and managing cooldown periods after receiving errors from Google, which helps avoid excessive requests.
Advanced Functionalities
The node includes advanced capabilities such as:
- Automatic Language Detection: While it primarily uses Google for language detection, if that fails, it defaults to a specified language for local translations.
- Lazy Model Downloading: Models are only downloaded when needed, which conserves bandwidth and storage until a specific language is required for translation.
- Process-Wide Caching: Successful translations are cached, allowing for quick access to previously translated text without the need to reprocess it.
Practical Benefits
This tool significantly enhances the workflow within ComfyUI by providing a reliable fallback for translations. It reduces downtime when external services are unavailable, maintains efficiency through intelligent resource management, and ensures that users can continue their projects without interruption.
Credits/Acknowledgments
The tool is developed by contributors to the ComfyUI community, utilizing open-source models from Hugging Face. Most models used are licensed under Apache-2.0, while specific models may have different licenses (e.g., CC-BY-4.0), ensuring compliance with open-source standards.




