Files
enginex-mr_series-asr/README.md

58 lines
3.1 KiB
Markdown
Raw 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.

# 天数智芯 智铠100 FunASR
## 镜像构造
```shell
docker build -f ./Dockerfile.funasr-mr100 -t <your_image> .
```
其中,基础镜像 corex:4.3.0 通过联系天数智芯智铠100厂商技术支持可获取
## 使用说明
### 使用 FastAPI 测试ASR服务
例如:
```shell
docker run -it --rm --name iluvatar_test_asr -p 23333:1111 \
--privileged \
-v /lib/modules:/lib/modules \
-v /dev:/dev \
-v /usr/src:/usr/src \
-v /mnt/gpfs/leaderboard/modelHubXC/iic/SenseVoiceSmall:/model \
-e CUDA_VISIBLE_DEVICES=0 \
--entrypoint python3 <IMAGE_NAME> main.py \
--port 1111 --model_dir /model --model_type sensevoice
```
### 快速镜像测试
对funasr的测试需要在以上构造好的镜像容器内测试测试步骤
1. 本项目中附带上了示例测试数据,音频文件为`lei-jun-test.wav`,音频的识别准确内容文件为`lei-jun.txt`用户需要准备好相应的ASR模型路径本例中假设我们已经下载好了SenseVoiceSmall模型存放于/model/SenseVoiceSmall
2. 在本项目路径下执行以下快速测试命令
```shell
docker run -it \
-v /usr/src:/usr/src \
-v /lib/modules:/lib/modules --device=/dev/iluvatar0:/dev/iluvatar0 \
-v $PWD:/tmp/workspace \
-v /model:/model \
-e MODEL_DIR=/model/SenseVoiceSmall \
-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逻辑
## 智铠100模型适配情况
我们在智铠100上针对funASR部分进行了所有大类的适配测试方式为在Nvidia A100环境下和智铠100加速卡上对同一段长音频进行语音识别任务获取运行时间1-cer指标。运行时都只使用一张显卡
| 模型大类 | 模型地址 |A100运行时间(秒)|智铠100运行时间(秒)|A100 1-cer|智铠100 1-cer| 备注 |
|------|---------------|-----|----|-------|-------|---------------------|
| sense_voice | https://www.modelscope.cn/models/iic/SenseVoiceSmall | 1.8327 | 1.2579 | 0.980033 | 0.980033 | |
| whisper | https://www.modelscope.cn/models/iic/Whisper-large-v3 | 23.8337 | 22.9085 | 0.910150 | 0.910150 | |
| paraformer | https://modelscope.cn/models/iic/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch | 4.7246 | 4.7719 | 0.955075 | 0.955075 | |
| conformer | https://www.modelscope.cn/models/iic/speech_conformer_asr_nat-zh-cn-16k-aishell2-vocab5212-pytorch | 95.9631 | 125.8649 | 0.349418 | 0.346090 | |
| uni_asr | https://www.modelscope.cn/models/iic/speech_UniASR-large_asr_2pass-zh-cn-16k-common-vocab8358-tensorflow1-offline | 70.5289 | 88.9481 | 0.717138 | 0.717138 | 该部分的适配修改了一些funASR源码 |