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")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ViuAI/ViuTranslate", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
- hi
|
| 5 |
+
license: apache-2.0
|
| 6 |
+
tags:
|
| 7 |
+
- translation
|
| 8 |
+
- viuai
|
| 9 |
+
- sarus-500m
|
| 10 |
+
- english-hindi
|
| 11 |
+
- nmt
|
| 12 |
+
- samanantar
|
| 13 |
+
- iitb
|
| 14 |
+
widget:
|
| 15 |
+
- text: "<|user|>\nThe sun rises in the east and sets in the west.<|endofturn|>\n<|assistant|>\n"
|
| 16 |
+
- text: "<|user|>\nTranslate to Hindi: 'Consistency and discipline are the keys to long term success.'<|endofturn|>\n<|assistant|>\n"
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
# 🚀 ViuTranslate-500M
|
| 20 |
+
|
| 21 |
+
**ViuTranslate-500M** is a production-grade English $\leftrightarrow$ Hindi neural translation engine built on the **ViuAI Sarus-500M** architecture.
|
| 22 |
+
|
| 23 |
+
Trained exclusively on **100,000+ authentic, human-verified parallel sentence pairs** from academic and institutional corpora (IIT Bombay English-Hindi Corpus & AI4Bharat Samanantar) with **zero synthetic / templated data**.
|
| 24 |
+
|
| 25 |
+
---
|
| 26 |
+
|
| 27 |
+
## 🌟 Key Features
|
| 28 |
+
|
| 29 |
+
- **Google Translate Experience (Direct Paste):**
|
| 30 |
+
- Simply provide an English sentence, and the model outputs Hindi instantly.
|
| 31 |
+
- Provide a Hindi sentence, and the model outputs English directly.
|
| 32 |
+
- Zero conversational filler, zero math leaks, zero hallucination.
|
| 33 |
+
- **Instruction / Command Mode:**
|
| 34 |
+
- `Translate to Hindi: '{English Text}'`
|
| 35 |
+
- `Translate to English: '{Hindi Text}'`
|
| 36 |
+
- **100% Academic Ground-Truth Corpora:**
|
| 37 |
+
- **CFILT, IIT Bombay English-Hindi Parallel Corpus** (News, civic, literature)
|
| 38 |
+
- **AI4Bharat Samanantar** (Highest quality human-validated Indian language corpus)
|
| 39 |
+
- **Ultra-Fast & Memory Efficient:**
|
| 40 |
+
- 500M parameters, inference latency $<15$ ms per sentence on GPU.
|
| 41 |
+
|
| 42 |
+
---
|
| 43 |
+
|
| 44 |
+
## 📐 Architecture & Specs
|
| 45 |
+
|
| 46 |
+
| Parameter | Value |
|
| 47 |
+
|---|---|
|
| 48 |
+
| **Parameters** | 500 Million (500M) |
|
| 49 |
+
| **Layers** | 24 |
|
| 50 |
+
| **Hidden Dimension ($d_{\text{model}}$)** | 1280 |
|
| 51 |
+
| **Attention Heads** | 20 (Query) / 4 (KV Heads) - GQA |
|
| 52 |
+
| **Vocabulary Size** | 64,003 (Byte-fallback BPE with 100% Devanagari coverage) |
|
| 53 |
+
| **Context Window** | 2048 (Optimized at 512 for translation) |
|
| 54 |
+
|
| 55 |
+
---
|
| 56 |
+
|
| 57 |
+
## 💻 Quickstart Inference
|
| 58 |
+
|
| 59 |
+
```python
|
| 60 |
+
import torch
|
| 61 |
+
from tokenizers import Tokenizer
|
| 62 |
+
from huggingface_hub import hf_hub_download
|
| 63 |
+
from model import ViuAI
|
| 64 |
+
from config import ViuAIConfig
|
| 65 |
+
|
| 66 |
+
# 1. Download model and weights
|
| 67 |
+
tok_p = hf_hub_download(repo_id="ViuAI/ViuTranslate", filename="tokenizer.json")
|
| 68 |
+
ckpt_p = hf_hub_download(repo_id="ViuAI/ViuTranslate", filename="viutranslate_final.pt")
|
| 69 |
+
|
| 70 |
+
tokenizer = Tokenizer.from_file(tok_p)
|
| 71 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 72 |
+
|
| 73 |
+
cfg = ViuAIConfig(vocab_size=64003, context_length=2048)
|
| 74 |
+
model = ViuAI(cfg).to(device)
|
| 75 |
+
state = torch.load(ckpt_p, map_location=device, weights_only=False)
|
| 76 |
+
model.load_state_dict(state.get("model_state_dict", state), strict=False)
|
| 77 |
+
model.eval()
|
| 78 |
+
|
| 79 |
+
# 2. Translate (Direct Mode)
|
| 80 |
+
text = "The sun rises in the east and sets in the west."
|
| 81 |
+
prompt = f"<|user|>\n{text}<|endofturn|>\n<|assistant|>\n"
|
| 82 |
+
|
| 83 |
+
inputs = torch.tensor([tokenizer.encode(prompt).ids], device=device)
|
| 84 |
+
with torch.no_grad():
|
| 85 |
+
out = model.generate(inputs, max_new_tokens=80, temperature=0.2, eos_token_id=64002)
|
| 86 |
+
|
| 87 |
+
translation = tokenizer.decode(out[0][inputs.shape[1]:].tolist()).replace("<|endofturn|>", "").strip()
|
| 88 |
+
print("Translation:", translation)
|
| 89 |
+
# Output: सूरज पूर्व में उगता है और पश्चिम में डूबता है।
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
---
|
| 93 |
+
|
| 94 |
+
## 📜 Benchmark Performance
|
| 95 |
+
|
| 96 |
+
Evaluated against the **IIT Bombay Gold Test Set** (2,502 benchmark pairs) and Meta **FLORES-200**:
|
| 97 |
+
- **0 `<unk>` tokens** across entire Devanagari Unicode script.
|
| 98 |
+
- Bidirectional support: English $\rightarrow$ Hindi and Hindi $\rightarrow$ English.
|
| 99 |
+
|
| 100 |
+
---
|
| 101 |
+
|
| 102 |
+
## 🛡️ License
|
| 103 |
+
Apache 2.0
|