赞
踩
搭载了该项目所需要的所有环境和模型
windows下只能使用wsl运行此项目训练的训练,不过貌似不需要wsl也可以运行推理
目前项目正在快速发展中…未来可期喵
项目仓库:https://github.com/fishaudio/fish-speech
文档链接:https://speech.fish.audio/finetune/(必看)
我放了一套 孙笑川 测试数据集在镜像里面,有需要的可以试试,不需要的话删了或者不管就是了
如果你的是长音频,则将长音频放入audio slicer内的input文件夹内,进行切割,然后就可以一路标注和预处理,训练了
如果你的是已经处理好的短音频片段,则将短音频放入标注文件夹,然后就可以进行标注,预处理,训练了
如果你既有标注,又有短音频片段,则将短音频放入workdir/fish-speech/data/demo-raw内,标注文件放入workdir/fish-spech,然后就可以预处理,训练了
镜像和文档内的操作有一点点不一样,不过不影响,大佬随意,小白还是建议跟着镜像走(
#移动项目到数据盘节约空间
%mv /root/workdir/ /root/autodl-tmp/
#填入你的说话人名称
#在每次进入笔记本前请先运行一次这个代码块
speaker = “sunxiaochuan”
#创建文件夹
%mkdir /root/autodl-tmp/workdir/fish-speech/data/demo-raw/{speaker}
#进入切割文件夹
%cd /root/autodl-tmp/workdir/audio-slicer/
#开始切割
!bash 切割,启动!.sh
#移动音频文件到标注文件夹
%mv output/*.wav …/auto-VITS-DataLabeling/raw_audio
#进入标注文件夹
%cd /root/autodl-tmp/workdir/auto-VITS-DataLabeling
#对音频进行重命名
#在运行这步之前,请确保你已经在准备部分进行过一次说话人的修改
#重命名后的音频位于workdir/auto-vits-DataLabeling/raw_audio文件夹中
import subprocess
bash_script = f’‘’
#!/bin/bash
speaker=“{speaker}”
counter=1
for file in ./raw_audio/; do
if [ -f "
f
i
l
e
"
]
;
t
h
e
n
n
e
w
n
a
m
e
=
"
file" ]; then new_name="
file"];thennewname="{{speaker}}_$(printf “%04d”
c
o
u
n
t
e
r
)
"
e
x
t
e
n
s
i
o
n
=
"
{{counter}})" extension="
counter)"extension="{{file##.}}"
mv "
f
i
l
e
"
"
.
/
r
a
w
a
u
d
i
o
/
file" "./raw_audio/
file""./rawaudio/new_name.
e
x
t
e
n
s
i
o
n
"
c
o
u
n
t
e
r
=
extension" counter=
extension"counter=((counter + 1))
fi
done
echo “重命名完成”
‘’’
subprocess.run(bash_script, shell=True);
#标注,默认使用whisper,中文推荐使用下面个
#使用whisper请在标注后检查并手动清洗一下数据
!python labeling_whisper_CJE.py
#!python auto_DataLabeling_ZH.py
#因为标注脚本我从bv2直接复制的,所以需要稍微转换一下
#如果你在我之前的bv2镜像进行过标注,则可以将标注放在workdir/auto-VITS-DataLabeling文件夹,直接运行这一步转换为该镜像可用格式
!python listfix.py
%rm -rf long_*.txt
#复制标注文件到fish speech文件夹
%cp speaker.list /root/autodl-tmp/workdir/fish-speech
#移动音频到fish speech文件夹
%mv raw_audio/* …/fish-speech/data/demo-raw/{speaker}
#划分数据集和验证集
!python tools/vqgan/create_train_split.py data/demo --filelist speaker.list
#开始微调
!python fish_speech/train.py --config-name vqgan_finetune
#将微调过后的模型复制到 output 文件夹下
%cp results/vqgan_finetune/checkpoints/* output/vqgan_finetune
#进入fish-speech文件夹
%cd /root/autodl-tmp/workdir/fish-speech/
#进行响度匹配
!fap loudness-norm data/demo-raw/ data/demo/ --clean
#提取语义 token
!python tools/vqgan/extract_vq.py data/demo
–num-workers 1 --batch-size 16
–config-name “vqgan_pretrain”
–checkpoint-path “checkpoints/vqgan-v1.pth”
–filelist speaker.list
#打包数据集为 protobuf
!python tools/llama/build_dataset.py
–config “fish_speech/configs/data/finetune.yaml”
–output “data/quantized-dataset-ft.protos”
–num-workers 16
–filelist speaker.list
#启动rust数据服务器
#复制以下命令到终端运行
export RUST_LOG=info
cd /root/autodl-tmp/workdir/fish-speech
data_server/target/release/data_server
–files “data/quantized-dataset-ft.protos”
#启动微调
#微调结束后可关掉上一条命令所打开的服务
#epoch一直为0是正常的
!python fish_speech/train.py --config-name text2semantic_finetune
#将微调过后的模型复制到 output 文件夹下
%cp results/text2semantic_400m_finetune_spk/checkpoints/* output/text2semantic_400m_finetune_spk
#开启tensorboard(训练日志可视化)(训练的时候请复制到终端运行)
!ps -ef | grep tensorboard | awk ‘{print $2}’ | xargs kill -9
!tensorboard --port 6007 --logdir=/root/autodl-tmp/workdir/fish-speech/results/text2semantic_400m_finetune_spk/tensorboard
cd /root/autodl-tmp/workdir/fish-speech
python -m zibai tools.api_server:app --listen 127.0.0.1:8000
#启动webui进行推理
!GRADIO_SERVER_NAME=127.0.0.1 GRADIO_SERVER_PORT=6006 python fish_speech/webui/app.py
#!bash del.sh
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。