--- license: apache-2.0 language: - ar library_name: onnx pipeline_tag: automatic-speech-recognition tags: - quran - tajweed - whisper - onnx - transformers.js base_model: - Hisnlabs/tajweed-v2 - tarteel-ai/whisper-base-ar-quran --- # Tilawah Coach models The ONNX runtime files used by Tilawah Coach, a personal app that checks Qur'an recitation ayah by ayah and gives word-level and tajweed-level feedback. The app downloads them from this repo on the first request of each server instance (see `lib/models.ts` in the app). They are redistributed here unchanged in behaviour; all credit goes to the original authors. | Folder | Source | What it does | | --- | --- | --- | | `tajweed/` | [Hisnlabs/tajweed-v2](https://huggingface.co/Hisnlabs/tajweed-v2), revision `b3b0503d` | Hears the recitation as Qur'an phonetic script (CTC phonemes) for the tajweed rule engine | | `whisper-quran/` | [tarteel-ai/whisper-base-ar-quran](https://huggingface.co/tarteel-ai/whisper-base-ar-quran) | Transcribes the words, for the word-level check | ## Files ``` tajweed/ config.json phoneme list, riwayat (hafs, warsh), training metrics model-int8.onnx int8 model from the source repo (23 MB) whisper-quran/ transformers.js layout *.json, merges.txt tokenizer, feature extractor and generation config onnx/encoder_model_quantized.onnx (22 MB) onnx/decoder_model_merged_quantized.onnx with KV cache (76 MB) ``` ## tajweed-v2 - Input `mel`: float32 `[batch, 80, frames]`, Whisper 80-bin log-mel of 16 kHz mono audio with no 30 s padding. `frames` is even and at most 3000. Pad 0.4 s of silence at both ends first. - Input `riwaya`: int64 `[batch]`, index into `config.riwayat` (0 = hafs). - Output `logprobs`: float32 `[batch, frames/2, 43]` CTC log-probs. Id 0 is blank; id k is `config.phonemes[k-1]`. - Reported metrics (from `config.json`): validation PER 2.3%, QDAT PER 7.0%, madd accuracy 95.9% on QDAT. ## whisper-base-ar-quran Exported with optimum `main_export` (task `automatic-speech-recognition-with-past`), then quantized with onnxruntime `quantize_dynamic` (QUInt8 weights, subgraphs included). Load it with transformers.js: ```js import { pipeline } from "@huggingface/transformers"; const asr = await pipeline("automatic-speech-recognition", "/whisper-quran", { dtype: "q8" }); ``` It hears 30 s at a time; split longer recitations at pauses. ## Limits - The tajweed model cannot hear tafkhim and tarqiq (ر, the lam of «الله»). - Each ayah is judged as one breath, so a pause inside an ayah may be flagged. - Results are guidance for practice. Confirm with a teacher. ## License Both source models are released under Apache-2.0, and these files keep that license. See the source repos for their model cards, training data and citations.