Files
enginex-ascend-910-asr/README.md
2025-09-04 11:19:41 +08:00

48 lines
2.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 昇腾910B4 FunASR
## 镜像构造
```shell
docker build -f ./Dockerfile.funasr-ascend910b -t <your_image> .
```
## 使用说明
### 快速镜像测试
对funasr的测试需要在以上构造好的镜像容器内测试测试步骤
1. 本项目中附带上了示例测试数据,音频文件为`lei-jun-test.wav`,音频的识别准确内容文件为`lei-jun.txt`用户需要准备好相应的ASR模型路径本例中假设我们已经下载好了SenseVoiceSmall模型存放于/model/SenseVoiceSmall
2. 在本项目路径下执行以下快速测试命令
```shell
docker run -it --ipc=host --net=host --privileged \
--device=/dev/davinci_manager \
--device=/dev/devmm_svm --device=/dev/hisi_hdc \
-v /var/queue_schedule:/var/queue_schedule \
-v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \
-v /usr/local/Ascend/driver/lib64/common/:/usr/local/Ascend/driver/lib64/common \
-v /usr/local/Ascend/driver/lib64/driver/:/usr/local/Ascend/driver/lib64/driver \
-v $PWD:/tmp/workspace \
-v /model:/model \
-e MODEL_DIR=/model/SenseVoiceSmall \
-e CUSTOM_DEVICE=Ascend910B4 \
-e TEST_FILE=lei-jun-test.wav \
-e ANSWER_FILE=lei-jun.txt \
-e RESULT_FILE=result.json \
--cpus=4 --memory=16g \
<your_image>
```
上述测试指令成功运行将会在terminal中看到对测试音频的识别结果运行时间以及1-cer效果指标并且当前文件下会生成一个`result.json`文件记录刚才的测试结果
### 定制化手动运行
用户可使用类似上述的docker run指令以交互形式进入镜像中主要的测试代码为`test_funasr.py`,用户可自行修改代码中需要测试的模型路径、测试文件路径以及调用funASR逻辑
## 昇腾910B4 模型适配情况
我们在昇腾910B4上针对funASR部分进行了所有大类的适配测试方式为在Nvidia A100环境下和昇腾910B4上对同一段长音频进行语音识别任务获取运行时间1-cer指标。运行时都只使用一张显卡
| 模型大类 | 模型地址 | A100运行时间(秒) | 昇腾910B4运行时间(秒) | A100 1-cer | 昇腾910B4 1-cer | 备注 |
|------|---------------|-----|----|-------|-------|---------------------|
| sense_voice | https://www.modelscope.cn/models/iic/SenseVoiceSmall | 1.8670 | 3.0323 | 0.980033 | 0.980033 | |
| whisper | https://www.modelscope.cn/models/iic/Whisper-large-v3 | 24.0762 | 54.1408 | 0.910150 | 0.908486 | 模型在调用上进行了特殊处理 |
| paraformer | https://modelscope.cn/models/iic/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch | 4.6839 | 10.1397 | 0.955075 | 0.955075 | |
| conformer | https://www.modelscope.cn/models/iic/speech_conformer_asr_nat-zh-cn-16k-aishell2-vocab5212-pytorch | 85.9806 | 250.9624 | 0.349418 | 0.349418 | |
| uni_asr | https://www.modelscope.cn/models/iic/speech_UniASR-large_asr_2pass-zh-cn-16k-common-vocab8358-tensorflow1-offline | 91.6105 | 157.9791 | 0.717138 | 0.717138 | |