Skip to content

AXERA-TECH/ax_tts_api

Repository files navigation

ax_tts_api

C++ TTS API on Axera platforms

支持平台:

  • AX650
  • AX630C
  • AX620Q
  • AX8850

支持模型:

  • Kokoro

文档目录

更新

快速开始

可从Release页面下载预编译库

使用示例: test_kokoro

下载模型

安装huggingface_hub

pip3 install -U huggingface_hub

运行下载脚本:

bash download_models.sh

编译

依赖

系统要求

目前在Ubuntu 22.04上编译成功,
需要安装CMake >= 3.13

sudo apt install cmake build-essential

获取交叉编译器

  • AX650/AX630C(aarch64) 从此处获取aarch64交叉编译器
    将其添加到PATH:
export PATH=$PATH:path of gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin
  • AX620Q(arm-uclibc-linux) 从此处获取
export PATH=$PATH:path of arm-AX620E-linux-uclibcgnueabihf/bin

获取BSP

bash download_bsp.sh

交叉编译

  • AX650
bash build_ax650.sh

编译完成后的产物在install/ax650下

  • AX630C
bash build_ax630c.sh

编译完成后的产物在install/ax630c下

  • AX620Q
bash build_ax620q.sh

编译完成后的产物在install/ax620q下

  • AX8850
bash build_ax8850_aarch64.sh.sh

编译完成后的产物在install/ax8850_aarch64下

本地编译

暂不支持

其它编译选项

  • BUILD_TESTS 默认OFF
    负责编译tests目录下的单元测试,可执行程序生成在install/ax650或install/ax630c下
bash build_ax650.sh -DBUILD_TESTS=ON
  • LOG_LEVEL_DEBUG 默认OFF
    打印源码中的调试信息
bash build_ax650.sh -DLOG_LEVEL_DEBUG=ON
  • BUILD_SERVER 默认ON
    编译asr_server
bash build_ax650.sh -DBUILD_SERVER=ON

测试

主程序

./install/ax650/main -l en -t "Hello, World!" -o en.wav

Usage:

usage: ./install/ax650/main --language=string --text=string --output=string [options] ...
options:
  -l, --language    Language, in ISO-639 format (string)
  -t, --text        Input text (string)
  -o, --output      Output wav path (string)
  -?, --help        print this message

服务端(asr_server)

./install/ax8850_aarch64/tts_server --port 8080

Usage:

usage: ./install/ax650/tts_server [options] ...
options:
  -p, --port          On which port to run the server (int [=8080])
  -m, --model_path    model path which contains axmodel (string [=./models-ax650])
  -?, --help          print this message


客户端

Python

cd scripts
pip install openai
python test_tts_server.py --ip 10.126.33.140 --port 8080 -t "Hello, World" --output test_en

Check python test_tts_server.py --help for help.

单元测试

以下为tests下单元测试的使用示例和说明:

  • test_kokoro: 加载kokoro模型,测试中英文的生成结果

性能表现

RTF(Real Time Factor)为推理时间除以音频时长,越小表示越快
TTS的RTF表现与文本长度和前端实现有很强的关系,此处仅列出test_kokoro的结果

  • AX650:
================================
test_en:
input text: Hello, World!
output duration: 1.40 seconds
output file: test_en.wav
RTF(0.78 / 1.40) = 0.5593

================================
test_zh:
input text: 一切有为法,如梦幻泡影,如露亦如电,应作如是观。
output duration: 4.22 seconds
output file: test_zh.wav
RTF(0.54 / 4.22) = 0.1280
  • AX8850:
================================
test_en:
input text: Hello, World!
output duration: 1.40 seconds
output file: test_en.wav
RTF(0.52 / 1.40) = 0.3736

================================
test_zh:
input text: 一切有为法,如梦幻泡影,如露亦如电,应作如是观。
output duration: 4.22 seconds
output file: test_zh.wav
RTF(0.37 / 4.22) = 0.0880

集成

编译产物包含 include/ax_tts_api.h 和 lib/libax_tts_api.so

讨论

  • Github issues
  • QQ 群: 139953715

贡献

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

C++ TTS API on Axera platforms

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors