hari31416/indictrans2-indic-indic-dist-320M-ONNX-int8
IndicTrans2 200M (indic→indic) — ONNX bundle [INT8 (Dynamic Quantization)]
[!TIP] 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` - INT8 (Dynamic Quantization): `hari31416/indictrans2-indic-indic-dist-320M-ONNX-int8` (Current) - 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: INT8 (Dynamic Quantization)
- Description: Dynamic INT8 quantization of the encoder and decoder. Highly recommended for CPU environments.
- 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.
Language-Level Parity (INT8)
Exact match rates and translation quality (SacreBLEU / chrF) per language pair under this precision:
Category-Level Parity (INT8)
Exact match rates and translation quality grouped by category types:
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: Numerals)
- Source (asm_Beng → ben_Beng):
আপুনি অনুগ্ৰহ কৰি মোক নিকটতম চিকিৎসালয়খন বিচাৰি উলিওৱাত সহায় কৰিব পাৰিবনে? - Expected (FP32):
আপনি কি দয়া করে নিকটতম হাসপাতাল খুঁজে পেতে আমার সাহায্য করতে পারেন? - Actual (INT8):
আপনি কি দয়া করে নিকটতম হাসপাতাল খুঁজে পেতে আমাকে সাহায্য করতে পারেন?
Mismatch #2 (Category: Lexicon)
- Source (asm_Beng → ben_Beng):
মই দিল্লীলৈ বিমানৰ টিকট এখন বুক কৰিব বিচাৰো। - Expected (FP32):
আমি দিল্লিতে যাওয়ার জন্য একটি বিমানের টিকিট বুক করতে চাই। - Actual (INT8):
আমি দিল্লিতে একটি বিমানের টিকিট বুক করতে চাই।
Mismatch #3 (Category: Numerals)
- Source (asm_Beng → ben_Beng):
মোৰ ফোন নম্বৰটো হৈছে + 91-9876543210। - Expected (FP32):
আমার ফোন নম্বর হল + 91-9876543210। - Actual (INT8):
আমার ফোন নম্বর + 91-9876543210।
Mismatch #4 (Category: Generic)
- Source (asm_Beng → ben_Beng):
কৃত্ৰিম বুদ্ধিমত্তাই শিক্ষাৰ ক্ষেত্ৰত পৰিৱৰ্তন কঢ়িয়াই আহিছে। - Expected (FP32):
কৃত্রিম বুদ্ধিমত্তা শিক্ষার ক্ষেত্রে পরিবর্তন আনছে। - Actual (INT8):
কৃত্রিম বুদ্ধিমত্তা শিক্ষার ক্ষেত্রে পরিবর্তন নিয়ে এসেছে।
Mismatch #5 (Category: Numerals)
- Source (asm_Beng → ben_Beng):
ৱেবছাইটটোৰ ব্যৱহাৰকাৰী আন্তঃপৃষ্ঠ পৰিষ্কাৰ আৰু আধুনিক। - Expected (FP32):
ওয়েবসাইটের ব্যবহারকারী ইন্টারফেস পরিষ্কার এবং আধুনিক। - Actual (INT8):
ওয়েবসাইটের ব্যবহারকারী ইন্টারফেসটি পরিষ্কার এবং আধুনিক।
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-int8")
print(model.translate("चुनाव कौन जीतेगा?", src_lang="hin_Deva", tgt_lang="tam_Taml"))Required packages:
pip install onnxruntime tokenizers huggingface-hubLicense
MIT (preserved from upstream AI4Bharat).
