AraT5 Arabic dialects -> MSA translation - ONNX
ONNX export of
PRAli22/arat5-arabic-dialects-translation,
an AraT5-based model translating Arabic dialects (Gulf, Egyptian, Levantine,
Maghrebi, etc.) into Modern Standard Arabic (MSA).
Licence: apache-2.0, as declared by the source repository.
Provenance note: this is a single-author community model (6 downloads,
3 likes on the source repo at the time of conversion), not an institutional
release. It was spot-checked before conversion effort was invested: it
loads correctly and produces sensible, non-degenerate MSA output for
Gulf/Egyptian/Levantine/Maghrebi test sentences (see parity section) - it
is not a broken or abandoned checkpoint, but treat its quality claims with
the caution due any single-author model without institutional validation.
Contents
| Files | What it is |
|---|
encoder_model.onnx, decoder_model.onnx, decoder_with_past_model.onnx | ONNX, float32 |
int8/ | same three graphs, dynamic int8 |
fp32 size: ~2.8 GB | int8 size: ~1.9 GB
Usage
1from optimum.onnxruntime import ORTModelForSeq2SeqLM
2from transformers import AutoTokenizer
3
4repo = "TigreGotico/arat5-arabic-dialects-translation-onnx"
5tok = AutoTokenizer.from_pretrained(repo)
6model = ORTModelForSeq2SeqLM.from_pretrained(repo, use_cache=True, use_merged=False) # fp32
7# int8: ORTModelForSeq2SeqLM.from_pretrained(repo, subfolder="int8", use_cache=True, use_merged=False)
8inputs = tok("شلونك اليوم؟ شخبارك؟", return_tensors="pt")
9out = model.generate(**inputs, num_beams=4, max_new_tokens=64)
10print(tok.decode(out[0], skip_special_tokens=True))
11# -> كيف حالك اليوم؟ كيف حالك؟
Parity with the original PyTorch model
5 Arabic dialect sentences (Gulf, Egyptian, Levantine, Maghrebi),
exact-string-match of generated output against AutoModelForSeq2SeqLM.generate()
on the original checkpoint.
1parity:
2 sample_size: 5
3 metric: exact_match
4 fp32_greedy: 1.00 # 5/5
5 fp32_beam4: 1.00 # 5/5
6 int8_greedy: 0.40 # 2/5
7 int8_beam4: 0.60 # 3/5
| Decoding | fp32 (n=5) | int8 (n=5) |
|---|
| greedy | 100% (5/5) | 40% (2/5) |
| beam=4 | 100% (5/5) | 60% (3/5) |
fp32 is an exact reproduction of the original model. int8 shows real
quality variance on this small (5-sentence) sample - larger than most
other conversions in this org's inventory - but disagreements were
inspected by hand and are paraphrase-level (e.g. ref "بصحة جيدة" vs int8
"بحالة جيدة", both meaning "in good health/condition"), not garbled or
wrong-language output. In one case the int8 output ("كيف حالك اليوم؟",
"how are you today?") is arguably a more faithful translation than the
reference's own output ("كيف حال الطقس اليوم؟", "how is the weather
today?") for a source sentence that does not mention weather - a
reminder that "parity" here means matching the original checkpoint, not
independently verified correctness.
Caveat on sample size: n=5 is a very small smoke-test - the int8
percentages above should be read as an initial signal only, not a stable
quality figure. Prefer fp32 for this model until a larger evaluation is
available.