IndicTrans2 200M (indic→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-indic-indic-dist-320M-ONNX- FP16 (Half Precision):
hari31416/indictrans2-indic-indic-dist-320M-ONNX-fp16(Current)- INT8 (Dynamic Quantization):
hari31416/indictrans2-indic-indic-dist-320M-ONNX-int8- Q4F16 (4-bit Block Quantization):
hari31416/indictrans2-indic-indic-dist-320M-ONNX-q4f16
ONNX-exported and quantized version of ai4bharat/indictrans2-indic-indic-dist-320M
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.87 GB | 100.00% | 100.00% | 100.00 | 23.0 ms | 1.000x |
| FP16 | 980.2 MB | 99.82% | 99.82% | 100.00 | 27.4 ms | 0.840x |
| INT8 | 497.1 MB | 72.18% | 72.36% | 87.13 | 16.5 ms | 1.475x |
| Q4F16 | 711.6 MB | 45.91% | 46.36% | 71.64 | 28.3 ms | 0.829x |
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 | 100.0% | 100.0% | 100.00 | 100.00 |
| gom_Deva | 50 | 100.0% | 100.0% | 100.00 | 100.00 |
| 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 | 100.0% | 100.0% | 100.00 | 100.00 |
| 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 | 98.0% | 98.0% | 99.06 | 99.74 |
| 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% | 99.35 | 99.57 |
| 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.7% | 99.7% | 99.86 | 99.95 |
| Lexicon | 264 | 100.0% | 100.0% | 100.00 | 100.00 |
| Numerals | 264 | 99.6% | 99.6% | 99.80 | 99.90 |
| 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 (npi_Deva → ory_Orya):
नयाँ नीति आगामी महिनादेखि लागु हुनेछ। - Expected (FP32):
ଆଗାମୀ ମାସରୁ ନୂଆ ନୀତି କାର୍ଯ୍ଯ଼କାରୀ ହେବ। - Actual (FP16):
ନୂଆ ନୀତି ଆଗାମୀ ମାସରୁ କାର୍ଯ୍ଯ଼କାରୀ ହେବ।
Mismatch #2 (Category: Numerals)
- Source (san_Deva → sat_Olck):
एतत् चलच्चित्रं सत्यकथायाः आधारेण निर्मितम् आसीत्। - 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-indic-indic-dist-320M-ONNX-fp16")
print(model.translate("चुनाव कौन जीतेगा?", src_lang="hin_Deva", tgt_lang="tam_Taml"))
Required packages:
pip install onnxruntime tokenizers huggingface-hub
License
MIT (preserved from upstream AI4Bharat).
- Downloads last month
- 57
Model tree for hari31416/indictrans2-indic-indic-dist-320M-ONNX-fp16
Base model
ai4bharat/indictrans2-indic-indic-dist-320M

