Whisper Tiny is OpenAI's lightweight speech recognition model (37.8M parameters), adapted from the manyeyes/whisper-tiny-onnx ModelScope repository. This repository provides NPU-adapted inference scripts and evaluation results for running Whisper Tiny on Huawei Ascend 910 NPUs via torch_npu.
| Component | Configuration |
|---|---|
| Encoder Layers | 4 |
| Decoder Layers | 4 |
| Hidden Dimension | 384 |
| Attention Heads | 6 |
| Vocabulary Size | 51,865 |
| Mel Bands | 80 |
| Max Audio Context | 1,500 (30s @ 16kHz) |
| Max Text Context | 448 |
| Parameters | 37.8M (144 MB FP32) |
| Languages | 99 (multilingual) |
# Install ModelScope
pip install modelscope
# Download model
modelscope download --model manyeyes/whisper-tiny-onnx --local_dir ./model
# Install dependencies
pip install torchaudio soundfile scipy librosa# Generate test audio and run CPU inference (baseline)
python inference.py --audio /tmp/test_audio.wav --generate-audio --device cpu
# NPU inference
python inference.py --audio /tmp/test_audio.wav --device npu:0
# Accuracy comparison (CPU vs NPU)
python inference.py --audio /tmp/test_audio.wav --device npu:0 --compare
# Performance benchmark with 20 iterations
python inference.py --audio /tmp/test_audio.wav --device npu:0 --benchmark 20from inference import load_model, load_audio, compute_mel, greedy_decode, decode_tokens
# Load model on NPU
model = load_model("model/tiny.pt", device="npu:0")
# Load and preprocess audio
audio = load_audio("audio.wav")
mel = compute_mel(audio, device="npu:0")
# Run inference
tokens, enc_time = greedy_decode(model, mel, language="en", device="npu:0")
text = decode_tokens(tokens)
print(text)| Item | Specification |
|---|---|
| NPU | Ascend 910 (9362) x2 |
| CANN | 8.5.1 |
| PyTorch | 2.9.0+cpu |
| torch_npu | 2.9.0.post1+gitee7ba04 |
| Precision | FP32 |
| Test Date | 2026-05-17 |
Evaluation metric: Robust Relative Error — for values where CPU reference > 1e-6, compute |NPU - CPU| / |CPU| and average across all elements. Quality gate: < 1%.
| Test Case | Input Shape | Output Shape | Max Abs Error | Robust Rel Error | Status |
|---|---|---|---|---|---|
| 5s audio | [1, 80, 500] | [1, 250, 384] | 0.009542 | 0.4754% | PASS |
| 10s audio | [1, 80, 1000] | [1, 500, 384] | 0.009686 | 0.6799% | PASS |
| 20s audio | [1, 80, 2000] | [1, 1000, 384] | 0.009594 | 0.5687% | PASS |
| 30s audio | [1, 80, 3000] | [1, 1500, 384] | 0.014266 | 0.7118% | PASS |
Accuracy Verdict: ALL PASSED
| Metric | Value |
|---|---|
| CPU-NPU Text Match | True (100%) |
| Feature Max Abs Error | 0.001993 |
| Feature Mean Abs Error | 0.000196 |
| Feature Relative Error | 0.0200% |
| Audio Duration | CPU Time (ms) | NPU Time (ms) | CPU p99 (ms) | NPU p99 (ms) | Speedup | NPU RTF |
|---|---|---|---|---|---|---|
| 5s | 86.28 | 2.25 | 87.04 | 2.32 | 38.3x | 0.00045 |
| 10s | 185.19 | 2.24 | 197.99 | 2.29 | 82.6x | 0.00022 |
| 20s | 833.95 | 2.17 | 3644.53 | 2.22 | 384.1x | 0.00011 |
| 30s | 899.05 | 2.90 | 912.05 | 2.93 | 309.7x | 0.00010 |
| Component | Latency (ms) |
|---|---|
| Encoder | 3.37 |
| Decoder (20 tokens) | 49.68 |
| Per-token decoder | 2.48 |
| Total E2E | 53.05 |
| Encoder Throughput | 890,007 mel-frames/s |
Accuracy: CPU-NPU feature-level robust relative error is 0.71% (worst case), passing the 1% quality gate. Text-level outputs are 100% identical between CPU and NPU. Feature-level relative error is only 0.02% on real audio inference.
Performance: NPU achieves 38x–384x speedup over CPU for encoder inference. Real-Time Factor (RTF) is well below 0.001, enabling real-time streaming ASR with large headroom.
Memory: Model occupies approximately 144 MB in FP32, fitting comfortably within the Ascend 910's 64 GB HBM.
Stability: NPU inference time remains nearly constant across all input durations (2.2–2.9 ms), while CPU time scales linearly with audio length.
| File | Description |
|---|---|
inference.py | NPU-adapted inference script with CPU/NPU backends, accuracy comparison, and benchmarking |
eval_benchmark.py | Comprehensive accuracy and performance evaluation suite |
eval_results.json | Structured evaluation results (accuracy + performance) |
run_log.log | Full evaluation run log |
README.md | Deployment documentation and evaluation report |
model/ | Downloaded model files (tiny.pt, ONNX encoders/decoders) |
whisper-tiny-onnx-npu/
├── README.md # This document
├── inference.py # NPU inference script
├── eval_benchmark.py # Evaluation suite
├── eval_results.json # Evaluation results (structured)
├── run_log.log # Full run log
└── model/ # Model files
├── tiny.pt # PyTorch checkpoint
├── encoder.onnx # ONNX encoder (FP32)
├── encoder.int8.onnx # ONNX encoder (INT8)
├── decoder.onnx # ONNX decoder (FP32)
├── decoder.int8.onnx # ONNX decoder (INT8)
├── conf.json # Model config
└── configuration.json # Additional config@misc{whisper-tiny-onnx-npu,
title={Whisper Tiny ONNX - Ascend NPU Adaptation},
author={Model Agent},
year={2026},
note={Adapted from manyeyes/whisper-tiny-onnx on ModelScope. Evaluated on Huawei Ascend 910 NPU.}
}#NPU #Hardware/NPU #Ascend #Ascend910 #CANN #torch_npu #Whisper #ASR #ONNX #pretrained