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
File size: 9,483 Bytes
0ce4742 78688bc 0ce4742 78688bc 0ce4742 1c2b8fd 78688bc 0ce4742 1c2b8fd 0ce4742 78688bc 0ce4742 78688bc 1c2b8fd 78688bc 0ce4742 78688bc 1c2b8fd 78688bc 1c2b8fd 78688bc 1c2b8fd 78688bc 0ce4742 78688bc 0ce4742 1c2b8fd 78688bc 1c2b8fd 78688bc 1c2b8fd 78688bc 1c2b8fd 78688bc 0ce4742 1c2b8fd 0ce4742 78688bc 1c2b8fd 78688bc 0ce4742 78688bc 0ce4742 78688bc 1c2b8fd 78688bc 1c2b8fd 0ce4742 1c2b8fd 78688bc 1c2b8fd 0ce4742 1c2b8fd 78688bc 1c2b8fd 0ce4742 78688bc 1c2b8fd 78688bc 1c2b8fd 78688bc 1c2b8fd 78688bc 1c2b8fd 78688bc 1c2b8fd 78688bc 0ce4742 78688bc 1c2b8fd 78688bc 1c2b8fd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | ---
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}}
}
```
|