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
Upload config.py with huggingface_hub
Browse files
config.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from dataclasses import dataclass
|
| 2 |
+
|
| 3 |
+
@dataclass
|
| 4 |
+
class ViuAIConfig:
|
| 5 |
+
vocab_size: int = 64003
|
| 6 |
+
d_model: int = 1280
|
| 7 |
+
n_layers: int = 24
|
| 8 |
+
n_heads: int = 20
|
| 9 |
+
n_kv_heads: int = 4
|
| 10 |
+
ffn_hidden: int = 3456
|
| 11 |
+
context_length: int = 2048
|
| 12 |
+
rope_theta: float = 10000.0
|
| 13 |
+
norm_eps: float = 1e-5
|
| 14 |
+
z_loss_weight: float = 0.0 # 0.0 default for SFT/Inference (use 1e-4 for pretraining)
|
| 15 |
+
use_checkpoint: bool = True
|
| 16 |
+
attn_dropout: float = 0.05 # 0.0 for pretraining, 0.05 for SFT
|
| 17 |
+
resid_dropout: float = 0.05 # 0.0 for pretraining, 0.05 for SFT
|
| 18 |
+
neftune_alpha: float = 5.0 # NEFTune noise scale for SFT quality boost
|
| 19 |
+
|
| 20 |
+
@classmethod
|
| 21 |
+
def pretrain(cls, **kwargs):
|
| 22 |
+
"""Standard configuration for base pretraining (no dropout, 1e-4 z-loss)."""
|
| 23 |
+
defaults = dict(z_loss_weight=1e-4, attn_dropout=0.0, resid_dropout=0.0, neftune_alpha=0.0)
|
| 24 |
+
defaults.update(kwargs)
|
| 25 |
+
return cls(**defaults)
|
| 26 |
+
|
| 27 |
+
@classmethod
|
| 28 |
+
def sft(cls, **kwargs):
|
| 29 |
+
"""Optimized configuration for Supervised Fine-Tuning."""
|
| 30 |
+
defaults = dict(z_loss_weight=0.0, attn_dropout=0.05, resid_dropout=0.05, neftune_alpha=5.0)
|
| 31 |
+
defaults.update(kwargs)
|
| 32 |
+
return cls(**defaults)
|
| 33 |
+
|
| 34 |
+
# Compatibility Alias
|
| 35 |
+
ModelArgs = ViuAIConfig
|