| 项目 | 版本 |
|---|---|
| NPU | Ascend910B |
| CANN | 8.5.1 |
| Python | 3.11 |
| torch_npu | 2.6.0 |
| funasr | 1.3.1 |
通过 ModelScope snapshot_download 下载至本地缓存目录,推理时从本地加载。
python inference.pyسی پیک ٹیلی سے عملی صورت اختیار کر چکا ہے سرتاج عزیز通过 register_forward_hook 在 model.model.encoder 上捕获 encoder 输出,计算 CPU 与 NPU 之间的数值差异。
| 指标 | 值 |
|---|---|
| max_abs_error | 0.0050 |
| mean_abs_error | 0.0001 |
| relative_error | 0.140% |
| cosine_similarity | 0.99999970 |
| threshold | 1.0% |
| result | PASS |
| 指标 | 值 |
|---|---|
| avg_latency_ms | 3292.61 |
| min_latency_ms | 3244.24 |
| max_latency_ms | 3372.08 |
| p50_latency_ms | 3280.42 |
| p90_latency_ms | 3352.57 |
| p95_latency_ms | 3362.32 |
| audio_duration_sec | 14.50 |
| real_time_factor | 0.2271 |
iic-speech_UniASR_asr_2pass-ur-16k-common-vocab877-pytorch-NPU/
├── model_utils.py # 模型加载与音频处理工具
├── inference.py # NPU 推理脚本
├── eval_consistency.py # CPU-NPU 数值一致性校验
├── benchmark.py # 性能测试
├── requirements.txt # 依赖
├── .gitignore
├── assets/
│ └── test.wav # 测试音频
├── logs/
│ ├── inference.log
│ ├── consistency.log
│ └── benchmark.log
├── screenshots/
│ └── self_verification.png
└── README.md# 安装依赖
pip install -r requirements.txt
# NPU 推理
python inference.py
# CPU-NPU 一致性校验
python eval_consistency.py
# 性能测试
python benchmark.py#NPU