English → Hindi / Bengali Translation
A Pre-LN Transformer (6+6 layers, d=512, 8 heads, tied embeddings) trained from scratch on parallel text. No pretrained translation model and no fine-tuning.
Files
| Path | Contents |
|---|---|
bengali/best_model_bn.pth |
Bengali checkpoint (fp16) |
bengali/vocab_bn.pkl |
{"src": Vocab, "tgt": Vocab} for Bengali |
hindi/best_model_hi.pth |
Hindi checkpoint (fp16) |
hindi/vocab_hi.pkl |
{"src": Vocab, "tgt": Vocab} for Hindi |
The vocabulary file is not optional. Embedding rows are addressed by index, so a checkpoint loaded against a different vocabulary decodes to noise. Sizes are 31920/37921 (Bengali) and 33366/31680 (Hindi) and must match the checkpoint exactly.
Usage
from nmt import serve # from the linked repository
print(serve.translate("The weather is very pleasant today.", "Hindi"))
# आज मौसम बहुत ही सुखद है
Training
15 epochs per language on a single P100, 150 minutes total, mixed precision, Noam schedule with 4000 warmup steps. The best-BLEU checkpoint is kept rather than the last epoch. The fp16 copies published here decode identically to fp32 on every sentence tested.
Limitations
Everyday sentences translate well. Rare words and proper nouns often do not: the vocabulary
keeps only tokens appearing at least twice in training, so anything rarer is replaced by
<UNK> and cannot be recovered. Decoding is greedy, so no beam search reranking is applied.