---
title: WeNet
canonical_url: "https://www.modelscope.cn/models/AXERA-TECH/WeNet"
md_url: "https://www.modelscope.cn/models/AXERA-TECH/WeNet.md"
repository: AXERA-TECH/WeNet
last_updated: 2026-06-14
library_name:
  - pytorch
frameworks:
  - pytorch
downloads: 16
stars: 0
---

# WeNet

> WeNet - AXERA-TECH 在 ModelScope 开源的模型。预转换好的模型在Release 基于AIShell数据集的100条语音量化

- **Repository**: AXERA-TECH/WeNet
- **Downloads**: 16
- **Stars**: 0
- **Last updated**: 2026-06-14

Source: https://www.modelscope.cn/models/AXERA-TECH/WeNet

---

# wenet.axera

WeNet on Axera.

预转换好的模型在[Release](https://github.com/ml-inory/wenet.axera/releases/download/v1.0/axmodel.tar.gz)  基于AIShell数据集的100条语音量化

## 安装依赖

x86：

```bash
pip install -r requirements_x86.txt
```

开发板：

```bash
pip install -r requirements_ax.txt
```

## 导出 ONNX

```bash
python export_onnx.py \
  --pretrained_model_dir pretrained/aishell_u2pp_conformer_exp \
  --output_onnx_dir onnx_model
```

如果不指定参数，默认会下载并使用 `pretrained/aishell_u2pp_conformer_exp`。

输出：

```text
onnx_model/encoder_offline.onnx
onnx_model/encoder_online.onnx
onnx_model/decoder.onnx
```

## 生成量化数据集

```bash
wget https://github.com/ml-inory/whisper.axera/releases/download/v1.0/datasets.zip
unzip datasets.zip -d datasets
```

```bash
python generate_data.py \
  -i datasets \
  --config pretrained/aishell_u2pp_conformer_exp/train.yaml \
  --vocab pretrained/aishell_u2pp_conformer_exp/units.txt \
  --onnx_dir onnx_model \
  --calib_data_path calibration_dataset \
  --max_num 100
```

## 转 axmodel

转换：

```bash
pulsar2 build \
  --input onnx_model/encoder_offline.onnx \
  --config config_encoder_offline.json \
  --output_dir axmodel/encoder_offline \
  --output_name encoder_offline.axmodel \
  --target_hardware AX650 \
  --npu_mode NPU3

pulsar2 build \
  --input onnx_model/encoder_online.onnx \
  --config config_encoder_online.json \
  --output_dir axmodel/encoder_online \
  --output_name encoder_online.axmodel \
  --target_hardware AX650 \
  --npu_mode NPU3

pulsar2 build \
  --input onnx_model/decoder.onnx \
  --config config_decoder.json \
  --output_dir axmodel/decoder \
  --output_name decoder.axmodel \
  --target_hardware AX650 \
  --npu_mode NPU3
```

## 跑 ONNX

Offline CTC：

```bash
python run_ort.py \
  -i demo.wav \
  --config pretrained/aishell_u2pp_conformer_exp/train.yaml \
  --vocab pretrained/aishell_u2pp_conformer_exp/units.txt \
  --onnx_dir onnx_model \
  --mode ctc_prefix_beam_search \
  --calib_data_path ""
```

Online CTC：

```bash
python run_ort.py \
  -i demo.wav \
  --online \
  --config pretrained/aishell_u2pp_conformer_exp/train.yaml \
  --vocab pretrained/aishell_u2pp_conformer_exp/units.txt \
  --onnx_dir onnx_model \
  --mode ctc_prefix_beam_search \
  --calib_data_path ""
```

Attention rescoring：

```bash
python run_ort.py \
  -i demo.wav \
  --config pretrained/aishell_u2pp_conformer_exp/train.yaml \
  --vocab pretrained/aishell_u2pp_conformer_exp/units.txt \
  --onnx_dir onnx_model \
  --mode attention_rescoring \
  --calib_data_path ""
```

## 跑 axmodel

在开发板仓库目录运行。

Offline CTC：

```bash
python3 run_ax.py -i demo.wav --mode ctc_prefix_beam_search --provider AxEngineExecutionProvider
```

Online CTC：

```bash
python3 run_ax.py -i demo.wav --online --mode ctc_prefix_beam_search --provider AxEngineExecutionProvider
```

Offline attention rescoring：

```bash
python3 run_ax.py -i demo.wav --mode attention_rescoring --provider AxEngineExecutionProvider
```

Online attention rescoring：

```bash
python3 run_ax.py -i demo.wav --online --mode attention_rescoring --provider AxEngineExecutionProvider
```

RTF 测试结果，`demo.wav` 时长 4.204s，repeat 5，不含模型加载：

| 模式 | 平均耗时 | RTF |
| --- | ---: | ---: |
| offline CTC | 0.5202s | 0.1237 |
| online CTC | 0.5582s | 0.1328 |
| offline attention rescoring | 0.5266s | 0.1253 |
| online attention rescoring | 0.5626s | 0.1338 |
