文章目录
概要
由于项目上有粤语TTS需求
于是找到开源项目https://github.com/RVC-Boss/GPT-SoVITS
通过模型训练或者开源模型获取对应语音模型的GPT及SoVITS模型
按照readme在CentOS上安装
整体部署流程
conda create -n GPTSoVits python=3.9
conda activate GPTSoVits
bash install.sh
创建虚拟环境,安装相应依赖
直接运行python api_v2.py 报错
打开\GPT_SoVITS\configs\tts_infer.yaml
根据自身条件修改
文件中默认的 bert_base_path 和 cnhuhbert_base_path找不到对应文件,需自身额外下载预训练模型并配置路径
如果需要在cpu上进行推理,设置device=cpu,is_half:false
t2s_weights_path和vits_weights_path分别填写上文所提语音GPT和SoVITS模型对应路径,
路径需放置在“”内(未测试无“”是否影响运行)
模型如果存在中文,需将中文转为unicode编码(未测试中文路径是否影响运行)
#以下是tts_infer.yaml相关配置
custom:
bert_base_path: GPT_SoVITS/pretrained_models/chinese-roberta-wwm-ext-large
cnhuhbert_base_path: GPT_SoVITS/pretrained_models/chinese-hubert-base
device: cpu
is_half: false
t2s_weights_path: "GPT_weights_v2/\u5B59\u7B11\u5DDDGPT.ckpt"
version: v2
vits_weights_path: "SoVITS_weights_v2/\u5B59\u7B11\u5DDDSoVITS.pth"
default:
bert_base_path: GPT_SoVITS/pretrained_models/chinese-roberta-wwm-ext-large
cnhuhbert_base_path: GPT_SoVITS/pretrained_models/chinese-hubert-base
device: cpu
is_half: false
t2s_weights_path: GPT_SoVITS/pretrained_models/s1bert25hz-2kh-longer-epoch=68e-step=50232.ckpt
version: v1
vits_weights_path: GPT_SoVITS/pretrained_models/s2G488k.pth
default_v2:
bert_base_path: GPT_SoVITS/pretrained_models/chinese-roberta-wwm-ext-large
cnhuhbert_base_path: GPT_SoVITS/pretrained_models/chinese-hubert-base
device: cpu
is_half: false
t2s_weights_path: GPT_SoVITS/pretrained_models/gsv-v2final-pretrained/s1bert25hz-5kh-longer-epoch=12-step=369668.ckpt
version: v2
vits_weights_path: GPT_SoVITS/pretrained_models/gsv-v2final-pretrained/s2G2333k.pth
再次运行python api_v2.py 运行成功!
但是访问本机地址:9880 提示HTTP ERROR 502
修改api_v2.py
parser.add_argument("-a", "--bind_addr", type=str, default="127.0.0.1", help="default: 127.0.0.1")
修改对应绑定地址为default="0.0.0.0"
保存并重新运行python api_v2.py
再次访问本机地址:9880 访问成功,在路径后输入/docs进入FastApi界面,填写对应参数可以实现TTS推理
---------------------------------------------TTS Config---------------------------------------------
device : cpu
is_half : False
version : v2
t2s_weights_path : GPT_weights_v2/xxxGPT.ckpt
vits_weights_path : SoVITS_weights_v2/xxxSoVITS.pth
bert_base_path : GPT_SoVITS/pretrained_models/chinese-roberta-wwm-ext-large
cnhuhbert_base_path : GPT_SoVITS/pretrained_models/chinese-hubert-base
----------------------------------------------------------------------------------------------------
Loading Text2Semantic weights from GPT_weights_v2/xxxGPT.ckpt
Loading VITS weights from SoVITS_weights_v2/xxxSoVITS.pth
Loading BERT weights from GPT_SoVITS/pretrained_models/chinese-roberta-wwm-ext-large
Loading CNHuBERT weights from GPT_SoVITS/pretrained_models/chinese-hubert-base
INFO: Started server process [30021]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:9880 (Press CTRL+C to quit)
Building prefix dict from the default dictionary ...
出现以上运行结果表示项目成功运行
如果出现以下报错
"Exception": "/lib64/libm.so.6: version `GLIBC_2.29' not found (required by /root/anaconda3/envs/TTS/lib/python3.9/site-packages/opencc/clib/lib/libopencc.so.1.1)"
需要下载opencc 版本==1.1.0
小结
整合包及模型下载链接https://www.yuque.com/baicaigongchang1145haoyuangong/ib3g1e/dkxgpiy9zb96hob4
标签:V2,base,SoVITS,liunx,GPT,path,weights,pretrained From: https://blog.csdn.net/Kongqingpeng11/article/details/144215191