Downloads · 30 days
49
56% of all-time downloads
TigreGotico/vinai-translate-vi2en-v2-onnx
vinai-translate-vi2en-v2-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 agpl-3.0.
ONNX export of vinai/vinai-translate-vi2en-v2, VinAI Research's Vietnamese - English mBART-based translation model - the reverse direction of the existing opus-mt-en-vi already in this org's inventory, and generally c…
Downloads · 30 days
49
56% of all-time downloads
All-time downloads
87
Public
Repo size
3.5 GB
Likes
0
Public
Click a slice to open those files.
.onnx3.5 GB · 100%
From the Hugging Face model README
ONNX export of vinai/vinai-translate-vi2en-v2,
VinAI Research's Vietnamese -> English mBART-based translation model - the
reverse direction of the existing opus-mt-en-vi already in this org's
inventory, and generally considered higher quality than generic OPUS-MT
for this pair.
Licence: AGPL-3.0 (restrictive copyleft), exactly as declared by the source repository. This is recorded accurately and unchanged - the licence is the downstream user's concern, not a reason to skip mirroring, per this org's standing policy, but it is not apache/MIT-permissive and you must comply with AGPL-3.0 terms (including source-disclosure obligations for networked use) if you deploy this model.
The int8 dynamic-quantized build was tested and failed this org's
quality gate: it produces genuine multi-word repetition loops (e.g.
"I want I want Tonight..." and "Thank You You You For Your Help You" -
verified programmatically, not just by eye, for repeated 2-3-word n-grams)
and 0% exact-match agreement with the reference model at both greedy and
beam=4 decoding on a 10-sentence sample. This is a real quantization
failure on this particular mBART-large-class checkpoint, not paraphrase
noise - per this org's hard gate ("does not get published" on failure),
the int8 build is not included in this repository. Only the fp32
build, which is an exact reproduction of the original model, is provided.
If you need a smaller footprint for this language pair, opus-mt-vi-en
style models (if/when converted) may quantize better than this checkpoint.
| Path | Precision | Size |
|---|---|---|
*.onnx (root) | fp32 | ~3.3 GB |
10 general-domain Vietnamese sentences (source language for this
vi->en pair), PyTorch original vs ONNX, exact string match against
AutoModelForSeq2SeqLM.generate().
parity:
sample_size: 10
metric: exact_match
fp32_greedy: 1.00 # 10/10
fp32_beam4: 1.00 # 10/10
int8_greedy: 0.00 # 0/10 - FAILED, not published, see note above
int8_beam4: 0.00 # 0/10 - FAILED, not published, see note above
| Decoding | fp32 (n=10) |
|---|---|
| greedy | 100% (10/10) |
| beam=4 | 100% (10/10) |
Note: start the decoder on en_XX (see below). With that recipe, greedy
output for "Hôm nay thời tiết rất đẹp." is "It's a beautiful day.", the same
as beam search. The rough greedy output "It's aw are you are you?" comes from
the forced_bos_token_id recipe, not from the checkpoint.
Caveat on sample size: n=10 exact-match is a small, noisy estimate for the fp32 numbers - a proper FLORES + chrF evaluation would give a more reliable figure. The int8 failure, by contrast, is not a sample-size artifact - it is a qualitative breakdown (repetition loops) visible on every tested sentence.
This is an mBART checkpoint. The source tag goes on the encoder input, and
the target tag is the first decoder token. Set the tokenizer's src_lang and
pass decoder_start_token_id, as the upstream
VinAI usage does:
tokenizer.src_lang = "vi_VN"
decoder_start_token_id = tokenizer.lang_code_to_id["en_XX"]
model.generate(**inputs, decoder_start_token_id=decoder_start_token_id, ...)
Do not use forced_bos_token_id. With it, transformers starts the decoder
on <s> and forces en_XX as the second token. That is not the sequence
the upstream usage gives the model, and the output is worse. Measured on the first 20 sentences of
FLORES-200 devtest (vie_Latn), greedy, upstream PyTorch weights:
| Recipe | Output differs from upstream recipe | chrF vs FLORES eng_Latn |
|---|---|---|
decoder_start_token_id=en_XX | 0 of 20 | 65.84 |
forced_bos_token_id=en_XX | 20 of 20 | 62.62 |
FLORES line 1, greedy:
decoder_start_token_id: "“We now have a herd of four-month-old mice that have stopped having diabetes,” he added."forced_bos_token_id: "“We have a herd of mi, which are now 4 months old, he added."from transformers import AutoTokenizer
from optimum.onnxruntime import ORTModelForSeq2SeqLM
repo = "TigreGotico/vinai-translate-vi2en-v2-onnx"
tok = AutoTokenizer.from_pretrained(repo, src_lang="vi_VN")
model = ORTModelForSeq2SeqLM.from_pretrained(repo, use_cache=True, use_merged=False)
enc = tok("Hôm nay thời tiết rất đẹp.", return_tensors="pt")
tgt_id = tok.lang_code_to_id["en_XX"]
out = model.generate(**enc, decoder_start_token_id=tgt_id, num_beams=4, max_new_tokens=64)
print(tok.batch_decode(out, skip_special_tokens=True)[0])
# -> It's a beautiful day.