---
title: SenseVoiceSmall_axi
canonical_url: "https://www.modelscope.cn/models/AIBS/SenseVoiceSmall_axi"
md_url: "https://www.modelscope.cn/models/AIBS/SenseVoiceSmall_axi.md"
repository: AIBS/SenseVoiceSmall_axi
last_updated: 2026-04-09
pipeline_tag: auto-speech-recognition
tasks:
  - auto-speech-recognition
library_name:
  - onnx
  - pytorch
frameworks:
  - Pytorch
downloads: 47
stars: 0
---

# SenseVoiceSmall_axi

> SenseVoiceSmall_axi - AIBS 在 ModelScope 开源的模型。优化网络，将导出的两个网络（encoder,ctc）合并成一个网络 合并后的网络onnx命名为mergedmodel.onnx； 这里提供了2compile文件以供复现生成json&raw； 优化前处理代码，去掉embedding等部分，只保留推断必要的音频特征提取； 优化后处理代码，去掉一些条件判断，传递固定参数，保证正确文本输出；

- **Repository**: AIBS/SenseVoiceSmall_axi
- **Tasks**: auto-speech-recognition
- **Downloads**: 47
- **Stars**: 0
- **Last updated**: 2026-04-09

Source: https://www.modelscope.cn/models/AIBS/SenseVoiceSmall_axi

---

# sensevoicesmall

## 优化内容

- 优化网络，将导出的两个网络（encoder,ctc）合并成一个网络
  - 合并后的网络onnx命名为merged_model.onnx；
  - 这里提供了2_compile文件以供复现生成json&raw；
- 优化前处理代码，去掉embedding等部分，只保留推断必要的音频特征提取；
- 优化后处理代码，去掉一些条件判断，传递固定参数，保证正确文本输出；

## 文件结构

```
|--- 2_compile
|---pyrt
│   ├── funasr	# 必要依赖源码
│   ├── iic	# sensevoicesmall一些模型参数配置
│   ├── modelzoo_utils # 模型库依赖文件
│   ├── test_data	# 测试样本，语音(.wav .mp3)
│   ├── sensevoicesmall_infer_axi.py	# axi模式运行时代码	
│   ├── sensevoicesmall_infer_socket.py	# socket模式运行时代码
│ 
└── readme.md
```

## 代码运行

### 上板环境安装说明

需安装一些必要库

```powershell
pip install torch_complex
pip install hydra-core
pip install -U funasr-onnx
```

安装ffmpeg处理不同音频

```powershell
sudo apt install ffmpeg
```

### socket模式

运行命令

```powershell
# cd pyrt
python sensevoicesmall_infer_socket.py
```

### axi模式

相同文件结构复制到板子上，运行命令

```powershell
# cd pyrt
python3 sensevoicesmall_infer_axi.py
```

## 运行时间说明

时间说明：模型大小为937.1MB，生成的raw大小为526.5MB，输入大小[1,100,560]，以下均为axi模式的时间说明。其中，前处理时间包含加载音频、音频特征提取、设置音频定长、将tensor转换成icraft.tensor等过程。

|          | 前处理时间   | 前向时间    | 后处理时间 |
| -------- | ------------ | ----------- | ---------- |
| 平均值   | ---          | 521.391ms   | --         |
| 大致范围 | 600ms-5490ms | 500ms-650ms | 44ms-200ms |

单个样本输出展示：

```powershell
your test audio is: ./test_data/asr_example_zh.wav
preprocess to icraft_tensor time is 1062.0193481445312ms
session forward time is 550.6234169006348ms
tenor to host time  is 0.2357959747314453ms
tenor to host time  is 54.30459976196289ms
model postprocess time is 139.10508155822754ms
欢迎大家来体验达摩院推出的语音识别模型
your test audio is: ./test_data/test.wav
preprocess to icraft_tensor time is 5196.524381637573ms
session forward time is 646.3329792022705ms
tenor to host time  is 0.23436546325683594ms
tenor to host time  is 34.628868103027344ms
model postprocess time is 14.235258102416992ms
报告规范且清晰问题回答有逻辑
your test audio is: ./test_data/zh.mp3
preprocess to icraft_tensor time is 887.9647254943848ms
session forward time is 606.5647602081299ms
tenor to host time  is 0.21386146545410156ms
tenor to host time  is 30.7004451751709ms
model postprocess time is 14.030933380126953ms
开放时间早上九点至下午五点
```

注意：

- 前处理时间差别较大，即输入不同样本时，前处理时间有很大不同，初步猜测是有时需要ffmpeg加载非固定频率音频而产生的耗时，目前没有系统优化，暂未评估优化空间，仅供参考，不做最终数据。
- forward时间相对稳定，循环20次测出的平均时间为521.391ms，但也会有些许波动。
- 后处理时间差别也较大（不包含数据搬运14ms-140ms），后处理是需要经过funasr库中的SentencepiecesTokenizer来获取文本的。
- 时间测试时偶尔会出现负数，怀疑是python带来的一些问题，（我认为代码逻辑没问题，代码已提供，如果有问题欢迎批评指正），以上仅供初步参考。
