Request it for the seed queue, or get it now with pf download TigreGotico/opus-mt-bn-en-onnx (CLI guide).
ONNX export (fp32 + dynamic int8 quantized) of Helsinki-NLP/opus-mt-bn-en, a Marian translation model from the Helsinki-NLP OPUS-MT project.
License: apache-2.0 (inherited from the base model; verify at the source link above).
optimum-cli export onnx --model Helsinki-NLP/opus-mt-bn-en --task text2text-generation-with-past <out>
Quantized to int8 with onnxruntime.quantization.quantize_dynamic (QUInt8 weights).
./ fp32 ONNX graphs (encoder_model.onnx, decoder_model.onnx, decoder_with_past_model.onnx) + tokenizer files
./int8/ int8 dynamic-quantized ONNX graphs
fp32 size: ~1227.9 MB | int8 size: ~571.4 MB
Compared PyTorch (MarianMTModel) vs ONNX fp32 (ORTModelForSeq2SeqLM) on 2 sentences, greedy and beam=4 (max_new_tokens=64). Overall: greedy PASS, beam4 PASS.
from optimum.onnxruntime import ORTModelForSeq2SeqLM
from transformers import AutoTokenizer
repo = "TigreGotico/opus-mt-bn-en-onnx"
tok = AutoTokenizer.from_pretrained(repo)
model = ORTModelForSeq2SeqLM.from_pretrained(repo) # fp32; pass subfolder="int8" for the quantized graphs
inputs = tok("এটি একটি বই।", return_tensors="pt")
out = model.generate(**inputs, num_beams=4, max_new_tokens=64)
print(tok.decode(out[0], skip_special_tokens=True))
Exported for the OVOS / TigreGotico offline translation stack.
Have the files? Publish a torrent.
Publish a torrentHave the complete files and permission to share them? Replace the example folder path. The script checks the files, makes a torrent and submits its magnet and checksums. Keep your torrent client seeding. Get your community key from your settings, and read the script before running it.
curl -fsSL https://pirateface.co/package.sh | bash -s -- --repo TigreGotico/opus-mt-bn-en-onnx ./model-folderint8/decoder_model_merged.onnx 363 MBdecoder_model_merged.onnx 363 MBdecoder_model.onnx 363 MBdecoder_with_past_model.onnx 350 MBencoder_model.onnx 207 MBint8/decoder_model.onnx 91 MBint8/decoder_with_past_model.onnx 88 MBint8/encoder_model.onnx 52 MBHelsinki-NLP/opus-mt-bn-en