Downloads · 30 days
11
27% of all-time downloads
TigreGotico/aina-translator-es-an-onnx
aina-translator-es-an-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 cc-by-nc-4.0.
ONNX export of projecte-aina/aina-translator-es-an, Projecte Aina's (Barcelona Supercomputing Center, Language Technologies Unit) Spanish → Aragonese machine translation model. All credit for training data, fine-tunin…
Downloads · 30 days
11
27% of all-time downloads
All-time downloads
41
Public
Repo size
9.3 GB
Likes
0
Public
Click a slice to open those files.
.onnx_data5.7 GB · 61%
From the Hugging Face model README
ONNX export of projecte-aina/aina-translator-es-an,
Projecte Aina's (Barcelona Supercomputing Center, Language Technologies Unit) Spanish → Aragonese
machine translation model. 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.
Aragonese has almost no other machine-translation coverage, which is why this export exists: to
make the model runnable with onnxruntime (CPU, no PyTorch/CUDA dependency) via optimum.
cc-by-nc-4.0, verbatim as declared on the source model card
(projecte-aina/aina-translator-es-an). 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, tokenizer.json, tokenizer_config.json, ... tokenizer files (NLLB-style SentencePiece)
Model files exceed the single-file size ONNX allows, so fp32 weights are stored as external data
(*.onnx_data next to each *.onnx graph file). int8 files are small enough to be single-file.
Base architecture: M2M100ForConditionalGeneration (transformers model_type: m2m_100), fine-tuned
by Projecte Aina from facebook/nllb-200-distilled-600M.
optimum-cli export onnx \
--model projecte-aina/aina-translator-es-an \
--task text2text-generation-with-past \
--no-post-process \
aina-translator-es-an-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.
This is a single-direction fine-tune: Spanish → Aragonese only, no target forcing needed at
inference time. The base NLLB-200 tokenizer doesn't have a language tag for Aragonese, so Projecte
Aina added a new special token, arg_Latn, and set tokenizer_config.json to
src_lang: spa_Latn, tgt_lang: arg_Latn. There is no forced_bos_token_id in
generation_config.json — the tokenizer's baked-in tgt_lang plus the model's
decoder_start_token_id (2) are sufficient; a plain tokenizer(text) + model.generate() call
already yields Aragonese output. Do not pass forced_bos_token_id explicitly; arg_Latn is a
model-specific token repurposed for this fine-tune, per the source model card.
8 held-out Spanish 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 (es → an/Aragonese):
| Spanish | Aragonese (Aina / ONNX, identical) |
|---|---|
| Hola, ¿cómo estás? | Ola, cómo yes? |
| El tiempo hoy es muy bueno. | Lo tiempo hue ye muit bueno. |
| Me gustaría reservar una mesa para dos personas. | Me faría goyo reservar una mesa pa dos personas. |
| ¿Dónde está la estación de tren? | An ye la estación de tren? |
| Este libro es muy interesante. | Iste libro ye muit interesant. |
| Los niños juegan en el parque. | Los ninos chugan en o parque. |
| Necesito ayuda con mi ordenador. | Amenisto aduya con lo mío ordinador. |
| La reunión comenzará a las diez de la mañana. | La reunión prencipiará a las diez d'o maitín. |
from transformers import AutoTokenizer
from optimum.onnxruntime import ORTModelForSeq2SeqLM
model_id = "TigreGotico/aina-translator-es-an-onnx"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = ORTModelForSeq2SeqLM.from_pretrained(model_id) # fp32
# int8: ORTModelForSeq2SeqLM.from_pretrained(model_id, subfolder="int8")
text = "Hola, ¿cómo estás?"
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))
# Ola, cómo yes?
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-es-an.
Contact for the original model: [email protected].