whisper-tiny-ar-quran-onnx

Transformers.js-compatible ONNX conversion of tarteel-ai/whisper-tiny-ar-quran. The decoder exports cross-attention tensors and the generation config contains Whisper alignment heads, enabling word-level timestamps in Transformers.js.

Usage

import { pipeline } from "@huggingface/transformers";

const transcriber = await pipeline(
  "automatic-speech-recognition",
  "Sharjeelbaig/whisper-tiny-ar-quran-onnx",
  { dtype: "q8" },
);

const result = await transcriber(audioFloat32Array, {
  language: "ar",
  task: "transcribe",
  return_timestamps: "word",
});

The repository contains fp32 and dynamically quantized q8 encoder/merged decoder graphs. q8 is recommended for local CPU inference.

Validation

The q8 artifact was loaded with @huggingface/transformers 4.2.0 in Node.js. It returned the correct text and four timestamped words for Qur'an 1:1. A second-reciter test on Husary's complete Sūrah 112 found all four verses and aligned all 15 canonical words from 16 recognized tokens. The artifact was also exercised end to end by transcribe-quran, including offline cached inference, canonical matching, ASS generation, and FFmpeg/libass video rendering.

SHA-256:

File SHA-256
encoder_model.onnx f0c604c7ea767c1eab1d26df50dbc3afa861cc28a1a68bd965e6b9e897c5b5c8
decoder_model_merged.onnx 52ed5be1e5db4f213578d0ba6fc5f207bda119e130954855240b44ec5563272b
encoder_model_quantized.onnx 965e0ca31daf589ffb572e8b6deb1a4e65ad72221c1873c952331ff1c52f50c1
decoder_model_merged_quantized.onnx 06a5c4409988b9ae7747bd55cf81e3851e3f2238536c86467963e0241464f652

Conversion

convert-model.py is the reproducible development-only exporter. It enables eager attention and explicitly exposes encoder, decoder, and cross-attention outputs before Optimum merges the cached and non-cached decoder graphs.

uv run --python 3.12 \
  --with torch --with accelerate --with 'optimum-onnx[onnxruntime]' \
  python convert-model.py --output export

uvx --python 3.12 --with torch --with accelerate \
  --from 'optimum-onnx[onnxruntime]' optimum-cli onnxruntime quantize \
  --onnx_model export --arm64 --per_channel -o quantized

The published onnx/*_quantized.onnx files are the encoder and merged decoder from that quantized output, using Transformers.js's _quantized q8 filename convention. The full generation metadata comes from the matching multilingual Whisper Tiny generation config.

The source checkpoint is Apache-2.0. See its model card for reported training and evaluation details and limitations.

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

Model tree for Sharjeelbaig/whisper-tiny-ar-quran-onnx

Quantized
(2)
this model