distil-large-v3 在昇腾 NPU 上的部署
1. 简介
distil-large-v3 是 Whisper 大型模型的蒸馏版本(32 层编码器 / 2 层解码器),适用于自动语音识别(ASR)任务。
2. 环境
| 组件 | 版本 |
|---|
| Python | 3.11 |
| PyTorch | 2.10.0 |
| torch_npu | 2.10.0 |
| transformers | 5.8.1 |
3. 使用
pip install torch==2.10.0 torchvision==0.25.0 torchaudio==2.10.0 --index-url https://repo.huaweicloud.com/repository/pypi/simple/
pip install torch_npu==2.10.0 --index-url https://repo.huaweicloud.com/repository/pypi/simple/
pip install transformers soundfile
python3 inference.py --model_path /path/to/distil-large-v3 --audio /path/to/audio.wav
python3 benchmark.py --model_path /path/to/distil-large-v3
4. 精度
| 指标 | 值 |
|---|
| Encoder 隐藏层误差 | 2.36% |
| 余弦相似度 | 0.9997 |
| 状态 | 接近 < 1%(NPU 数值差异) |
5. 性能
| CPU | NPU | 加速比 |
|---|
| 3.85s | 0.05s | 74.62x |