English ↔ Roman Urdu
The trained weights for an 81M-parameter encoder–decoder transformer written
from primitives in PyTorch — no nn.Transformer, no AutoModel, no training
framework.
Roman Urdu is Urdu written in English letters, which is how Urdu is actually typed in messages. One model translates both directions and detects which one is wanted from the input.
| Parameters | 81M (d_model 512, 6+6 layers, 8 heads, d_ff 2048) |
| Vocabulary | 24k joint byte-level BPE, shared by both languages |
| Corpus | 1.81M sentence pairs, built for this project |
| Training | 30 epochs; checkpoint chosen on validation loss |
| BLEU (Tatoeba, held out) | 23.2 en→ur, 30.7 ur→en |
| Weights | fp16 on disk, fp32 at inference |
- Code: https://github.com/hasyarshad/roman-urdu-translator
- Demo: https://haseeb-arshad.me/translator
- Space: https://huggingface.co/spaces/hasyarshad/roman-urdu-translator
Use
pip install torch tokenizers huggingface_hub
git clone https://github.com/hasyarshad/roman-urdu-translator.git
cd roman-urdu-translator
python -c "from huggingface_hub import snapshot_download; \
snapshot_download('hasyarshad/roman-urdu-translator', local_dir='export')"
python serve.py "wo larki pyari ha"
Files
| File | What it is |
|---|---|
model.pt |
fp16 weights plus the config needed to rebuild the architecture |
tokenizer_joint.json |
the joint byte-level BPE tokenizer |
roman_urdu_map.json |
transliteration map, so Arabic-script input is romanised first |
export_info.json |
source checkpoint, epoch, validation loss, parameter count |