Downloads · 30 days
12
23% of all-time downloads
TigreGotico/opus-mt-tc-big-cat_oci_spa-en-onnx
opus-mt-tc-big-cat_oci_spa-en-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-4.0.
ONNX export of Helsinki-NLP/opus-mt-tc-big-catocispa-en, a MarianMT model translating Catalan / Occitan / Spanish → English.
Downloads · 30 days
12
23% of all-time downloads
All-time downloads
53
Public
Repo size
2.7 GB
Likes
0
Public
Click a slice to open those files.
.onnx2.7 GB · 100%
From the Hugging Face model README
ONNX export of Helsinki-NLP/opus-mt-tc-big-cat_oci_spa-en, a MarianMT model translating Catalan / Occitan / Spanish → English.
Licence: cc-by-4.0 (verbatim from the upstream model card).
Attribution: model trained and published by Helsinki-NLP / University of Helsinki, OPUS-MT / Tatoeba
Translation Challenge project (opusTCv20210807+bt_transformer-big_2022-03-13). This repository only
republishes an ONNX conversion of their weights; no model changes were made.
This completes the reverse direction of TigreGotico/opus-mt-tc-big-en-cat_oci_spa-onnx (English → cat/oci/spa), giving round-trip coverage for Occitan, which has almost no other machine-translation options.
Unlike the reverse (English → cat/oci/spa) direction, this model is many-to-one: Catalan,
Occitan, and Spanish source text all map to a single target language, English. No >>xxx<< token
or forced_bos_token_id is needed — the source language is auto-detected by the encoder from the
sentencepiece-tokenized input itself, and generation always produces English. A plain
tokenizer(text) + model.generate() call (as in the upstream model card's own usage example) is
sufficient regardless of which of the three source languages is used.
encoder_model.onnx, decoder_model.onnx, decoder_with_past_model.onnx (fp32, repo root)
source.spm, target.spm, vocab.json, tokenizer_config.json, special_tokens_map.json, config.json, generation_config.json
int8/
encoder_model.onnx, decoder_model.onnx, decoder_with_past_model.onnx (dynamic QUInt8 quantization)
(+ copies of the tokenizer files)
No external-data files were produced (all three graphs stayed under the 2GB protobuf inline limit). fp32 total ~2.6GB.
optimum-cli export onnx --model Helsinki-NLP/opus-mt-tc-big-cat_oci_spa-en \
--task text2text-generation-with-past --no-post-process opus-mt-tc-big-cat_oci_spa-en-onnx
--no-post-process avoids optimum's decoder-merge step, which OOMs on constrained hardware for
this model size. int8 dynamic quantization (optimum.onnxruntime.ORTQuantizer, AVX2 config) was
applied to each of the three graphs, written to int8/.
8 sentences covering ca→en, oc→en (implicit via shared merged-source vocabulary), and es→en, PyTorch
(MarianMTModel) vs ONNX (ORTModelForSeq2SeqLM), num_beams=4, max_new_tokens=64, exact string
match after decoding:
Sample translations observed (matches the upstream model card's own worked examples):
| Source (es) | English (Helsinki-NLP / ONNX, identical) |
|---|---|
| ¿Puedo hacerte una pregunta? | Can I ask you a question? |
| Toca algo de música. | He plays some music. |
| El tiempo hoy es muy bueno. | The weather today is very good. |
| Me gustaría reservar una mesa para dos personas. | I would like to reserve a table for two people. |
| ¿Dónde está la estación de tren? | Where is the train station? |
| Este libro es muy interesante. | This book is very interesting. |
| Los niños juegan en el parque. | Children playing in the park. |
| Necesito ayuda con mi ordenador. | I need help with my computer. |
from transformers import AutoTokenizer
from optimum.onnxruntime import ORTModelForSeq2SeqLM
tok = AutoTokenizer.from_pretrained("TigreGotico/opus-mt-tc-big-cat_oci_spa-en-onnx")
model = ORTModelForSeq2SeqLM.from_pretrained("TigreGotico/opus-mt-tc-big-cat_oci_spa-en-onnx")
text = "¿Puedo hacerte una pregunta?"
ids = model.generate(**tok(text, return_tensors="pt"), num_beams=4, max_new_tokens=64)
print(tok.decode(ids[0], skip_special_tokens=True))
# Can I ask you a question?
For int8, pass subfolder="int8" instead.
All modeling and training work is by Helsinki-NLP (University of Helsinki, OPUS-MT / Tatoeba Translation Challenge project) — this repository only republishes an ONNX conversion of their weights for offline/CPU inference. Source model: Helsinki-NLP/opus-mt-tc-big-cat_oci_spa-en.