本项目将 openai/whisper-base 语音识别 (Automatic Speech Recognition)模型适配到华为昇腾 NPU(Ascend910B4-1)上运行。
安装依赖:
pip install -r requirements.txtpython inference.py推理输出:
Input: assets/test_audio.wav (7.36s)
Output: The quick brown fox jumps over the lazy dog. This is a test of automatic speech recognition.
Status: SUCCESSpython eval_accuracy.pyCPU 与 NPU 输出一致性验证:
| 指标 | 数值 |
|---|---|
| relative_error | 0.00% |
| cosine_similarity | 1.000000 |
CPU 与 NPU 输出一致性验证通过。
python benchmark.py| 指标 | 数值 |
|---|---|
| Avg latency | 15241 ms |
本项目包含单样本 smoke consistency 验证,非完整数据集评估。
| 文件 | 说明 |
|---|---|
inference.py | NPU 推理脚本 |
eval_accuracy.py | CPU-NPU 精度一致性验证脚本 |
benchmark.py | 性能基准测试脚本 |
model_utils.py | 模型下载工具 |
logs/inference.log | 推理结果日志 |
logs/accuracy.log | 精度验证日志 |
logs/benchmark.log | 性能测试日志 |
assets/test_audio.wav | 测试音频 |