IndicTrans2 200M (en→indic) — ONNX bundle [FP16 (Half Precision, Lossless)]
This model is part of a suite of optimized/quantized ONNX versions of the base model. Other variants in this direction:
- FP32 (Full Precision / Base):
hari31416/indictrans2-en-indic-dist-200M-ONNX- FP16 (Half Precision):
hari31416/indictrans2-en-indic-dist-200M-ONNX-fp16(Current)- INT8 (Dynamic Quantization):
hari31416/indictrans2-en-indic-dist-200M-ONNX-int8- Q4F16 (4-bit Block Quantization):
hari31416/indictrans2-en-indic-dist-200M-ONNX-q4f16
ONNX-exported and quantized version of ai4bharat/indictrans2-en-indic-dist-200M
for in-browser and local edge inference.
- Precision: FP16 (Half Precision, Lossless)
- Description: Converts weights and activations to float16. Lossless tier, recommended for Apple Silicon (MPS) and CUDA runtimes.
- Source Pipeline & Details: For pipeline details, benchmarks, and usage instructions, see the indictrans2-onnx-export GitHub repository.
Built for use with Transformers.js and onnxruntime-web in the browser, with fast BPE tokenizer.json files that don't require the SentencePiece WASM runtime.
Performance Visualizations
These charts show overall tradeoffs, language-level parity, and category breakdown.
Performance Tradeoffs & Size Comparison
Compared against the FP32 ONNX oracle on the golden evaluation fixtures.
| Format | Model Size | Exact Match (Token) | Exact Match (Text) | SacreBLEU (Raw) | Latency (Mean) | Speedup vs. FP32 |
|---|---|---|---|---|---|---|
| FP32 | 1.70 GB | 100.00% | 100.00% | 100.00 | 18.3 ms | 1.000x |
| FP16 | 892.0 MB | 99.64% | 99.64% | 100.00 | 24.8 ms | 0.736x |
| INT8 | 452.9 MB | 74.36% | 74.36% | 90.44 | 13.2 ms | 1.594x |
| Q4F16 | 623.3 MB | 55.18% | 55.64% | 81.13 | 27.3 ms | 0.705x |
Language-Level Parity (FP16)
Exact match rates and translation quality (SacreBLEU / chrF) per language pair under this precision:
| Language Code | Total Fixtures | Token Match Rate | Text Match Rate | SacreBLEU | SacreBLEU (chrF) |
|---|---|---|---|---|---|
| asm_Beng | 50 | 100.0% | 100.0% | 100.00 | 100.00 |
| ben_Beng | 50 | 100.0% | 100.0% | 100.00 | 100.00 |
| brx_Deva | 50 | 100.0% | 100.0% | 100.00 | 100.00 |
| doi_Deva | 50 | 98.0% | 98.0% | 99.36 | 99.78 |
| gom_Deva | 50 | 98.0% | 98.0% | 98.75 | 99.14 |
| guj_Gujr | 50 | 100.0% | 100.0% | 100.00 | 100.00 |
| hin_Deva | 50 | 100.0% | 100.0% | 100.00 | 100.00 |
| kan_Knda | 50 | 100.0% | 100.0% | 100.00 | 100.00 |
| kas_Arab | 50 | 100.0% | 100.0% | 100.00 | 100.00 |
| mai_Deva | 50 | 100.0% | 100.0% | 100.00 | 100.00 |
| mal_Mlym | 50 | 98.0% | 98.0% | 98.35 | 99.41 |
| mar_Deva | 50 | 100.0% | 100.0% | 100.00 | 100.00 |
| mni_Beng | 50 | 100.0% | 100.0% | 100.00 | 100.00 |
| npi_Deva | 50 | 100.0% | 100.0% | 100.00 | 100.00 |
| ory_Orya | 50 | 100.0% | 100.0% | 100.00 | 100.00 |
| pan_Guru | 50 | 100.0% | 100.0% | 100.00 | 100.00 |
| san_Deva | 50 | 100.0% | 100.0% | 100.00 | 100.00 |
| sat_Olck | 50 | 98.0% | 98.0% | 98.93 | 99.42 |
| snd_Arab | 50 | 100.0% | 100.0% | 100.00 | 100.00 |
| tam_Taml | 50 | 100.0% | 100.0% | 100.00 | 100.00 |
| tel_Telu | 50 | 100.0% | 100.0% | 100.00 | 100.00 |
| urd_Arab | 50 | 100.0% | 100.0% | 100.00 | 100.00 |
Category-Level Parity (FP16)
Exact match rates and translation quality grouped by category types:
| Category | Total Fixtures | Token Match Rate | Text Match Rate | SacreBLEU | SacreBLEU (chrF) |
|---|---|---|---|---|---|
| Generic | 286 | 99.0% | 99.0% | 99.40 | 99.70 |
| Lexicon | 264 | 99.6% | 99.6% | 99.77 | 99.87 |
| Numerals | 264 | 100.0% | 100.0% | 100.00 | 100.00 |
| Politics | 286 | 100.0% | 100.0% | 100.00 | 100.00 |
Translation Mismatch Examples
Here is a sample of up to 5 translation mismatches compared to the FP32 oracle. Many mismatches represent minor synonym differences or spacing variations.
Mismatch #1 (Category: Generic)
- Source (eng_Latn → doi_Deva):
The price of gold has reached a new high. - Expected (FP32):
सोने दी कीमत इक नमीं उचाई पर पुज्जे दी ऐ। - Actual (FP16):
सोने दी कीमत नमीं उचाई पर पुज्जे दी ऐ।
Mismatch #2 (Category: Generic)
- Source (eng_Latn → gom_Deva):
The constitution guarantees freedom of speech and expression. - Expected (FP32):
संविधानांत उलोवपाचे आनी अभिव्यक्ती स्वातंत्र्याची हमी आसा. - Actual (FP16):
संविधान भाशण आनी अभिव्यक्ती स्वातंत्र्याची हमी दिता.
Mismatch #3 (Category: Lexicon)
- Source (eng_Latn → mal_Mlym):
Water boils at 100 degrees Celsius under standard conditions. - Expected (FP32):
സാധാരണ സാഹചര്യങ്ങളിൽ വെള്ളം 100 ഡിഗ്രി സെൽഷ്യസിൽ തിളയ്ക്കുന്നു. - Actual (FP16):
സാധാരണ സാഹചര്യങ്ങളിൽ 100 ഡിഗ്രി സെൽഷ്യസിൽ വെള്ളം തിളച്ചുമറിയുന്നു.
Mismatch #4 (Category: Generic)
- Source (eng_Latn → sat_Olck):
The crop yield has improved due to good rainfall. - Expected (FP32):
ᱱᱟᱯᱟᱭ ᱫᱟᱜᱡᱳᱜ ᱠᱷᱟᱹᱛᱤᱨ ᱛᱮ ᱪᱟᱥ ᱨᱮᱭᱟᱜ ᱟᱨᱡᱟᱣ ᱵᱟᱹᱲᱛᱤ ᱟᱠᱟᱱᱟ ᱾ - Actual (FP16):
ᱱᱟᱯᱟᱭ ᱫᱟᱜ ᱫᱟᱜ ᱨᱮᱭᱟᱜ ᱚᱡᱮᱛᱮ ᱪᱟᱥ ᱨᱮᱭᱟᱜ ᱟᱨᱡᱟᱣ ᱵᱟᱹᱲᱛᱤ ᱟᱠᱟᱱᱟ ᱾
Files
encoder_model.onnx(and optional.onnx.dataweights sidecar)decoder_model.onnxanddecoder_with_past_model.onnx(sharedecoder_shared.onnx.datawhen present)translate.py— self-contained Python inference helper (see Usage below)- Fast tokenizer config files (
tokenizer_src.json,tokenizer_tgt.json,tokenizer_meta.json) - Model configuration configs (
config.json,generation_config.json)
Usage Example (Python, onnxruntime)
# translate.py is included in this repo alongside the ONNX bundle.
# You can also find it (and read the full source) at:
# https://github.com/Hari31416/indictrans2-onnx-export/blob/main/src/translate.py
from translate import IndicTransONNX
# Pass a HF repo ID for automatic download, or a local bundle directory path
model = IndicTransONNX("hari31416/indictrans2-en-indic-dist-200M-ONNX-fp16")
print(model.translate("Who will win the election?", src_lang="eng_Latn", tgt_lang="hin_Deva"))
Required packages:
pip install onnxruntime tokenizers huggingface-hub
License
MIT (preserved from upstream AI4Bharat).
- Downloads last month
- 32
Model tree for hari31416/indictrans2-en-indic-dist-200M-ONNX-fp16
Base model
ai4bharat/indictrans2-en-indic-dist-200M

