Downloads · 30 days
9
28% of all-time downloads
TigreGotico/mt-hitz-ca-eu-onnx
mt-hitz-ca-eu-onnx is a translation model from TigreGotico. Use it when you need text moved from one language to another. The card lists the license as apache-2.0.
ONNX export of HiTZ/mt-hitz-ca-eu, a MarianMT machine translation model for ca - eu produced by HiTZ, the Basque Center for Language Technology at the University of the Basque Country (UPV/EHU).
Downloads · 30 days
9
28% of all-time downloads
All-time downloads
32
Public
Repo size
748 MB
Likes
0
Public
Click a slice to open those files.
.onnx747 MB · 100%
From the Hugging Face model README
ONNX export of HiTZ/mt-hitz-ca-eu, a MarianMT machine translation model for ca -> eu produced by HiTZ, the Basque Center for Language Technology at the University of the Basque Country (UPV/EHU).
All credit for training and releasing the original model goes to the HiTZ team. This repo
only contains an ONNX conversion (fp32 and int8) for fast CPU inference with
optimum[onnxruntime], done by TigreGotico.
apache-2.0, as declared on the source model card.
optimum-cli export onnx --model HiTZ/mt-hitz-ca-eu --task text2text-generation-with-past --no-post-process ca-eu
int8 dynamic quantization was applied afterwards with
onnxruntime.quantization.quantize_dynamic (QUInt8) into the int8/ subfolder.
ca-eu/
encoder_model.onnx # fp32
decoder_model.onnx # fp32
decoder_with_past_model.onnx # fp32
config.json, generation_config.json
source.spm, target.spm, vocab.json, tokenizer_config.json, special_tokens_map.json
int8/
encoder_model.onnx
decoder_model.onnx
decoder_with_past_model.onnx
Measured on 8 held-out ca->eu sentences, beam search (num_beams=4,
max_new_tokens=64), exact-match against the original PyTorch MarianMTModel output:
Example (ca -> eu):
Kaixo, zer moduz zaude?Kaixo, zer moduz zaude?Kaixo, zer moduz zaude?from transformers import AutoTokenizer
from optimum.onnxruntime import ORTModelForSeq2SeqLM
tok = AutoTokenizer.from_pretrained("TigreGotico/mt-hitz-ca-eu-onnx")
# fp32 (default, root of the repo)
model = ORTModelForSeq2SeqLM.from_pretrained("TigreGotico/mt-hitz-ca-eu-onnx")
# int8 (smaller / faster, subfolder)
# download the repo and load from the local "int8" folder, e.g.:
# from huggingface_hub import snapshot_download
# path = snapshot_download("TigreGotico/mt-hitz-ca-eu-onnx")
# model = ORTModelForSeq2SeqLM.from_pretrained(path + "/int8")
batch = tok(["your sentence here"], return_tensors="pt")
generated = model.generate(**batch, num_beams=4, max_new_tokens=64)
print(tok.batch_decode(generated, skip_special_tokens=True))