This is the Ascend NPU-adapted version of yikshing/funasr-onnx-small, a lightweight Paraformer-based automatic speech recognition (ASR) model optimized for Huawei Ascend NPU inference.
| Component | Version |
|---|---|
| CANN | 8.5.1 |
| torch_npu | 2.9.0.post1 |
| PyTorch | 2.9.0 |
| ONNX Runtime | 1.26.0 |
| funasr_onnx | 0.4.1 |
| NPU | Ascend 910B4 x2 |
The NPU adaptation accelerates the inference pipeline through heterogeneous computing:
| Metric | Result |
|---|---|
| Text Match (CPU vs NPU) | 100% |
| Argmax Error Rate | 0.00% |
| Max Value Relative Error | 0.00% |
| Mean Relative Error | 0.00% |
| Accuracy Pass | PASS (< 1%) |
pip install modelscope funasr_onnx jieba torch_npumodelscope download --model yikshing/funasr-onnx-smallpython inference.py --audio /path/to/audio.wavpython accuracy_eval.pyfrom inference import ParaformerNPU
model = ParaformerNPU(
model_dir='/path/to/model',
device_id=0,
quantize=True,
)
result = model('audio.wav')
print(result)| Audio Duration | Features | Model | Decode | Total |
|---|---|---|---|---|
| 2s | 175ms | 20ms | 401ms | 2158ms |
| 5s | 18ms | 854ms | 2ms | 875ms |
| 10s | - | 116ms | 1ms | ~120ms |
Note: First inference includes model loading overhead. Subsequent inferences are faster.
funasr_ascend_npu/
├── inference.py # NPU-adapted inference script
├── accuracy_eval.py # Accuracy & performance evaluation
└── README.md # This fileONNX Model on CPU: The quantized ONNX model runs on CPU via ONNX Runtime. Full NPU acceleration requires CANN Execution Provider (under development) or ATC-based OM model conversion.
Dynamic Shape Support: The Paraformer model uses dynamic shapes for batch size and sequence length. ATC conversion requires proper shape configuration.
Loop Operations: The CIF predictor uses ONNX Loop operations that are not directly supported by current NPU conversion toolchains.
@article{gao2022paraformer,
title={Paraformer: Fast and Accurate Parallel Transformer for Non-autoregressive End-to-End Speech Recognition},
author={Gao, Zhifu and Zhang, Shiliang and Lei, Ming and McLoughlin, Ian},
journal={arXiv preprint arXiv:2206.08317},
year={2022}
}Apache License 2.0 - Same as original model.