IndicTrans2 1B (en→indic) — ONNX bundle [FP32 (Full Precision)]

This model is part of a suite of optimized/quantized ONNX versions of the base model. Other variants in this direction:

ONNX-exported and quantized version of ai4bharat/indictrans2-en-indic-1B for in-browser and local edge inference.

  • Precision: FP32 (Full Precision)
  • Description: Baseline full-precision ONNX export.
  • 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.

Overall Tradeoffs Language-Level Parity 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 6.64 GB 100.00% 100.00% 100.00 69.5 ms 1.000x
FP16 3.32 GB 99.73% 99.73% 100.00 74.3 ms 0.935x
INT8 1.66 GB 89.55% 89.55% 96.27 31.4 ms 2.125x
Q4F16 850.5 MB 82.45% 82.55% 91.99 58.4 ms 1.186x

Files

  • encoder_model.onnx (and optional .onnx.data weights sidecar)
  • decoder_model.onnx and decoder_with_past_model.onnx (share decoder_shared.onnx.data when 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-1B-ONNX")
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
19
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for hari31416/indictrans2-en-indic-1B-ONNX

Quantized
(4)
this model

Collection including hari31416/indictrans2-en-indic-1B-ONNX