Nour-Sama v1.2.0 (AmeinEskinder/nour-sama)

Live Interactive CPU Demo: https://huggingface.co/spaces/nour-world/nour-sama-demo
Nour-Sama (nour-sama, v1.2.0) is an open-weights, zero-API-key, dual-mode streaming (320 ms causal) + full-utterance bidirectional Temporal U-Net Squeezeformer (Kim et al., NeurIPS 2022) for Quranic phoneme (tj3) recognition, 20 ms speech-rate-normalized Madd duration measurement, and calibrated Tajweed verification.
Attribution & License (Quran-Lab NPL-1.2 Share-Alike)
Nour-Sama was initially distilled from Quran-Lab/TajweedFormer V4 (v4.0.0) via its official public C SDK and subsequently refined in v1.2.0 on leakage-audited multi-reciter clean Hafs studio audio (nour-world/QuranTTS + canonical EveryAyah train reciters), human-annotated phonetic/sifat recitations (obadx/muaalem-annotated-v3), and learner phone recordings (tlog-clean-sf16k), accompanied by a Sama-native calibration.json fitted directly on Nour-Sama's own multi-head outputs.
All weights, ONNX graphs, calibration tables, and code in this repository are governed by the Quran-Lab No-Profit License Version 1.2 (NPL-1.2) (LICENSE). Under NPL-1.2 Sections 2 & 7 (Share-Alike), commercial use or charging for Nour-Sama or any feature it powers is strictly prohibited.
What Changed in v1.2.0
- Sama-Native
calibration.json (model_id: "nour-sama", version: "1.2.0"): Replaced legacy v4.0 calibration copy-over with empirical speaker-balanced LLR quantile tables, NLL-optimal per-head temperatures, conf-gated false-alarm suppression, and Pareto-optimal log_probs + inter1_log_probs fusion weights fitted natively across c8_l64, c16_l64, c24_l72, c24_l256, and full.
- Stage-3 Clean Studio + Real Human Mistake Polish: Eliminated Stage-2 studio starvation and synthetic WSOLA insertion bias using a strict zero-leakage
50% clean multi-reciter Hafs studio + 30% real human phonetic/sifat deviations + 20% clean phone-mic mix with a 0.25-weight self-distillation timing anchor.
- 20 ms Speech-Rate-Normalized Monotonic HSMM Madd Decoder: Estimates local
haraka_ms per utterance from realized short vowels (a, i, u) on timing_log_probs (20 ms) + boundary (20 ms), smoothing 1-frame boundary flicker without extra parameters.
- Lean 11-Head ONNX Graph: Stripped the unused
inter4_log_probs head projection from the exported ONNX graph and enabled selective subgraph output execution in NourSamaEngine.
Efficiency, Deployment & Accuracy Comparison
Evaluation Transparency Note: On the Quran-Lab/quranic-asr-leaderboard, Quran Lab scores models on a private mistake audio panel (official board.json V4 checker = 63.39). Below we report: (1) the exact public 600-clip Quran-Lab/quranic-asr-benchmark (score.py + quran-p2g, told_ayah = False, zero overlap with training), and (2) our local held-out Checker suite (TajweedFormer V4 = 57.6 vs Nour-Sama) alongside V4's official board.json reference, with paired bootstrap 95% confidence intervals (B = 2,000).
1. System Footprint & 4-Way Runtime Matrix (full vs c16_l64 x FP32 vs INT8)
| System / Mode |
Params |
Disk Size |
1-Thread CPU RTF |
License |
External API Key |
Held-Out checker (95% CI) |
Studio / Phone left_alone |
Pinpoint Overall (long_short) |
Held-Out PER Studio / Phone |
600-Clip ALL WER / CER (95% CI) |
Nour-Sama v1.2.0 (full INT8) |
47.96M |
50.39 MB |
0.0457x |
NPL-1.2 |
None (Open ONNX) |
65.22 [62.37, 68.11] |
96.0% / 86.0% |
39.44% (24.44%) |
0.1% / 0.42% |
12.29% / 5.71% [10.98%, 13.66%] |
Nour-Sama v1.2.0 (full FP32) |
47.96M |
183.57 MB |
0.044x |
NPL-1.2 |
None (Open ONNX) |
65.62 [62.82, 68.56] |
96.0% / 86.5% |
40.0% (25.56%) |
0.1% / 0.41% |
12.26% / 5.71% |
Nour-Sama v1.2.0 (c16_l64 320ms INT8) |
47.96M |
50.39 MB |
0.4931x |
NPL-1.2 |
None (Open ONNX) |
60.14 [57.01, 63.28] |
89.0% / 71.0% |
40.28% (28.89%) |
0.3% / 1.0% |
13.3% / 6.21% |
Nour-Sama v1.2.0 (c16_l64 320ms FP32) |
47.96M |
183.57 MB |
0.5772x |
NPL-1.2 |
None (Open ONNX) |
59.86 [56.82, 62.94] |
89.0% / 71.0% |
39.72% (27.78%) |
0.3% / 1.01% |
13.36% / 6.24% |
Nour-Sama v1.1.0 (full INT8, prior) |
47.96M |
50.41 MB |
0.296x |
NPL-1.2 |
None (Open ONNX) |
60.49 |
86.0% / 76.5% |
39.72% (24.44%) |
0.20% / 0.63% |
13.57% / 6.15% |
| TajweedFormer V4 (Same Local H2H Suite) |
Undisclosed |
~57 MB .tfm |
Native C |
NPL-1.2 |
Required (sdk.quranlab.ai) |
57.6 |
99.5% / 81.5% |
24.7% (6.67%) |
0.02% / 0.62% |
9.22% / 3.91% |
TajweedFormer V4 (Official Private board.json) |
Undisclosed |
~57 MB .tfm |
Native C |
NPL-1.2 |
Required (sdk.quranlab.ai) |
63.39 [57.72, 68.90] |
79.04% overall |
47.74% (15.08%) |
0.57% / 1.98% |
4.22% (board panel) |
2. Leakage-Free 600-Clip Quran-Lab/quranic-asr-benchmark (told_ayah = False, Official score.py + quran-p2g)
Source Split (n = 200 each) |
Nour-Sama v1.2.0 (full INT8) WER / CER |
Nour-Sama v1.2.0 (c16_l64 320ms INT8) WER / CER |
Nour-Sama v1.1.0 WER / CER |
TajweedFormer V4 (c16_l64) WER / CER |
Tarteel Official Realtime WER / CER |
Whisper-Large-v3 WER / CER |
everyayah_heldout (3 unseen studio reciters) |
7.6% / 3.31% |
8.85% / 3.81% |
9.46% / 3.88% |
4.91% / 1.68% |
4.57% / 2.73% |
7.75% / 3.28% |
qul_alnufais (unseen Al-Nufais reciter) |
12.26% / 6.45% |
12.72% / 6.77% |
12.67% / 6.59% |
8.64% / 4.12% |
9.69% / 6.43% |
10.17% / 4.95% |
tlog_holdout (unseen real phone-mic learners) |
19.92% / 8.54% |
21.43% / 9.32% |
21.63% / 9.25% |
17.09% / 7.34% |
18.71% / 12.26% |
17.03% / 8.81% |
ALL (600 clips) |
12.29% / 5.71% |
13.3% / 6.21% |
13.57% / 6.15% |
9.22% / 3.91% |
10.99% / 7.14% |
11.65% / 5.68% |
3. Official Quran-Lab/quran-tajweed-benchmark (3910 Recordings, Unmodified score_v4_bench.py)
Scored directly with Quran Lab's official scorer/score_v4_bench.py + scorer/word_map.json.gz (--word-source tj3, told_ayah = False) and B = 2,000 speaker-cluster bootstrap 95% CIs across the 16 unseen professional reciters of t1p_panel_correct_test (1,780 clips, 4.24 hours — zero overlap with training):
System / Runtime Mode (t1p_panel_correct_test, n = 1,780) |
PER_raw (95% CI) |
PER_free_edges (95% CI) |
PER_len_insensitive |
left_alone (100 - clip_word_FA_fe, 95% CI) |
Word False-Alarm (word_FA_fe) |
quran-p2g WER (95% CI) |
Nour-Sama v1.2.0 (full INT8) |
3.03% [1.81%, 4.34%] |
2.37% [1.41%, 3.48%] |
2.92% |
62.3% [50.90%, 74.47%] |
8.81% |
17.3% [14.08%, 20.62%] |
Nour-Sama v1.2.0 (full FP32) |
3.05% [1.84%, 4.32%] |
2.38% [1.44%, 3.48%] |
2.94% |
62.19% [50.90%, 74.23%] |
8.84% |
17.35% [14.18%, 20.63%] |
Nour-Sama v1.2.0 (c16_l64 320ms INT8) |
4.08% [2.41%, 5.87%] |
3.36% [2.02%, 4.90%] |
3.87% |
50.9% [38.20%, 65.05%] |
12.45% |
20.43% [16.24%, 24.66%] |
Nour-Sama v1.2.0 (c16_l64 320ms FP32) |
4.06% [2.41%, 5.84%] |
3.35% [2.02%, 4.90%] |
3.85% |
50.79% [37.92%, 65.01%] |
12.47% |
20.36% [16.20%, 24.53%] |
TajweedFormer V4 (Official predictions/tajweedformer-v4.json) |
0.83% [0.40%, 1.45%] |
0.57% [0.29%, 1.02%] |
0.79% |
88.6% [83.00%, 93.31%] |
2.2% |
11.64% [10.31%, 13.15%] |
Breakdown Across All Released Quran-Lab/quran-tajweed-benchmark Tiers (Nour-Sama v1.2.0 full INT8)
| Benchmark Tier |
Clips |
Hours |
PER_raw |
PER_free_edges |
PER_len_insensitive |
left_alone (free_edges) |
word_FA_free_edges |
t1_correct_unseen |
153 |
0.34h |
0.43% |
0.4% |
0.43% |
83.66% |
2.44% |
t1p_panel_correct_dev |
930 |
2.2h |
1.67% |
1.3% |
1.62% |
77.96% |
4.63% |
t1p_panel_correct_test |
1780 |
4.24h |
3.03% |
2.37% |
2.92% |
62.30% |
8.81% |
t1w_women_correct_test |
3 |
0.03h |
57.14% |
57.14% |
56.35% |
0.00% |
82.61% |
t1x_correct_seen_in_mix_v1 |
1044 |
2.37h |
2.45% |
2.31% |
2.39% |
58.81% |
9.44% |
Real Human Mistake Held-Out Evaluation (Muaalem + TLOG Non-Synthetic Deviations)
Unlike synthetic WSOLA/splice benchmarks, this held-out set (n = 63) evaluates real human reciters whose recorded recitation deviates from the canonical Mushaf text:
| System |
Mistake Word Catch (%) |
Exact Single-Word Pinpoint (%) |
Uninvolved Word False-Flag Rate (%) |
Nour-Sama v1.2.0 (full INT8) |
98.41% |
76.19% |
3.96% |
Nour-Sama v1.1.0 (full INT8) |
98.41% |
96.83% |
0.0% |
20 ms Tajweed Attribute Calibration (FP32 vs INT8 on Unseen Muaalem moshaf_29.0 Sifat)
| Runtime Mode |
Mean ECE (15-bin, lower is better) |
Mean Macro-F1 (gem, tafkheem, ghunna, qalqalah) |
full (Bidirectional) FP32 |
0.0019 |
0.8679 |
full (Bidirectional) INT8 |
0.0024 |
0.8733 |
c16_l64 (320 ms Causal) FP32 |
0.0016 |
0.8555 |
c16_l64 (320 ms Causal) INT8 |
0.0014 |
0.8589 |
25-Line Zero-Dependency Python Quickstart (onnxruntime + numpy Only)
import numpy as np, onnxruntime as ort, soundfile as sf
from huggingface_hub import hf_hub_download
TOKENS = ("<blk>","|","ء","ب","ت","ث","ج","ح","خ","د","ذ","ر","ز","س","ش","ص","ض","ط","ظ","ع","غ","ف","ق","ك","ل","م","ن","ه","و","ي","ں","a","i","u","aa","ii","uu","<foreign>")
for _repo in ("AmeinEskinder/nour-sama", "AmeinEskinder/nour-sama"):
try:
onnx_p = hf_hub_download(_repo, "nour_sama_v1.2.int8.onnx"); break
except Exception:
onnx_p = None
sess = ort.InferenceSession(onnx_p, providers=["CPUExecutionProvider"])
def log_mel_16k(wav_16k: np.ndarray) -> np.ndarray:
hz = 700.0 * (10.0 ** (np.linspace(2595*np.log10(1+20/700), 2595*np.log10(1+7600/700), 82) / 2595.0) - 1.0)
freqs = np.linspace(0.0, 8000.0, 257)
fb = np.array([np.maximum(0, np.minimum((freqs-hz[m])/(hz[m+1]-hz[m]), (hz[m+2]-freqs)/(hz[m+2]-hz[m+1]))) for m in range(80)], dtype=np.float32).T
pad = np.pad(np.asarray(wav_16k, dtype=np.float32), (240, 10240))
pad = np.pad(pad, (0, (5120 - (len(pad) - 240) % 5120) % 5120))
win = (0.5 - 0.5 * np.cos(2.0 * np.pi * np.arange(400) / 400.0)).astype(np.float32)
frames = np.lib.stride_tricks.as_strided(pad, ((len(pad)-400)//160 + 1, 400), (pad.strides[0]*160, pad.strides[0])) * win
mel = ((np.log(np.maximum((np.abs(np.fft.rfft(frames, n=512))**2) @ fb, 1e-10)) + 4.5) / 2.5).astype(np.float32)
return mel[None, : (mel.shape[0] // 32) * 32, :]
wav, sr = sf.read("ayah_16k.wav", dtype="float32")
mel = log_mel_16k(wav)
lp_full, tm_20 = sess.run(["log_probs", "timing_log_probs"], {"mel_10": mel, "streaming_flag": np.array([0.0], np.float32)})
ids = [int(k) for k in np.argmax(lp_full[0], axis=-1)]
tj3_phones = [TOKENS[g] for i, g in enumerate(ids) if g > 1 and (i == 0 or g != ids[i - 1])]
stream_lp = [sess.run(["log_probs"], {"mel_10": mel[:, max(0, min(mel.shape[1], t+64)-768):min(mel.shape[1], t+64), :], "streaming_flag": np.array([1.0], np.float32)})[0][0, -16:-8] if t+64 <= mel.shape[1] else sess.run(["log_probs"], {"mel_10": mel[:, max(0, mel.shape[1]-768):mel.shape[1], :], "streaming_flag": np.array([1.0], np.float32)})[0][0, -8:] for t in range(0, mel.shape[1], 32)]
print("Decoded tj3:", " ".join(tj3_phones))
ONNX Input / Output Tensor Contract (11 Exported Heads)
Inputs
| Input Name |
Shape |
Dtype |
Description |
mel_10 |
[batch, T_10, 80] |
float32 |
Normalized causal HTK log-mel spectrogram (16 kHz, n_fft=512, win_length=400, hop_length=160, fmin=20, fmax=7600, (log(mel) + 4.5) / 2.5; T_10 divisible by 4). |
streaming_flag |
[1] |
float32 |
0.0 for full-utterance bidirectional conv+attention context; 1.0 for zero-lookahead causal streaming (c8_l64 160 ms, c16_l64 320 ms, c24_l72 480 ms). |
Outputs (T_40 = T_10 // 4, T_20 = T_10 // 2)
| Output Name |
Shape |
Rate |
Activation |
Classes & Meaning |
log_probs |
[batch, T_40, 38] |
40 ms |
log_softmax |
Main unprompted tj3 phoneme CTC head (fused 40 ms trunk + 20 ms U-Net duration feedback). |
inter1_log_probs |
[batch, T_40, 38] |
40 ms |
log_softmax |
Early Block-3 auxiliary tj3 CTC head fused with log_probs by TajweedJudge (calibration.json). |
id_log_probs |
[batch, T_20, 38] |
20 ms |
log_softmax |
High-rate 50 Hz phone identity CTC head. |
timing_log_probs |
[batch, T_20, 38] |
20 ms |
log_softmax |
Frame-dense 50 Hz phonetic alignment head powering the HSMM Madd harakat duration decoder. |
gem |
[batch, T_20, 2] |
20 ms |
softmax |
Shaddah / gemination state: 0: single, 1: held. |
attr_tafkheem |
[batch, T_20, 3] |
20 ms |
softmax |
Pharyngealization / heaviness: 0: thin (muraqqaq), 1: heavy (mufakhkham), 2: low_heavy. |
attr_ghunna |
[batch, T_20, 5] |
20 ms |
softmax |
Nasalization class: 0: none, 1: plain, 2: geminate, 3: ikhfa, 4: idgham. |
attr_qalqalah |
[batch, T_20, 3] |
20 ms |
softmax |
Qalqalah release burst: 0: none, 1: sughra, 2: kubra. |
attr_face |
[batch, T_20, 4] |
20 ms |
softmax |
Special Hafs articulation: 0: none, 1: imala, 2: tasheel, 3: sakt. |
boundary |
[batch, T_20, 1] |
20 ms |
raw logit |
Phone onset/offset transition logit (sigmoid(boundary) gives boundary probability). |
conf |
[batch, T_20, 1] |
20 ms |
raw logit |
Frame acoustic confidence logit (sigmoid(conf) gates TajweedJudge thresholds). |
Complete 38-Token tj3 Phonetic Vocabulary (vocab.json)
| ID |
Token |
Phonetic / Tajweed Role |
0 |
<blk> |
CTC blank token |
1 |
` |
` |
2 |
ء |
Hamza (ء) |
3 |
ب |
Beh (ب) |
4 |
ت |
Teh (ت) |
5 |
ث |
Theh (ث) |
6 |
ج |
Jeem (ج) |
7 |
ح |
Hah (ح) |
8 |
خ |
Khah (خ) |
9 |
د |
Dal (د) |
10 |
ذ |
Thal (ذ) |
11 |
ر |
Reh (ر) |
12 |
ز |
Zain (ز) |
13 |
س |
Seen (س) |
14 |
ش |
Sheen (ش) |
15 |
ص |
Sad (ص) |
16 |
ض |
Dad (ض) |
17 |
ط |
Tah (ط) |
18 |
ظ |
Zah (ظ) |
19 |
ع |
Ain (ع) |
20 |
غ |
Ghain (غ) |
21 |
ف |
Feh (ف) |
22 |
ق |
Qaf (ق) |
23 |
ك |
Kaf (ك) |
24 |
ل |
Lam (ل) |
25 |
م |
Meem (م, incl. iqlab / ikhfa shafawi) |
26 |
ن |
Noon (ن) |
27 |
ه |
Heh (ه) |
28 |
و |
Waw (و, consonant / leen) |
29 |
ي |
Yeh (ي, consonant / leen) |
30 |
ں |
Ikhfa nasal (ں, place-assimilated nasal) |
31 |
a |
Short fatha (a) |
32 |
i |
Short kasra (i) |
33 |
u |
Short damma (u) |
34 |
aa |
Long alif madd (aa, incl. 11:41 imala) |
35 |
ii |
Long yaa madd (ii) |
36 |
uu |
Long waw madd (uu) |
37 |
<foreign> |
Non-Quranic / foreign sound (<foreign>) |