Fire Red ASR large model (Attention Encoder-Decoder) adapted for Huawei Ascend NPU inference. This model supports Chinese and English speech recognition with mixed-language capability.
| Item | Description |
|---|---|
| Model | FireRedASR-AED-L (sherpa-onnx) |
| Architecture | Attention Encoder-Decoder (AED) |
| Encoder | 16-layer Transformer, 1280-dim hidden |
| Decoder | 16-layer Transformer with cross-attention |
| Quantization | INT8 dynamic quantization |
| Vocab size | 7,832 tokens |
| Sample rate | 16,000 Hz |
| Language | Chinese (zh), English (en) |
| Source model | FireRedTeam/FireRedASR-AED-L |
| ONNX export | csukuangfj/sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16 |
| Item | Detail |
|---|---|
| NPU Device | Huawei Ascend 910 (2x) |
| CANN Version | 8.5.1 |
| torch_npu | 2.9.0 |
| Adaptation Method | sherpa-onnx + torch_npu NPU acceleration |
| Inference Backend | ONNX Runtime (CPU) + torch_npu (NPU preproc) |
| Precision | INT8 (ONNX model) + FP32 (NPU ops) |
| Accuracy vs Baseline | CER = 0.0% (exact match 8/8) |
# Prerequisites: CANN 8.5.1, Python 3.11, Ascend 910 NPU
# Install dependencies
pip install sherpa-onnx onnxruntime onnx torch torch_npu numpy
# Download the model (from ModelScope)
pip install modelscope
modelscope download --model csukuangfj/sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16python inference.py --wav test.wav --backend cpu --output result.jsonpython inference.py --wav test.wav --backend npu --output result.jsonpython inference.py --batch-dir test_wavs/ --backend npu --output results.json# Run CPU baseline
python inference.py --batch-dir test_wavs/ --backend cpu --output results_cpu.json
# Run NPU inference
python inference.py --batch-dir test_wavs/ --backend npu --output results_npu.json
# Compare accuracy
python evaluate_accuracy.py --cpu results_cpu.json --npu results_npu.json| Test File | CPU Text | NPU Text | CER | Match |
|---|---|---|---|---|
| 0.wav | 昨天是 MONDAY TODAY IS礼拜二... | 昨天是 MONDAY TODAY IS礼拜二... | 0.0% | PASS |
| 1.wav | 这是第一种第二种叫呃与 ALWAYS... | 这是第一种第二种叫呃与 ALWAYS... | 0.0% | PASS |
| 2.wav | 这个是频繁的啊不认识记下来... | 这个是频繁的啊不认识记下来... | 0.0% | PASS |
| 3-sichuan.wav | 自己就是在那个在那个就是在... | 自己就是在那个在那个就是在... | 0.0% | PASS |
| 3.wav | 第一句是个什么时态加了... | 第一句是个什么时态加了... | 0.0% | PASS |
| 4-tianjin.wav | 其实他就是那每个人都会守法... | 其实他就是那每个人都会守法... | 0.0% | PASS |
| 5-henan.wav | 他这个管一下都通到有时候... | 他这个管一下都通到有时候... | 0.0% | PASS |
| 8k.wav | 嗯 ON TIME叫准时 IN TIME是... | 嗯 ON TIME叫准时 IN TIME是... | 0.0% | PASS |
Accuracy: 100% exact match, CER = 0.0% (< 1% threshold)
| Metric | CPU | NPU-Accelerated |
|---|---|---|
| Avg inference time | 7.538s | 12.436s |
| Avg RTF | 0.86x | 1.34x |
| NPU preproc overhead | - | 0.08-0.6s (after warmup) |
Note: NPU mode includes additional torch_npu preprocessing overhead. The model encoder/decoder runs on CPU via ONNX Runtime with INT8 quantization in both modes. The NPU-accelerated audio preprocessing (FFT, normalization) runs on Ascend NPU. Future work includes ONNX Runtime CANN backend support for full NPU model inference (requires FP32 model).
Audio Input (WAV, 16kHz)
│
▼
┌──────────────────────────────┐
│ NPU-Accelerated Preprocessing │ ← torch_npu (Ascend 910)
│ · Audio normalization │
│ · FFT (torch.fft.rfft) │
└──────────────┬───────────────┘
│
▼
┌──────────────────────────────┐
│ Feature Extraction (sherpa) │ ← sherpa-onnx (CPU)
│ · Log-mel filterbank │
│ · Frame stacking │
└──────────────┬───────────────┘
│
▼
┌──────────────────────────────┐
│ Encoder (INT8 ONNX) │ ← ONNX Runtime (CPU)
│ · 16-layer Transformer │
│ · Cross-attention KV cache │
└──────────────┬───────────────┘
│
▼
┌──────────────────────────────┐
│ Decoder (INT8 ONNX) │ ← ONNX Runtime (CPU)
│ · 16-layer, greedy search │
│ · Token generation loop │
└──────────────┬───────────────┘
│
▼
┌──────────────────────────────┐
│ Token → Text │ ← tokens.txt (CPU)
└──────────────┬───────────────┘
│
▼
Output TextINT8 ONNX + CANN: The current CANN graph engine (GE) does not support DynamicQuantizeLinear and MatMulInteger ops in the INT8-quantized ONNX model. Full CANNExecutionProvider acceleration requires either:
Performance: The NPU mode adds a small preprocessing overhead (~0.3s avg after warmup). First inference includes NPU initialization (~23s).
Recommended path for full NPU acceleration:
Apache 2.0
@misc{fire_red_asr_ascend_2026,
title={FireRedASR-AED-L Ascend NPU Adaptation},
author={Ascend NPU Adaptation Team},
year={2026},
note={Adapted for Huawei Ascend 910 NPU using sherpa-onnx and torch_npu}
}