Tashkeel-v3 (Gyoom copy)

Gyoom's copy of ahmedsamirtarjama/Tashkeel-v3 at revision 98b3985c, the one Hammel AI TTS is tested on. Upstream has replaced its weights since, so this copy keeps that version available.

  • Unchanged: every other file is byte for byte upstream's at that revision. Of its two weight files only model.safetensors is kept; pytorch_model.bin is left out.
  • Added: this header and LICENSE, the Apache-2.0 text upstream's card names.
  • Inference needs model.safetensors, tokenizer.json and tokenizer_config.json. Load the weights in fp32: transformers 5 defaults to bf16, which changes the output.
hf download gyoom-sa/Tashkeel-v3 model.safetensors tokenizer.json tokenizer_config.json \
  --local-dir models/tashkeel-v3

The model card below is upstream's, unchanged.


Tashkeel-v3: SOTA Arabic Diacritizer (Morpheme-Aware MARBERTv2 + Linear-Chain CRF)

Tashkeel-v3 is a state-of-the-art neural Arabic diacritization model achieving 2.85% DER / 7.91% WER on the Misraj/SadeedDiac-25 benchmark and 6.37% DER / 17.39% WER on Bisher/CATT_benchmark.


🌟 Key Features

  1. Linear-Chain Conditional Random Field (CRF) & Viterbi Decoding:

    • Integrates a global transition matrix $\mathbf{A}_{15 \times 15}$ that penalizes phonologically illegal transitions (e.g. consecutive Tanweens, improper geminations, illegal boundary vowels).
    • Global Viterbi Decoding searches the sentence space for the globally optimal diacritization sequence.
  2. Decoupled Multi-Task Heads (Lexical Stem vs. Terminal I'rab):

    • Dedicated heads for word-interior morphological diacritics and terminal syntactic case endings.
  3. Morpheme & Clitic Disambiguation:

    • Character-level sub-token projection with proclitic/stem/enclitic segmentation embeddings.
  4. Zero Hallucinations (0.00%):

    • Every input consonant, digit, and punctuation mark is preserved 100% identically without any dropped tokens or runaway repetitions.
  5. High Inference Speed:

    • ~1,164 to 1,523 sentences per second on a single NVIDIA GPU.

📊 Benchmark Evaluation on Misraj/SadeedDiac-25 (1,200 sentences)

Model / System Total Scored Hallucination Rate Total DER (CE) ↓ Morph DER (w/o CE) ↓ Total WER (CE) ↓ Morph WER (w/o CE) ↓ Inference Speed
Claude-3.7-Sonnet 1,190 / 1,200 0.82% 1.39% 0.77% 4.67% 2.31% ~5 sent/s
Tashkeel-v3 (This Model) 1,200 / 1,200 0.00% 2.85% 2.13% 7.91% 🏆 5.54% 🏆 ~1,164 sent/s ⚡
Tashkeel-v2 1,200 / 1,200 0.00% 2.85% 2.13% 8.02% 5.66% ~898 sent/s
Gemini-Flash-2.0 1,186 / 1,200 1.17% 3.19% 2.38% 7.99% 5.50% ~20 sent/s
Tashkeel-50M (v1) 12 / 1,200* ~99.0%* 3.08%* 2.26%* 9.56%* 6.77%* ~25 sent/s
GPT-4 1,188 / 1,200 1.02% 3.86% 3.86% 5.27% 10.93% ~10 sent/s
Sadeed (Published Paper) 1,114 / 1,200 7.19% 7.29% 5.26% 13.74% 9.92% ~35 sent/s
tash2 (50M Baseline) 1,199 / 1,200 0.08% 15.29% 11.41% 24.36% 20.40% ~25 sent/s

* Note on Causal LLMs: Scores calculated only on the subset of non-hallucinated generations.


📈 Out-of-Domain Generalization on Bisher/CATT_benchmark (742 sentences)

Model / System Total Scored Hallucination Rate Total DER (CE) ↓ Morph DER (w/o CE) ↓ Total WER (CE) ↓ Morph WER (w/o CE) ↓ Inference Speed
Tashkeel-v3 (This Model) 742 / 742 0.00% 6.37% 🏆 5.33% 🏆 17.39% 🏆 14.84% 🏆 ~1,523 sent/s ⚡
Tashkeel-v2 742 / 742 0.00% 6.41% 5.35% 17.66% 15.01% ~1,470 sent/s

🚀 Quickstart & Usage

1. Installation

pip install torch transformers pyarabic

2. Python Inference Code

import torch
from transformers import AutoModel, AutoTokenizer

# Load Tashkeel-v3 directly from Hugging Face Hub
model_id = "ahmedsamirtarjama/Tashkeel-v3"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModel.from_pretrained(model_id, trust_remote_code=True).cuda()

# Single sentence diacritization
text = "ذهب الطالب المجتهد إلى المدرسة صباحا"
output = model.diacritize(text, tokenizer=tokenizer)
print(output)
# Output: ذَهَبَ الطَّالِبُ الْمُجْتَهِدُ إِلَى الْمَدْرَسَةِ صَبَاحًا

# Batched inference
sentences = [
    "سطا لصوص على منزل وزيرة الدفاع التشيلية",
    "إن مع العسر يسرا",
    "العلم نور والجهل ظلام"
]
outputs = model.diacritize(sentences, tokenizer=tokenizer, batch_size=64)
for inp, out in zip(sentences, outputs):
    print(f"{inp} -> {out}")

🏗️ Model Architecture

                                [Input Arabic Text]
                                         │
                             ┌───────────┴───────────┐
                             ▼                       ▼
                    [Shared MARBERTv2]     [Morpheme + Position Embeddings]
                             │                       │
                             └───────────┬───────────┘
                                         ▼
                             [Bidirectional LSTM (384x2)]
                                         │
                             ┌───────────┴───────────┐
                             ▼                       ▼
                       [Stem Head]             [I'rab Head]
                       (Internal Diac)         (Terminal Case)
                             │                       │
                             └───────────┬───────────┘
                                         ▼
                           [Combined Emission Logits]
                                         │
                                         ▼
                       [Linear-Chain CRF Transition Matrix (A)]
                                         │
                                         ▼
                           [Global Viterbi Decoding (y*)]

📜 Citation

@misc{samir2026tashkeelv3,
  author = {Ahmed Samir},
  title = {Tashkeel-v3: SOTA Arabic Diacritization with Morpheme-Aware MARBERT and Linear-Chain CRF},
  year = {2026},
  publisher = {Hugging Face},
  howpublished = {\url{https://huggingface.co/ahmedsamirtarjama/Tashkeel-v3}}
}
Downloads last month
33
Safetensors
Model size
0.2B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support