mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-28 04:59:52 +01:00
Update paddlespeech-deploy.md
This commit is contained in:
parent
8ea10d6007
commit
3b5a146740
1 changed files with 38 additions and 38 deletions
|
|
@ -1,64 +1,64 @@
|
||||||
# PaddleSpeechTTS集成xiaozhi服务
|
# PaddleSpeechTTS integrates xiaozhi service
|
||||||
|
|
||||||
## 重点说明
|
## Key Points
|
||||||
- 优点:本地离线部署、速度快
|
- Advantages: local offline deployment, fast speed
|
||||||
- 缺点:截止2025年9月25日,默认的模型是中文模型,不支持英文转语音。如果含英文会发不出声音,如需同时支持中英文需要自己训练。
|
- Disadvantages: As of September 25, 2025, the default model is the Chinese model and does not support English-to-speech conversion. If English is included, no sound will be produced. If you need to support both Chinese and English, you need to train it yourself.
|
||||||
|
|
||||||
## 一、基础环境要求
|
## 1. Basic environment requirements
|
||||||
操作系统:Windows / Linux / WSL 2
|
Operating System: Windows / Linux / WSL 2
|
||||||
|
|
||||||
Python 版本:3.9以上(请根据Paddle官方教程调整)
|
Python version: 3.9 or above (please adjust according to the Paddle official tutorial)
|
||||||
|
|
||||||
Paddle 版本:官方最新版本 ```https://www.paddlepaddle.org.cn/install```
|
Paddle version: Official latest version ```https://www.paddlepaddle.org.cn/install```
|
||||||
|
|
||||||
依赖管理工具:conda 或 venv
|
Dependency management tools: conda or venv
|
||||||
|
|
||||||
## 二、启动paddlespeech服务
|
## 2. Start the paddlespeech service
|
||||||
### 1.从paddlespeech官方仓库拉取源码
|
### 1. Pull the source code from the paddlespeech official repository
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/PaddlePaddle/PaddleSpeech.git
|
git clone https://github.com/PaddlePaddle/PaddleSpeech.git
|
||||||
```
|
```
|
||||||
### 2.建立虚拟环境
|
### 2. Create a virtual environment
|
||||||
```bash
|
```bash
|
||||||
|
|
||||||
conda create -n paddle_env python=3.10 -y
|
conda create -n paddle_env python=3.10 -y
|
||||||
conda activate paddle_env
|
conda activate paddle_env
|
||||||
```
|
```
|
||||||
### 3.安装paddle
|
### 3. Install paddle
|
||||||
因CPU架构、GPU架构不同,请根据Paddle官方支持的python版本建立环境
|
Due to different CPU and GPU architectures, please build the environment according to the Python version officially supported by Paddle.
|
||||||
```
|
```
|
||||||
https://www.paddlepaddle.org.cn/install
|
https://www.paddlepaddle.org.cn/install
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4.进入paddlespeech目录
|
### 4. Enter the paddlespeech directory
|
||||||
```bash
|
```bash
|
||||||
cd PaddleSpeech
|
cd PaddleSpeech
|
||||||
```
|
```
|
||||||
### 5.安装paddlespeech
|
### 5. Install paddlespeech
|
||||||
```bash
|
```bash
|
||||||
pip install pytest-runner -i https://pypi.tuna.tsinghua.edu.cn/simple
|
pip install pytest-runner -i https://pypi.tuna.tsinghua.edu.cn/simple
|
||||||
|
|
||||||
#以下命令使用任意一个
|
#The following commands use any one
|
||||||
pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple
|
pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple
|
||||||
pip install paddlespeech -i https://pypi.tuna.tsinghua.edu.cn/simple
|
pip install paddlespeech -i https://pypi.tuna.tsinghua.edu.cn/simple
|
||||||
```
|
```
|
||||||
### 6.使用命令自动下载语音模型
|
### 6. Use commands to automatically download the voice model
|
||||||
```bash
|
```bash
|
||||||
paddlespeech tts --input "你好,这是一次测试"
|
paddlespeech tts --input "Hello, this is a test"
|
||||||
```
|
```
|
||||||
此步骤会自动下载模型缓存至本地 .paddlespeech/models 目录
|
This step will automatically download the model cache to the local .paddlespeech/models directory
|
||||||
|
|
||||||
### 7.修改tts_online_application.yaml配置
|
### 7. Modify tts_online_application.yaml configuration
|
||||||
参考目录 ```"PaddleSpeech\demos\streaming_tts_server\conf\tts_online_application.yaml"```
|
Reference directory ```"PaddleSpeech\demos\streaming_tts_server\conf\tts_online_application.yaml"```
|
||||||
选择```tts_online_application.yaml```文件用编辑器打开,设置```protocol```为```websocket```
|
Select ```tts_online_application.yaml``` file and open it with an editor. Set ```protocol``` to ```websocket```
|
||||||
|
|
||||||
### 8.启动服务
|
### 8. Start the service
|
||||||
```yaml
|
```yaml
|
||||||
paddlespeech_server start --config_file ./demos/streaming_tts_server/conf/tts_online_application.yaml
|
paddlespeech_server start --config_file ./demos/streaming_tts_server/conf/tts_online_application.yaml
|
||||||
#官方默认启动命令:
|
#Official default startup command:
|
||||||
paddlespeech_server start --config_file ./conf/tts_online_application.yaml
|
paddlespeech_server start --config_file ./conf/tts_online_application.yaml
|
||||||
```
|
```
|
||||||
请根据你的```tts_online_application.yaml```的实际目录来启动命令,看到如下日志即启动成功
|
Please start the command according to the actual directory of your ```tts_online_application.yaml```. The startup is successful when you see the following log
|
||||||
```
|
```
|
||||||
Prefix dict has been built successfully.
|
Prefix dict has been built successfully.
|
||||||
[2025-08-07 10:03:11,312] [ DEBUG] __init__.py:166 - Prefix dict has been built successfully.
|
[2025-08-07 10:03:11,312] [ DEBUG] __init__.py:166 - Prefix dict has been built successfully.
|
||||||
|
|
@ -68,11 +68,11 @@ INFO: Application startup complete.
|
||||||
INFO: Uvicorn running on http://0.0.0.0:8092 (Press CTRL+C to quit)
|
INFO: Uvicorn running on http://0.0.0.0:8092 (Press CTRL+C to quit)
|
||||||
```
|
```
|
||||||
|
|
||||||
## 三、修改小智的配置文件
|
## 3. Modify Xiaozhi's configuration file
|
||||||
### 1.```main/xiaozhi-server/core/providers/tts/paddle_speech.py```
|
### 1.```main/xiaozhi-server/core/providers/tts/paddle_speech.py```
|
||||||
|
|
||||||
### 2.```main/xiaozhi-server/data/.config.yaml```
|
### 2.```main/xiaozhi-server/data/.config.yaml```
|
||||||
使用单模块部署
|
Using single module deployment
|
||||||
```yaml
|
```yaml
|
||||||
selected_module:
|
selected_module:
|
||||||
TTS: PaddleSpeechTTS
|
TTS: PaddleSpeechTTS
|
||||||
|
|
@ -80,24 +80,24 @@ TTS:
|
||||||
PaddleSpeechTTS:
|
PaddleSpeechTTS:
|
||||||
type: paddle_speech
|
type: paddle_speech
|
||||||
protocol: websocket
|
protocol: websocket
|
||||||
url: ws://127.0.0.1:8092/paddlespeech/tts/streaming # TTS 服务的 URL 地址,指向本地服务器 [websocket默认ws://127.0.0.1:8092/paddlespeech/tts/streaming]
|
url: ws://127.0.0.1:8092/paddlespeech/tts/streaming # URL of TTS service, pointing to local server [websocket default is ws://127.0.0.1:8092/paddlespeech/tts/streaming]
|
||||||
spk_id: 0 # 发音人 ID,0 通常表示默认的发音人
|
spk_id: 0 # Pronouncer ID, 0 usually indicates the default speaker
|
||||||
sample_rate: 24000 # 采样率 [websocket默认24000,http默认0 自动选择]
|
sample_rate: 24000 # sampling rate [websocket default is 24000, http default is 0 automatic selection]
|
||||||
speed: 1.0 # 语速,1.0 表示正常语速,>1 表示加快,<1 表示减慢
|
speed: 1.0 # speaking speed, 1.0 means normal speaking speed, >1 means faster speaking speed, <1 means slower speaking speed
|
||||||
volume: 1.0 # 音量,1.0 表示正常音量,>1 表示增大,<1 表示减小
|
volume: 1.0 # volume, 1.0 means normal volume, >1 means increase, <1 means decrease
|
||||||
save_path: # 保存路径
|
save_path: # Save path
|
||||||
```
|
```
|
||||||
### 3.启动xiaozhi服务
|
### 3. Start the xiaozhi service
|
||||||
```py
|
```py
|
||||||
python app.py
|
python app.py
|
||||||
```
|
```
|
||||||
打开test目录下的test_page.html,测试连接和发送消息时paddlespeech端是否有输出日志
|
Open test_page.html in the test directory to test the connection and whether there is output log on the paddlespeech side when sending messages
|
||||||
|
|
||||||
输出日志参考:
|
Output log reference:
|
||||||
```
|
```
|
||||||
INFO: 127.0.0.1:44312 - "WebSocket /paddlespeech/tts/streaming" [accepted]
|
INFO: 127.0.0.1:44312 - "WebSocket /paddlespeech/tts/streaming" [accepted]
|
||||||
INFO: connection open
|
INFO: connection open
|
||||||
[2025-08-07 11:16:33,355] [ INFO] - sentence: 哈哈,怎么突然找我聊天啦?
|
[2025-08-07 11:16:33,355] [ INFO] - sentence: Haha, why are you suddenly chatting with me?
|
||||||
[2025-08-07 11:16:33,356] [ INFO] - The durations of audio is: 2.4625 s
|
[2025-08-07 11:16:33,356] [ INFO] - The durations of audio is: 2.4625 s
|
||||||
[2025-08-07 11:16:33,356] [ INFO] - first response time: 0.1143045425415039 s
|
[2025-08-07 11:16:33,356] [ INFO] - first response time: 0.1143045425415039 s
|
||||||
[2025-08-07 11:16:33,356] [ INFO] - final response time: 0.4777836799621582 s
|
[2025-08-07 11:16:33,356] [ INFO] - final response time: 0.4777836799621582 s
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue