Pocket-TTS.AXERA

Pocket-TTS 的 AX650 板端语音生成推理 demo。 量化模型 + Python 推理脚本 + C++ 预编译可执行文件,即取即用。

  • Python 推理(axmodel + 动态 KV ONNX 混合,支持非流式/流式)
  • C++ 推理(bin/ 下预编译可执行文件,无需编译)

导出、量化与 C++ 源码见 GitHub: ZY-2012/pocket-tts.AXERA

目录结构

pocket-tts-axera-inference/
├── bin/                            # C++ 可执行文件 + ONNX Runtime 运行库
│   ├── pocket_tts_dynamic_kv
│   └── libonnxruntime.so.1.23.2   (+ libonnxruntime.so.1 符号链接)
├── models/                         # 动态 KV ONNX(Flow-AR FP32 + Mimi frontend QInt8)及 manifest
├── model_convert/                  # 静态 step AX650 axmodel 及 manifest
├── board/                          # Python 运行时代码和资源(tokenizer、voice embedding)
├── prepare_request.py              # 文本 → C++ request 文件转换
├── run_ax650.sh                    # C++ 一键推理(非流式)
├── run_ax650_streaming.sh          # C++ 一键推理(流式)
├── infer_board_axmodel.py          # Python 推理入口
├── requirements.txt
├── config.json / configuration.json
└── README.md

下载

# huggingface-cli
huggingface-cli download HY-2012/pocket-tts.AXERA

# 或 git + LFS
git lfs install
git clone https://huggingface.co/HY-2012/pocket-tts.AXERA

Python

环境

conda create -n pocket-tts python=3.10
conda activate pocket-tts
pip3 install axengine-x.x.x-py3-none-any.whl
pip3 install -r requirements.txt

axengine 安装包从 pyaxengine Releases

推理

在工程根目录执行(AX650 设备):

python3 infer_board_axmodel.py \
  --text "A traveler walked beside the river as afternoon light softened the hills." \
  --voice alba \
  --output output/python.wav

长文本可使用文本文件:

python3 infer_board_axmodel.py \
  --text-file input.txt \
  --output output/python_long.wav

流式输出:

python3 infer_board_axmodel.py \
  --text "The train arrived before sunset." \
  --streaming 1 \
  --output output/python_streaming.wav

C++

预编译可执行文件在 bin/,无需编译直接运行。源码与编译方法见 GitHub 工程 cpp/

在工程根目录执行:

bash run_ax650.sh

自定义文本:

TEXT="The train arrived before sunset, and the station became quiet." \
bash run_ax650.sh

流式推理:

TEXT="The train arrived before sunset, and the station became quiet." \
bash run_ax650_streaming.sh

输出在 output/ 目录。

模型转换

模型由 ONNX 导出,并使用 Pulsar2 转换为 AX650 axmodel。推理使用 AX650 axmodel 与动态 KV ONNX 混合运行。导出/量化步骤见 GitHub 工程

参考:Pulsar2 文档

参考

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support