IndicTrans2 1B (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-1B-ONNX- FP16 (Half Precision):
hari31416/indictrans2-indic-indic-1B-ONNX-fp16(Current)- INT8 (Dynamic Quantization):
hari31416/indictrans2-indic-indic-1B-ONNX-int8- Q4F16 (4-bit Block Quantization):
hari31416/indictrans2-indic-indic-1B-ONNX-q4f16
ONNX-exported and quantized version of ai4bharat/indictrans2-indic-indic-1B
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 | 7.03 GB | 100.00% | 100.00% | 100.00 | 94.7 ms | 1.000x |
| FP16 | 3.52 GB | 99.82% | 99.82% | 100.00 | 108.3 ms | 0.874x |
| INT8 | 1.76 GB | 83.64% | 83.73% | 94.22 | 43.7 ms | 2.240x |
| Q4F16 | 900.0 MB | 73.18% | 73.18% | 89.33 | 94.2 ms | 1.087x |
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 | 98.0% | 98.0% | 98.85 | 99.08 |
| mni_Beng | 50 | 98.0% | 98.0% | 97.89 | 98.89 |
| 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 | 100.0% | 100.0% | 100.00 | 100.00 |
| 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 | 100.0% | 100.0% | 100.00 | 100.00 |
| Lexicon | 264 | 99.2% | 99.2% | 99.48 | 99.64 |
| 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: Lexicon)
- Source (mal_Mlym → mar_Deva):
അക്ഷരക്രമത്തിലാണ് പുസ്തകങ്ങൾ ഷെൽഫിൽ ക്രമീകരിച്ചിരിക്കുന്നത്. - Expected (FP32):
पुस्तके शेल्फवर अक्षरांच्या क्रमाने मांडण्यात आली आहेत. - Actual (FP16):
शेल्फवर शब्दलेखन क्रमाने पुस्तके मांडण्यात आली आहेत.
Mismatch #2 (Category: Lexicon)
- Source (mar_Deva → mni_Beng):
कंपनी मैत्रीपूर्ण आणि सहाय्यक कामाचे वातावरण प्रदान करते. - 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-1B-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
- 15
Model tree for hari31416/indictrans2-indic-indic-1B-ONNX-fp16
Base model
ai4bharat/indictrans2-indic-indic-1B

