Amphion tts(Text to Speech) 语音合成

强烈推荐使用带 GPU 的 Ubuntu 或 Centos 系统运行,可以租一个比较便宜的机器实例运行,如AutoDL

有了机器我们就可以按步骤操作了

step1 模型下载

git clone https://github.com/open-mmlab/Amphion.git
cd Amphion

step2 下载训练好的模型文件
huggingface下载地址 amphion/valle_libritts
可能下载比较慢,或者无法连接

可以使用镜像地址下载,一个文件一个文件下
https://hf-mirror.com/amphion/valle_libritts/tree/main
Amphion tts(Text to Speech) 语音合成_第1张图片

step3 按原目录结构,移动下载的文件

# 当前路径 	./Amphion
mkdir -p ckpts/tts
cd ckpts/tts
mkdir valle_libritts
cd valle_libritts
# 将下载的文件按照原目录结构移动到本文件夹下
mv ...

Amphion tts(Text to Speech) 语音合成_第2张图片
step4 搭建执行环境

# 当前路径 	./Amphion
# Install Python Environment
conda create --name amphion python=3.9.15
conda activate amphion # 或source activate amphion

# Install Python Packages Dependencies
sh env.sh

step5 生成语音
参数最后音频文件下载地址 https://keithito.com/LJ-Speech-Dataset/

# 当前路径 	./Amphion
sh egs/tts/VALLE/run.sh --stage 3 --gpu "0" \
--config "ckpts/tts/valle_libritts/args.json" \
--infer_expt_dir ckpts/tts/valle_libritts \
--infer_output_dir ckpts/tts/valle_libritts/result \
--infer_mode "single" \
--infer_text "This is a clip of generated speech with the given text from Amphion Vall-E model." \
--infer_text_prompt "many animals of even complex structure which live parasitically within others are wholly devoid of an alimentary cavity" \
--infer_audio_prompt ckpts/tts/valle_libritts/prompt/LJ025-0076.wav 

参数解释:
Amphion tts(Text to Speech) 语音合成_第3张图片
step6 结果检查
在这里插入图片描述

备注:
备注1 Ubuntu 遇到的一些问题及解决方案
1 RuntimeError: espeak not installed on your system

sudo apt update
sudo apt install espeak

备注2 mac 中遇到的一些问题 ,不推荐使用mac ,各种不兼容,最后自己用mac还是没有调成功
1 [Error] Please specify the running stage
解决方案:

# 终端分别执行
brew reinstall gnu-getopt
echo 'export PATH="/opt/homebrew/opt/gnu-getopt/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

2 RuntimeError: Placeholder storage has not been allocated on MPS device!

参考:
https://github.com/open-mmlab/Amphion/tree/main/egs/tts/VALLE
https://huggingface.co/amphion/valle_libritts
https://hf-mirror.com/amphion/valle_libritts/tree/main
https://keithito.com/LJ-Speech-Dataset/

你可能感兴趣的:(LLM,Python,深度学习,tts,语音合成,amphion,text,to,speech)