Downloads · 30 days
4
13% of all-time downloads
TigreGotico/opus-mt-es-gl-onnx
opus-mt-es-gl-onnx is a translation model from TigreGotico. Use it when you need text moved from one language to another. It is set up for transformers. The card lists the license as apache-2.0.
ONNX export (fp32 + dynamic int8 quantized) of Helsinki-NLP/opus-mt-es-gl, a Marian (es - gl) translation model from the Helsinki-NLP OPUS-MT project.
Downloads · 30 days
4
13% of all-time downloads
All-time downloads
31
Public
Repo size
611 MB
Likes
0
Public
Click a slice to open those files.
.onnx610 MB · 100%
From the Hugging Face model README
ONNX export (fp32 + dynamic int8 quantized) of Helsinki-NLP/opus-mt-es-gl, a Marian (es -> gl) 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-es-gl --task text2text-generation-with-past /home/miro/tmp/claude-1000/-home-miro/849a3674-94c9-4aa5-b1f9-e596235b0a36/scratchpad/opusmt-onnx/out/es-gl
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: ~400 MB | int8 size: ~183 MB
Compared PyTorch (MarianMTModel) vs ONNX fp32 (ORTModelForSeq2SeqLM, num_beams=4, max_new_tokens=48) on 3 sentences. Match: 3/3.
int8 sample output (not gated, for reference only):
from optimum.onnxruntime import ORTModelForSeq2SeqLM
from transformers import AutoTokenizer
repo = "TigreGotico/opus-mt-es-gl-onnx"
tok = AutoTokenizer.from_pretrained(repo)
model = ORTModelForSeq2SeqLM.from_pretrained(repo) # fp32; pass subfolder="int8" for the quantized graphs
inputs = tok("Hello, how are you?", return_tensors="pt")
out = model.generate(**inputs, num_beams=4, max_new_tokens=48)
print(tok.decode(out[0], skip_special_tokens=True))
Exported for the OVOS / TigreGotico offline translation stack.