Downloads · 30 days
8
19% of all-time downloads
TigreGotico/aina-translator-es-oc-onnx
aina-translator-es-oc-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-oc, Projecte Aina's (Barcelona Supercomputing Center, Language Technologies Unit) Spanish → Aranese (Gascon Occitan, Val d'Aran variety) machine translation model. All c…
Downloads · 30 days
8
19% of all-time downloads
All-time downloads
42
Public
Repo size
9.3 GB
Likes
0
Public
Click a slice to open those files.
.onnx_data7.6 GB · 81%
From the Hugging Face model README
ONNX export of projecte-aina/aina-translator-es-oc,
Projecte Aina's (Barcelona Supercomputing Center, Language Technologies Unit) Spanish → Aranese
(Gascon Occitan, Val d'Aran variety) 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.
Occitan 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-oc).
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(_data) dynamic-quantized (uint8) encoder
int8/decoder_model.onnx(_data) dynamic-quantized (uint8) decoder
int8/decoder_with_past_model.onnx(_data) dynamic-quantized (uint8) decoder w/ cache
sentencepiece.bpe.model, tokenizer.json, tokenizer_config.json, ... tokenizer files (NLLB-style SentencePiece)
fp32 total: ~6.9 GB. int8 total: ~1.8 GB.
Model files exceed the single-file size ONNX allows, so weights are stored as external data
(*.onnx_data next to each *.onnx graph file — note the underscore, not a dot, which is what
transformers/optimum expect when loading from the Hub).
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-oc \
--task text2text-generation-with-past \
--no-post-process \
aina-translator-es-oc-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 (onnxruntime.quantization.quantize_dynamic, QUInt8 weights) was applied to
each of the three graphs.
This is a single-direction fine-tune: Spanish → Aranese (Val d'Aran Occitan) only, no target
forcing needed at inference time. The base NLLB-200 tokenizer doesn't have a language tag for
Aranese, so Projecte Aina added a new special token, arn_Latn, to the tokenizer and fixed
tokenizer_config.json to src_lang: spa_Latn, tgt_lang: arn_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 Aranese output. Do not pass forced_bos_token_id explicitly; it is unnecessary
and there is no NLLB oci_Latn real-Occitan-standard tag being used here — arn_Latn is a
model-specific stand-in id 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) | 8/8 = 100.0% |
Sample translations observed (es → oc/Aranese):
| Spanish | Aranese (Aina / ONNX, identical) |
|---|---|
| Hola, ¿cómo estás? | Hola, Com ès? |
| El tiempo hoy es muy bueno. | Eth temps aué ei fòrça bon. |
| Me gustaría reservar una mesa para dos personas. | M'agradarie reservar ua taula entà dues persones. |
| ¿Dónde está la estación de tren? | A on ei era estacion de trèn? |
| Este libro es muy interesante. | Aguest libre ei fòrça interessant. |
| Los niños juegan en el parque. | Es mainatges jòguen en parc. |
| Necesito ayuda con mi ordenador. | È de besonh ajuda damb eth mèn ordinador. |
| La reunión comenzará a las diez de la mañana. | Era amassada començarà tàs dètz deth maitin. |
from transformers import AutoTokenizer
from optimum.onnxruntime import ORTModelForSeq2SeqLM
model_id = "TigreGotico/aina-translator-es-oc-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))
# Hola, Com ès?
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-oc.
Contact for the original model: [email protected].