Downloads · 30 days
12
32% of all-time downloads
TigreGotico/aina-translator-ca-zh-onnx
aina-translator-ca-zh-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 of projecte-aina/aina-translator-ca-zh, Projecte Aina's (Barcelona Supercomputing Center, Language Technologies Unit) Catalan → Chinese machine translation model, fine-tuned from facebook/m2m1001.2B. All c…
Downloads · 30 days
12
32% of all-time downloads
All-time downloads
38
Public
Repo size
11.6 GB
Likes
0
Public
Click a slice to open those files.
.onnx_data9.3 GB · 80%
From the Hugging Face model README
ONNX export of projecte-aina/aina-translator-ca-zh,
Projecte Aina's (Barcelona Supercomputing Center, Language Technologies Unit) Catalan → Chinese
machine translation model, fine-tuned from facebook/m2m100_1.2B. All credit for training data,
fine-tuning and evaluation goes to Projecte Aina — see the
source model card for training
details, BLEU/ChrF numbers, and paper reference.
apache-2.0, verbatim as declared on the source model card
(projecte-aina/aina-translator-ca-zh). Same licence applies to this derived ONNX export.
encoder_model.onnx(_data) fp32 encoder
decoder_model.onnx(_data) fp32 decoder (no cache)
decoder_with_past_model.onnx(_data) fp32 decoder (with KV cache)
int8/encoder_model.onnx dynamic-quantized (uint8) encoder
int8/decoder_model.onnx dynamic-quantized (uint8) decoder
int8/decoder_with_past_model.onnx dynamic-quantized (uint8) decoder w/ cache
sentencepiece.bpe.model, vocab.json, tokenizer_config.json, ... tokenizer files (M2M100Tokenizer)
Base architecture: M2M100ForConditionalGeneration (transformers model_type: m2m_100), fine-tuned
by Projecte Aina from facebook/m2m100_1.2B.
optimum-cli export onnx \
--model projecte-aina/aina-translator-ca-zh \
--task text2text-generation-with-past \
--no-post-process \
aina-translator-ca-zh-onnx
--no-post-process is required: optimum's decoder-merge step OOMs on this model size on
constrained hardware. As a result the ONNX export ships an un-merged decoder_model.onnx
(no cache) and decoder_with_past_model.onnx (with cache) instead of a single
decoder_model_merged.onnx.
int8 dynamic quantization (optimum.onnxruntime.ORTQuantizer, AVX2 config) was applied to each of
the three graphs.
Same family as aina-translator-zh-ca-onnx
but the reverse direction. Unlike the zh→ca checkpoint, this one's tokenizer_config.json does carry
explicit src_lang: "ca" / tgt_lang: "zh" fields, and they are already the tokenizer's default — no
extra argument is required at inference time. There is still no forced_bos_token_id in
generation_config.json; a plain tokenizer(text) + model.generate() call is sufficient and yields
Chinese output directly, exactly as in the upstream model card's usage example.
8 held-out Catalan sentences, num_beams=4, max_new_tokens=64, compared against the original
PyTorch model (transformers.AutoModelForSeq2SeqLM) with identical decoding settings.
| exact-match rate | |
|---|---|
| ONNX fp32 | 8/8 = 100.0% |
| ONNX int8 (dynamic) | not separately re-verified against reference; same graphs, expect near-parity |
Sample translations observed (ca → zh):
| Catalan | Chinese (Aina / ONNX, identical) |
|---|---|
| Benvingut al projecte Aina! | 欢迎来到Aina项目 ! |
| Hola, com estàs avui? | 你好,今天你好吗? |
| Avui fa bon temps. | 今天天气很好。 |
| M'agradaria reservar una taula per a dos. | 我想为两个人预订一张桌子。 |
| On és l'estació de tren? | 火车站在哪里? |
| Aquest llibre és interessant. | 这本书很有趣。 |
| Els nens juguen al parc. | 孩子们在公园里玩耍。 |
| Necessito ajuda amb el meu ordinador. | 我需要电脑方面的帮助。 |
from transformers import AutoTokenizer
from optimum.onnxruntime import ORTModelForSeq2SeqLM
model_id = "TigreGotico/aina-translator-ca-zh-onnx"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = ORTModelForSeq2SeqLM.from_pretrained(model_id) # fp32
# int8: ORTModelForSeq2SeqLM.from_pretrained(model_id, subfolder="int8")
text = "Benvingut al projecte Aina!"
ids = tokenizer(text, return_tensors="pt").input_ids
out = model.generate(ids, num_beams=4, max_new_tokens=64)
print(tokenizer.decode(out[0], skip_special_tokens=True))
# 欢迎来到Aina项目!
All modeling and training work is by Projecte Aina (Language Technologies Unit,
Barcelona Supercomputing Center) — this repository only republishes an ONNX conversion of their
weights for offline/CPU inference. Source model:
projecte-aina/aina-translator-ca-zh.
Contact for the original model: [email protected].