Downloads · 30 days
7
17% of all-time downloads
TigreGotico/opus-mt-tc-big-en-cat_oci_spa-onnx
opus-mt-tc-big-en-cat_oci_spa-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.js. The card lists the license as cc-by-4.0.
ONNX export of Helsinki-NLP/opus-mt-tc-big-en-catocispa, a MarianMT model translating English → Catalan / Occitan / Spanish.
Downloads · 30 days
7
17% of all-time downloads
All-time downloads
41
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-en-cat_oci_spa, a MarianMT model translating English → Catalan / Occitan / Spanish.
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.
Adds Occitan coverage, which has almost no other machine-translation options.
This is a multilingual, one-to-many model. The target language is selected by a >>xxx<< token
prepended to the input text — transformers/optimum does not add this automatically. Omitting it
does not raise an error: the model silently produces fluent text in an unpredictable language.
Example: >>oci<< Why do you want Tom to go there with me? → Perqué volètz que Tom se'n vai ? (English →
Occitan)
>>cat<< >>oci<< >>spa<<
(source: verified directly against the exported MarianTokenizer vocabulary — the upstream README's "valid
target language labels" line only lists >>cat<< and >>spa<<, but >>oci<< is present in the tokenizer and
is benchmarked in the model card, e.g. eng-oci flores101-devtest BLEU 25.4. Always trust the tokenizer vocab
over an incomplete README line.)
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 .onnx.data / .onnx_data external-data files were produced (all three graphs stayed under the 2GB
protobuf inline limit, largest being decoder_model.onnx at ~855MB fp32).
optimum-cli export onnx --model Helsinki-NLP/opus-mt-tc-big-en-cat_oci_spa \
--task text2text-generation-with-past --no-post-process ./fp32
int8: onnxruntime.quantization.quantize_dynamic(weight_type=QUInt8) applied to each of the three graphs
independently, written to int8/.
8 sentences covering en→oc, en→ca, en→es with the correct >>xxx<< token, PyTorch (MarianMTModel) vs ONNX
(ORTModelForSeq2SeqLM), num_beams=4, max_new_tokens=64, exact string match after decoding:
from transformers import AutoTokenizer
from optimum.onnxruntime import ORTModelForSeq2SeqLM
tok = AutoTokenizer.from_pretrained("TigreGotico/opus-mt-tc-big-en-cat_oci_spa-onnx")
model = ORTModelForSeq2SeqLM.from_pretrained("TigreGotico/opus-mt-tc-big-en-cat_oci_spa-onnx")
text = ">>oci<< Why do you want Tom to go there with me?"
ids = model.generate(**tok(text, return_tensors="pt"), num_beams=4, max_new_tokens=64)
print(tok.decode(ids[0], skip_special_tokens=True))
# Perqué volètz que Tom se'n vai ?
For int8, pass subfolder="int8" instead.