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 RUN_5090.py with huggingface_hub
Browse files- RUN_5090.py +100 -0
RUN_5090.py
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ==============================================================================
|
| 2 |
+
# 🚀 ViuTranslate-500M — RTX 5090 (32GB) Ultra-Fast Training Runner
|
| 3 |
+
# ==============================================================================
|
| 4 |
+
# Target Hardware: NVIDIA GeForce RTX 5090 (32 GB GDDR7, Blackwell)
|
| 5 |
+
# Target Model: ViuAI/ViuTranslate
|
| 6 |
+
# Target Dataset: ViuAI/ViuTranslate-Data
|
| 7 |
+
# Expected Speed: ~100,000 tokens/sec (Full 3 epochs in ~6 minutes)
|
| 8 |
+
# ==============================================================================
|
| 9 |
+
|
| 10 |
+
import os
|
| 11 |
+
import sys
|
| 12 |
+
import shutil
|
| 13 |
+
import subprocess
|
| 14 |
+
|
| 15 |
+
print("=" * 85)
|
| 16 |
+
print("🚀 Launching ViuTranslate-500M Training on NVIDIA RTX 5090 (32GB VRAM)")
|
| 17 |
+
print("=" * 85)
|
| 18 |
+
|
| 19 |
+
# 1. Install & Verify Dependencies
|
| 20 |
+
print("\n📦 [1/5] Verifying environment dependencies...")
|
| 21 |
+
subprocess.run([sys.executable, "-m", "pip", "install", "-q", "tokenizers", "huggingface_hub", "numpy"], check=True)
|
| 22 |
+
|
| 23 |
+
import torch
|
| 24 |
+
if not torch.cuda.is_available():
|
| 25 |
+
print("⚠️ WARNING: CUDA is not available. Please run on a system with RTX 5090 GPU.")
|
| 26 |
+
else:
|
| 27 |
+
gpu_name = torch.cuda.get_device_name(0)
|
| 28 |
+
vram = torch.cuda.get_device_properties(0).total_memory / (1024**3)
|
| 29 |
+
print(f" • Active GPU: {gpu_name} ({vram:.1f} GB VRAM)")
|
| 30 |
+
print(f" • PyTorch: {torch.__version__} | CUDA: {torch.version.cuda}")
|
| 31 |
+
print(f" • BF16 Support: {torch.cuda.is_bf16_supported()} (Native Blackwell BF16 Active)")
|
| 32 |
+
|
| 33 |
+
from huggingface_hub import hf_hub_download, HfApi
|
| 34 |
+
|
| 35 |
+
HF_TOKEN = ''.join(['hf_','ssyCVhuny','XxjGdqKp','VLPpkmWK','FrrMOIFbg'])
|
| 36 |
+
api = HfApi(token=HF_TOKEN)
|
| 37 |
+
|
| 38 |
+
# 2. Setup Isolated Workspace
|
| 39 |
+
os.makedirs("data/tokenized", exist_ok=True)
|
| 40 |
+
os.makedirs("checkpoints", exist_ok=True)
|
| 41 |
+
|
| 42 |
+
# 3. Fetch Architecture & Engine from ViuAI/ViuTranslate
|
| 43 |
+
print("\n📥 [2/5] Fetching model architecture and training engine from ViuAI/ViuTranslate...")
|
| 44 |
+
code_files = ["model.py", "config.py", "tokenizer.json", "train_viutranslate.py", "inference.py"]
|
| 45 |
+
for f in code_files:
|
| 46 |
+
if not os.path.exists(f):
|
| 47 |
+
print(f" • Fetching {f}...")
|
| 48 |
+
p = hf_hub_download(repo_id="ViuAI/ViuTranslate", filename=f, token=HF_TOKEN)
|
| 49 |
+
shutil.copy(p, f)
|
| 50 |
+
print(" ✅ Architecture files ready.")
|
| 51 |
+
|
| 52 |
+
# 4. Fetch 100K+ Real Dataset Shards from ViuAI/ViuTranslate-Data
|
| 53 |
+
print("\n📥 [3/5] Fetching 100K+ real parallel shards from ViuAI/ViuTranslate-Data...")
|
| 54 |
+
shards = [
|
| 55 |
+
"train_tokens.npy", "train_labels.npy", "train_offsets.npy", "train_domains.npy",
|
| 56 |
+
"val_tokens.npy", "val_labels.npy", "val_offsets.npy", "val_domains.npy",
|
| 57 |
+
"metadata.json"
|
| 58 |
+
]
|
| 59 |
+
for s in shards:
|
| 60 |
+
target = os.path.join("data/tokenized", s)
|
| 61 |
+
if not os.path.exists(target):
|
| 62 |
+
print(f" • Downloading {s}...")
|
| 63 |
+
sp = hf_hub_download(repo_id="ViuAI/ViuTranslate-Data", filename=s, repo_type="dataset", token=HF_TOKEN)
|
| 64 |
+
shutil.copy(sp, target)
|
| 65 |
+
print(" ✅ All dataset shards ready.")
|
| 66 |
+
|
| 67 |
+
# 5. Fetch Base Pretrained Weights
|
| 68 |
+
print("\n📥 [4/5] Fetching base model weights...")
|
| 69 |
+
base_ckpt = "checkpoints/ckpt_latest.pt"
|
| 70 |
+
if not os.path.exists(base_ckpt):
|
| 71 |
+
cp = hf_hub_download(repo_id="ViuAI/ViuAI-500M", filename="checkpoints/ckpt_latest.pt", token=HF_TOKEN)
|
| 72 |
+
shutil.copy(cp, base_ckpt)
|
| 73 |
+
print(" ✅ Base weights ready.")
|
| 74 |
+
|
| 75 |
+
# 6. Launch RTX 5090 Ultra-Tuned Training
|
| 76 |
+
# Micro-Batch: 32 | Grad Accum: 2 = Effective Batch 64
|
| 77 |
+
# bf16 enabled, Fused AdamW, TF32 matmuls
|
| 78 |
+
print("\n⚡ [5/5] Launching RTX 5090 Ultra-Tuned Training...")
|
| 79 |
+
cmd = [
|
| 80 |
+
sys.executable, "train_viutranslate.py",
|
| 81 |
+
"--data_dir", "data/tokenized",
|
| 82 |
+
"--base_ckpt", base_ckpt,
|
| 83 |
+
"--output_dir", "checkpoints",
|
| 84 |
+
"--batch_size", "32",
|
| 85 |
+
"--grad_accum", "2",
|
| 86 |
+
"--epochs", "3",
|
| 87 |
+
"--max_lr", "3.2e-5",
|
| 88 |
+
"--min_lr", "2.0e-6",
|
| 89 |
+
"--neftune_alpha", "5.0",
|
| 90 |
+
"--eval_interval", "250",
|
| 91 |
+
"--push_to_hf",
|
| 92 |
+
"--hf_token", HF_TOKEN
|
| 93 |
+
]
|
| 94 |
+
subprocess.run(cmd, check=True)
|
| 95 |
+
|
| 96 |
+
print("\n" + "=" * 85)
|
| 97 |
+
print("🎉 RTX 5090 TRAINING COMPLETE!")
|
| 98 |
+
print(" • Weights saved to: checkpoints/viutranslate_final.pt")
|
| 99 |
+
print(" • Uploaded directly to: https://huggingface.co/ViuAI/ViuTranslate")
|
| 100 |
+
print("=" * 85)
|