Muaalem streaming

A streaming version of Quran Muaalem mini (Wav2Vec2-BERT, 116M parameters, CTC over 43 Quranic phoneme letters). It decodes recitation in 0.64 s chunks and carries a small state from one chunk to the next, so live audio never has to be re-decoded. The original model re-runs on the last ~10 s of audio every time it decodes.

It ships as one INT8 ONNX file (121 MB) that runs on a phone CPU: about 25 ms per 0.64 s chunk on a laptop with 2 threads.

What changed from Muaalem mini

  • Attention in the 24 conformer layers and the adapter only sees the current chunk (32 frames at 50 fps = 0.64 s) and the 384 frames (7.68 s) before it. The convolutions were already causal.
  • Feature normalisation uses a running mean and variance over the last 10 s, blended with global statistics from the training data (norm_stats.json) worth 1 s. It no longer needs the whole clip.
  • State per step: each layer's cached attention input and conv input, plus the adapter's cache and a frame counter (about 20 MB at float32).
  • Training: distilled from the full-context model (its greedy CTC letters used as labels, with CTC loss) on about 175 h of Tadabur, with random chunk sizes. A second run added "reel-like" augmentation to 80% of pieces (mosque echo, crowd noise, hiss and hum, social-app compression, loudness changes; see augment.py).

Results

The score is the share of phoneme letters that match the full-context teacher model, on held-out reciters (never seen in training), with 0.64 s chunks:

Audio Letters same as full-context model
Clean recitation 95.4%
Reel-like (echo, crowd, hiss, compression) 92.8%

INT8 quantisation keeps 99.3% of the letters of the float32 export.

Files

File What
muaalem_streaming.int8.onnx The model: one call = one 0.64 s step
config.json chunk 32, left 384, norm_window 1000, norm_prior 100, conv_cache 30
norm_stats.json Global per-bin log-mel mean/variance for the running normalisation
phoneme_vocab.json The 43 output letters (0 = CTC blank)
infer.py Standalone example: decodes a WAV file chunk by chunk
features.py Log-mel features (matching SeamlessM4TFeatureExtractor) and running normalisation
streaming_model.py The streaming model in PyTorch (forward for training, step for streaming)
train.py, augment.py, prepare_data.py Training, augmentation and data preparation
export_streaming.py Exports to ONNX and INT8, then checks against PyTorch chunk by chunk
eval_streaming.py, eval_onnx.py, test_streaming.py, self_check.py, units.py, windows.py Tests and evaluation

ONNX interface

in:  features (1, 32, 160)      float32  log-mel frame pairs, rescaled (features.py)
     attn     (24, 1, 384, 448) float32  state
     conv     (24, 1, 30, 448)  float32  state
     a_res    (1, 1, 448)       float32  state
     a_att    (1, 1, 448)       float32  state
     a_attn   (1, 192, 448)     float32  state
     seen     ()                int64    frames (50/s) processed before this chunk
out: logits   (1, 16, 43)
     next_attn, next_conv, next_a_res, next_a_att, next_a_attn, next_seen

All the state starts as zeros. Feed each step's next_* outputs back in as the next step's state. For greedy CTC decoding, carry the last emitted id across chunks, so a letter split over a chunk boundary is not counted twice.

Usage

pip install onnxruntime torch transformers numpy scipy soundfile huggingface_hub
hf download mahmud71/muaalem-streaming --local-dir muaalem-streaming
cd muaalem-streaming && python infer.py recitation.wav

Input audio is 16 kHz mono. infer.py resamples other formats.

Licence

  • Weights and code: AGPL-3.0, inherited from Muaalem mini. If you run a modified version as a network service, you must offer its users the Corresponding Source.
  • Training data: the fine-tuning audio is Tadabur, licensed CC BY-NC 4.0. See NOTICE.md for all attributions and citations.

Credits

Muaalem mini by Sayyid Sofwan Haddad. Its lineage is obadx/muaalem-model-v3_2 (Abdullah Abdelfttah et al., arXiv:2509.00094) and facebook/w2v-bert-2.0. The training audio is Tadabur, by Faisal Alherran (arXiv:2604.18932).

Downloads last month
25
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for mahmud71/muaalem-streaming

Quantized
(2)
this model

Dataset used to train mahmud71/muaalem-streaming

Papers for mahmud71/muaalem-streaming