English → Kashmiri Translation (ONNX)
Offline English → Kashmiri (Perso-Arabic script) translation, by Aazim Ameen. An encoder-decoder ONNX export that runs fully on CPU — no server, no API key.
Files
| file | what it is |
|---|---|
encoder_model.onnx + encoder_model.onnx.data | encoder (~74 MB weights) |
decoder_model.onnx + decoder_shared.onnx.data | decoder (~205 MB weights) |
tokenizer_src.json | source tokenizer (English side, vocab 122,672) |
tokenizer_tgt.json | target tokenizer (Kashmiri side) |
tokenizer_meta.json | tokenizer metadata |
inference.py | minimal standalone runner (numpy + onnxruntime + tokenizers) |
Usage
pip install numpy onnxruntime tokenizers
python inference.py "The boy is going to school."
# -> لڑکہٕ چھ سکول گژھان ۔
Details
- IndicTrans2 convention: the source text is prefixed with language tags,
eng_Latn kas_Arab <text>, before tokenisation. - Beam search decoding (width 4, length normalisation, trigram-repeat
blocking). Measured better than greedy decoding on 1 Nov 2026 — greedy
catastrophically loops on some inputs; beam returns clean sentences.
This export's decoder starts from the
</s>token (id 2); the target tokenizer carries no language tags of its own.inference.pyalready handles all of this — copy itstranslate()function if you integrate the ONNX sessions directly. - Output: Kashmiri in Perso-Arabic script.
- Companion model: Kashmiri speech-to-text.