Translation
Transformers
PyTorch
English
Hindi
viuai
viutranslate
sarus-500m
nmt
english-to-hindi
hindi-to-english
indic
devanagari
bfloat16
zero-synthetic
Instructions to use ViuAI/ViuTranslate with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ViuAI/ViuTranslate with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "translation" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("translation", model="ViuAI/ViuTranslate")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ViuAI/ViuTranslate", device_map="auto") - Notebooks
- Google Colab
- Kaggle
| license: apache-2.0 | |
| language: | |
| - en | |
| - hi | |
| tags: | |
| - viuai | |
| - viutranslate | |
| - sarus-500m | |
| - translation | |
| - nmt | |
| - english-to-hindi | |
| - hindi-to-english | |
| - indic | |
| - devanagari | |
| - bfloat16 | |
| - pytorch | |
| - zero-synthetic | |
| datasets: | |
| - cfilt/iitb-english-hindi | |
| - ai4bharat/samanantar | |
| pipeline_tag: translation | |
| library_name: transformers | |
| inference: false | |
| <div align="center"> | |
| # 🌐 ViuTranslate-500M | |
| ### *High-Performance English ↔ Hindi Neural Machine Translation Foundation Model* | |
| [](https://opensource.org/licenses/Apache-2.0) | |
| [](#-model-specifications) | |
| [](#-model-specifications) | |
| [](https://huggingface.co/datasets/ViuAI/ViuTranslate-Data) | |
| [](#-translation-capabilities) | |
| [](#-zero-synthetic-data-guarantee) | |
| [**🌐 ViuAI Studio**](https://github.com/ViuAI) | [**📚 Translation Dataset**](https://huggingface.co/datasets/ViuAI/ViuTranslate-Data) | [**📐 Architecture**](#-model-specifications) | [**⚡ Quickstart**](#-quickstart--inference) | [**🚀 5090 Runner**](#-training-on-rtx-5090) | |
| --- | |
| </div> | |
| ## 📌 Introduction | |
| **ViuTranslate-500M** is a production-grade bilingual Neural Machine Translation (NMT) foundation model developed by **ViuAI**. Built on the custom **Sarus-500M** decoder-only transformer architecture, it is engineered specifically for fluid, high-fidelity bidirectional translation between **English and Hindi (Devanagari)**. | |
| Unlike general-purpose conversational LLMs that frequently inject conversational fluff, unsolicited commentary, or mathematical reasoning hallucinations, **ViuTranslate-500M** is optimized purely for deterministic, end-to-end translation with native-speaker fluency. | |
| --- | |
| ## 🌟 Key Capabilities & Highlights | |
| 1. **⚡ Google-Translate Style Direct Input**: | |
| * Accepts raw, untagged sentences directly. Input plain English to receive pure Hindi; input plain Hindi to receive pure English. | |
| 2. **💬 Command / Instruction Mode Support**: | |
| * Seamlessly handles explicit prompts (e.g., `Translate to Hindi: ...` and `Translate to English: ...`). | |
| 3. **🛡️ Zero Synthetic Data Guarantee**: | |
| * Trained exclusively on authentic, human-verified parallel corpora from top research institutions (**CFILT IIT Bombay** and **AI4Bharat Samanantar**). Zero synthetic, template-generated, or LLM-distilled text. | |
| 4. **🔤 100% Devanagari Unicode Coverage**: | |
| * Custom 64,003-vocab byte-fallback BPE tokenizer ensures **exactly 0 `<unk>` tokens** across standard benchmark corpora. | |
| 5. **🚀 Ultra-Low Latency & Edge-Ready**: | |
| * Sub-15ms generation per sentence on modern GPUs (RTX 5090, RTX 4090, A100, T4) with efficient Grouped Query Attention (GQA). | |
| --- | |
| ## 📐 Model Specifications | |
| | Parameter | Specification | Details | | |
| | :--- | :--- | :--- | | |
| | **Model Name** | **ViuTranslate-500M** | *ViuAI Translation Engine* | | |
| | **Base Architecture** | **Sarus-500M** | Decoder-only Autoregressive Transformer | | |
| | **Total Parameters** | **500,642,560** (~500M) | Optimal size for high translation density & fast inference | | |
| | **Hidden Dimension ($d_{\text{model}}$)** | **1280** | Latent semantic space | | |
| | **Transformer Layers** | **24** | Balanced depth for deep bilingual representations | | |
| | **Attention Heads** | **20 Query / 4 KV Heads** | Grouped Query Attention (GQA 5:1 ratio) | | |
| | **Intermediate Size (FFN)** | **3456** | SwiGLU non-linear projection | | |
| | **Vocabulary Size** | **64,003** | Byte-fallback BPE with full Devanagari coverage | | |
| | **Context Length** | **2048 Tokens** | Rotary Positional Embeddings (RoPE, $\theta = 10,000$) | | |
| | **Normalization** | **RMSNorm** | Root Mean Square Layer Normalization ($\epsilon = 10^{-6}$) | | |
| | **Precision** | **BFloat16 / FP16** | Native Blackwell, Ada Lovelace, Ampere support | | |
| --- | |
| ## 📚 Training Corpus & Provenance | |
| The model is trained on the curated dataset hosted at [**`ViuAI/ViuTranslate-Data`**](https://huggingface.co/datasets/ViuAI/ViuTranslate-Data): | |
| | Dataset Source | Contributing Institution | Curated Pairs | Description | | |
| | :--- | :--- | :--- | :--- | | |
| | **IIT Bombay English-Hindi Corpus** | CFILT, IIT Bombay | **50,000** | Gold-standard academic corpus covering news, judicial, and literature | | |
| | **AI4Bharat Samanantar** | IIT Madras / AI4Bharat | **50,000** | Large-scale verified Indian language web & publication texts | | |
| | **IIT Bombay Benchmark Test Set** | CFILT, IIT Bombay | **2,502** | Standardized international evaluation test suite | | |
| | **Total Curated Dataset** | — | **102,502 Pairs** | **13.6 Million Active Training Tokens** | | |
| ### 🛡️ Mathematical Quality Guardrails: | |
| * **Length Ratio Bound:** Enforced $0.40 \le \frac{\text{len(en)}}{\text{len(hi)}} \le 2.40$ to eliminate truncated pairs. | |
| * **Script Purity:** Minimum 50% Latin characters on English side; minimum 40% Devanagari characters ($[\u0900-\u097F]$) on Hindi side. | |
| * **Hygiene Sanitization:** 100% stripped of HTML tags, XML entities, programming code blocks, and URLs. | |
| * **Bidirectional Augmentation:** Trained in both Direct Mode and Command Mode in both directions ($EN \leftrightarrow HI$). | |
| --- | |
| ## 🚀 Quickstart & Inference | |
| ### 1. Installation | |
| ```bash | |
| pip install torch tokenizers huggingface_hub | |
| ``` | |
| ### 2. Standalone Python Inference | |
| ```python | |
| import torch | |
| from tokenizers import Tokenizer | |
| from huggingface_hub import hf_hub_download | |
| # Download model code and tokenizer | |
| repo_id = "ViuAI/ViuTranslate" | |
| tok_path = hf_hub_download(repo_id=repo_id, filename="tokenizer.json") | |
| config_path = hf_hub_download(repo_id=repo_id, filename="config.py") | |
| model_path = hf_hub_download(repo_id=repo_id, filename="model.py") | |
| # Import architecture | |
| import sys, os | |
| sys.path.insert(0, os.path.dirname(config_path)) | |
| from config import ViuAIConfig | |
| from model import ViuAI | |
| device = torch.device("cuda" if torch.cuda.is_available() else "cpu") | |
| tokenizer = Tokenizer.from_file(tok_path) | |
| cfg = ViuAIConfig(vocab_size=64003, context_length=2048) | |
| model = ViuAI(cfg).to(device) | |
| # Load weights (supports base checkpoint or fine-tuned weights) | |
| try: | |
| ckpt_path = hf_hub_download(repo_id=repo_id, filename="viutranslate_final.pt") | |
| except Exception: | |
| ckpt_path = hf_hub_download(repo_id="ViuAI/ViuAI-500M", filename="checkpoints/ckpt_latest.pt") | |
| state = torch.load(ckpt_path, map_location=device, weights_only=False) | |
| model.load_state_dict(state.get("model_state_dict", state), strict=False) | |
| model.eval() | |
| def translate(text: str) -> str: | |
| prompt = f"<|user|>\n{text.strip()}<|endofturn|>\n<|assistant|>\n" | |
| inp = torch.tensor([tokenizer.encode(prompt).ids], device=device) | |
| with torch.no_grad(): | |
| out = model.generate(inp, max_new_tokens=128, temperature=0.2, top_p=0.9, eos_token_id=64002) | |
| return tokenizer.decode(out[0][inp.shape[1]:].tolist()).replace("<|endofturn|>", "").strip() | |
| # Examples | |
| print("EN -> HI:", translate("Consistency and discipline are the keys to long term success.")) | |
| print("HI -> EN:", translate("सूरज पूर्व में उगता है और पश्चिम में डूबता है।")) | |
| ``` | |
| --- | |
| ## 🏋️ Training on RTX 5090 (32GB) | |
| Run the ultra-optimized 1-click training launcher directly from your terminal: | |
| ```bash | |
| # Download and launch runner | |
| curl -O https://huggingface.co/ViuAI/ViuTranslate/raw/main/runners/run_5090.py | |
| python run_5090.py | |
| ``` | |
| * **Target Hardware:** NVIDIA GeForce RTX 5090 (32GB VRAM, Blackwell Architecture) | |
| * **Configuration:** `micro_batch=32`, `grad_accum=2` (Effective Batch = 64), `bfloat16` | |
| * **Speed:** ~100,000 tokens/sec (~6.5 minutes for full 100K training run) | |
| --- | |
| ## 📁 Repository Structure | |
| ``` | |
| ViuAI/ViuTranslate | |
| ├── README.md # Official Model Card & Documentation | |
| ├── config.py # Sarus-500M Architecture Config | |
| ├── model.py # PyTorch Transformer Definition | |
| ├── tokenizer.json # 64,003 Byte-Fallback Tokenizer | |
| ├── tokenizer_config.json # Fast Tokenizer Configuration | |
| ├── special_tokens_map.json # Turn & Separation Tokens | |
| ├── generation_config.json # Recommended Decoding Parameters | |
| │ | |
| ├── scripts/ # Modular Pipeline Scripts | |
| │ ├── train.py # High-Throughput SFT Training Engine | |
| │ ├── inference.py # Interactive CLI Translation Console | |
| │ └── evaluate.py # BLEU / chrF++ Benchmark Evaluator | |
| │ | |
| └── runners/ # 1-Click Hardware Launchers | |
| ├── run_5090.py # RTX 5090 Ultra-Fast Launcher | |
| └── run_kaggle.py # Kaggle GPU T4 Launcher | |
| ``` | |
| --- | |
| ## 📜 Citation & Reference | |
| ```bibtex | |
| @misc{viutranslate2026, | |
| author = {ViuAI Research Team}, | |
| title = {ViuTranslate-500M: High-Performance English-Hindi Neural Machine Translation Foundation Model}, | |
| year = {2026}, | |
| publisher = {Hugging Face}, | |
| journal = {Hugging Face Model Hub}, | |
| howpublished = {\url{https://huggingface.co/ViuAI/ViuTranslate}} | |
| } | |
| ``` | |