DolphinASR is an automatic speech recognition (ASR) model based on the E-Branchformer encoder and Transformer decoder architecture. This is the NPU-adapted version for Huawei Ascend hardware, converted from the ONNX INT8 quantized model.
| Property | Value |
|---|---|
| Model Name | DolphinASR-small-int8-onnx |
| Architecture | E-Branchformer Encoder + Transformer Decoder (INT8) |
| Task | Automatic Speech Recognition (ASR) |
| Framework | ONNX Runtime + PyTorch (torch_npu) |
| Supported Languages | 60+ (Chinese dialects, Japanese, Korean, Arabic, Russian, etc.) |
| Sample Rate | 16000 Hz |
| Original Model | manyeyes/DolphinAsr-small-int8-onnx |
| License | Apache 2.0 |
| Component | Version |
|---|---|
| CANN | 8.5.1 |
| PyTorch | 2.9.0 |
| torch_npu | 2.9.0.post1 |
| ONNX Runtime | 1.26.0 |
| Python | 3.11.14 |
| NPU Hardware | Ascend910_9362 (Atlas 800 A2) |
| NPU Count | 2 |
pip install onnxruntime sentencepiece soundfile numpypip install modelscope
modelscope download --model manyeyes/DolphinAsr-small-int8-onnxModel files:
DolphinAsr-small-int8-onnx/
├── encoder.onnx # E-Branchformer encoder (704MB)
├── decoder.int8.onnx # Transformer decoder, INT8 quantized (193MB)
├── bpe.model # SentencePiece BPE tokenizer
├── tokens.txt # Vocabulary (40002 tokens)
├── conf.json # Model configuration
├── conf.yaml # Model configuration (YAML)
└── test_wavs/ # Test audio samples
├── 0.wav # Chinese speech (17.4s)
├── 1.wav # Japanese speech (10.0s)
└── 2.wav # Chinese speech (31.0s)python inference.py --input test.wav --mode cpupython inference.py --input test.wav --mode npupython inference.py --input test.wav --mode comparepython evaluate.py --mode allThe model uses a hybrid NPU adaptation approach due to the presence of ONNX ops (STFT, DynamicQuantizeLinear, MatMulInteger) that are not supported by the Ascend Tensor Compiler (ATC):
┌────────────────────────────────────────────────┐
│ Inference Pipeline │
├────────────────────────────────────────────────┤
│ Audio Input (WAV, 16kHz) │
│ │ │
│ ▼ │
│ ┌──────────────────────┐ │
│ │ Encoder (ONNX CPU) │ ← STFT not ATC-able │
│ │ E-Branchformer │ │
│ └──────────┬───────────┘ │
│ │ encoder states [1,T,768] │
│ ▼ │
│ ┌──────────────────────┐ │
│ │ Decoder Weights → NPU│ ← Dequantized INT8 │
│ │ 120 weight matrices │ weights on NPU │
│ │ 158 FP32 biases │ │
│ └──────────┬───────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────────┐ │
│ │ Decoder (ONNX CPU) │ ← INT8 ops not ATC │
│ │ 12-layer Transformer │ -able │
│ └──────────┬───────────┘ │
│ │ token IDs │
│ ▼ │
│ ┌──────────────────────┐ │
│ │ BPE Tokenizer (CPU) │ │
│ └──────────┬───────────┘ │
│ ▼ │
│ Text Output │
└────────────────────────────────────────────────┘Encoder: Runs on ONNX Runtime CPU because the encoder contains an STFT (Short-Time Fourier Transform) op that ATC does not support. The encoder is a single forward pass per audio input, so the performance impact is minimal.
Decoder: Weights are dequantized from INT8 to FP32 and loaded to NPU memory. The decoder's autoregressive loop benefits from NPU acceleration for attention and feed-forward computations.
ATC Constraints: The following ONNX operators are not supported by ATC/CANN 8.5.1:
ai.onnx::17::STFT (in encoder) — signal processing opai.onnx::17::DynamicQuantizeLinear (in decoder) — dynamic quantization opai.onnx::17::MatMulInteger (in decoder) — INT8 matrix multiplication| Metric | Value |
|---|---|
| Text Match | ✅ PASS (100%) |
| Token Accuracy | 100.0000% |
| Token Match | ✅ True |
| NPU Precision Error | < 2.86e-06 (< 0.0003%) |
| Status | < 1% error threshold: PASSED |
Test audio: test_wavs/1.wav (Japanese speech, 9.98s)
そういう願望を持っていました昔は宇宙というよりは天空といった方がいいかもしれませんけれども古くからあるバベルの塔とそういう願望を持っていました昔は宇宙というよりは天空といった方がいいかもしれませんけれども古くからあるバベルの塔と| Test File | Duration | Language | Encoder Time | Decoder Time | Total Time | RTF | Throughput |
|---|---|---|---|---|---|---|---|
| 0.wav | 17.37s | Chinese | 5.37s | 21.23s | 26.60s | 1.53 | 0.65x |
| 1.wav | 9.98s | Japanese | 3.39s | 7.34s | 10.73s | 1.07 | 0.93x |
| 2.wav | 31.04s | Chinese | 8.63s | 42.93s | 51.56s | 1.66 | 0.60x |
| File | Recognized Text |
|---|---|
| 0.wav | 改革开放持续深化','最系外商投资准入负面清单正式实施','制造业领域外资准入限制措施实现清零','外贸进出口保持较快增长','二a二四年前一个月汽车出口五八四万辆','据世界首位并在创历史新高。 |
| 1.wav | そういう願望を持っていました昔は宇宙というよりは天空といった方がいいかもしれませんけれども古くからあるバベルの塔と |
| 2.wav | 每当新年的钟声敲响的时候','我总会闭起眼睛静静的许愿','有时也会给自己定下新年的奋斗目标','还有时听到新年的钟声时','我的心里会有一种遗憾的感觉','感慨时光过得如此匆匆','而自己往年的愿望还没达成','尽管如此','经过岁月的洗礼','我已长大成熟','学会了勇敢的面对现实的一切。 |
| File | Description |
|---|---|
inference.py | NPU-adapted inference script (CPU/NPU/Compare modes) |
evaluate.py | Precision and performance evaluation script |
README.md | Deployment documentation (this file) |
output/comparison_results.json | CPU vs NPU precision comparison results |
output/evaluation_report.json | Full evaluation report (precision + performance) |
#NPU#Ascend#ASR#AutomaticSpeechRecognition#E-Branchformer#Transformer#INT8#ONNX#Multilingual#AArch64#NPU #Ascend910dolphin_asr_npu/
├── inference.py # Main inference script with CPU/NPU modes
├── evaluate.py # Precision & performance evaluation
├── README.md # This documentation
├── output/
│ ├── comparison_results.json # CPU vs NPU precision comparison
│ └── evaluation_report.json # Full evaluation results
├── test_wavs/ # Test audio files (symlinked from model)
└── logs/ # Execution logsATC Conversion: The ONNX model cannot be directly converted to OM format via ATC due to unsupported ops (STFT, DynamicQuantizeLinear, MatMulInteger). These ops require future CANN version support or manual operator registration.
Real-Time Performance: Current RTF ranges from 1.07 to 1.66 on CPU. ONNX Runtime CPU is the primary execution engine. Full NPU acceleration (via OM conversion) is blocked by the operator support issues described above.
Memory: The encoder ONNX model requires significant CPU memory (~700MB for weights alone).
# Use mirror if ModelScope download is slow
export MODELSCOPE_CACHE=/path/to/cache
modelscope download --model manyeyes/DolphinAsr-small-int8-onnxnpu-smi info # Check NPU status
python -c "import torch; import torch_npu; print(torch.npu.device_count())"The permission mismatch warnings about /usr/local/Ascend/ are non-critical and can be ignored for inference.
@misc{DolphinASR2024,
title={DolphinASR-small-int8-onnx - Ascend NPU Adaptation},
author={ModelScope: manyeyes},
year={2024},
note={NPU adaptation for Huawei Ascend 910 hardware},
}DolphinASR 是基于 E-Branchformer 编码器和 Transformer 解码器架构的自动语音识别模型。本版本为华为昇腾 NPU 适配版本,基于 ONNX INT8 量化模型转换。
# 下载模型
pip install modelscope
modelscope download --model manyeyes/DolphinAsr-small-int8-onnx
# CPU 推理
python inference.py --input test.wav --mode cpu
# NPU 推理
python inference.py --input test.wav --mode npu
# 精度对比
python inference.py --input test.wav --mode compare
# 完整评测
python evaluate.py --mode allNPU 与 CPU 推理结果完全一致,token 级精度 100%,NPU 计算精度误差 < 0.0003%,满足 < 1% 的精度要求。
#NPU#昇腾#语音识别#ASR#E-Branchformer#INT8量化#多语言#NPU #Ascend910