Code Monkey home page Code Monkey logo

fish-diffusion's Introduction

LOGO

Fish Diffusion


一个简单易懂的 TTS / SVS / SVC 框架.

从阅读 Wiki 开始!

English Document

简介

基于 DiffSinger 实现歌声音色转换。相较于原 diffsvc 仓库,本仓库优缺点如下

  • 支持多说话人
  • 本仓库代码结构更简单易懂, 模块全部解耦
  • 声码器同样使用 441khz Diff Singer 社区声码器
  • 支持多机多卡训练, 支持半精度训练, 拯救你的训练速度和显存

环境准备

以下命令需要在 python 3.10 的 conda 环境下执行

# 安装 PyTorch 相关核心依赖, 如果已安装则跳过
# 参考 https://pytorch.org/get-started/locally/
conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia

# 安装 Poetry 依赖管理工具, 如果已安装则跳过
# 参考 https://python-poetry.org/docs/#installation
curl -sSL https://install.python-poetry.org | python3 -

# 安装依赖 (推荐)
poetry install

# 如果 Poetry 不可用, 或者速度较慢, 可以使用 pip 安装依赖
pip install -r requirements.txt
pip install -e .

声码器准备

Fish Diffusion 需要 OPENVPI 441khz NSF-HiFiGAN 声码器来生成音频.

自动下载

python tools/download_nsf_hifigan.py

如果你的训练环境处于国内, 可以使用 GitHub Proxy 来加速下载.

python tools/download_nsf_hifigan.py --use-ghproxy

如果你正在使用脚本自动化训练, 可以使用传参 --agree-license 的方式同意 CC BY-NC-SA 4.0 许可证.

python tools/download_nsf_hifigan.py --agree-license

手动下载

下载 441khz 声码器 中的 nsf_hifigan_20221211.zip

解压 nsf_hifigan 文件夹到 checkpoints 目录下 (如果没有则创建)

数据集准备

仅需要以以下文件结构将数据集放入 dataset 目录即可

dataset
├───train
│   ├───xxx1-xxx1.wav
│   ├───...
│   ├───Lxx-0xx8.wav
│   └───speaker0 (支持子目录)
│       └───xxx1-xxx1.wav
└───valid
    ├───xx2-0xxx2.wav
    ├───...
    └───xxx7-xxx007.wav
# 提取全部数据的特征, 如 pitch, text features, mel features 等
python tools/preprocessing/extract_features.py --config configs/svc_hubert_soft.py --path dataset --clean

基本训练

该项目仍在积极开发, 请记得备份你的 config 文件
该项目仍在积极开发, 请记得备份你的 config 文件
该项目仍在积极开发, 请记得备份你的 config 文件

# 单机单卡 / 单机多卡训练
python train.py --config configs/svc_hubert_soft.py

# 继续训练
python train.py --config configs/svc_hubert_soft.py --resume [checkpoint]

# 微调预训练模型
# 注意: 你应该调整配置文件中的学习率调度器为 warmup_cosine_finetune
python train.py --config configs/svc_hubert_soft.py --pretrained [checkpoint]

推理

# 命令行推理, 你可以使用 --help 查看更多参数
python inference.py --config [config] \
    --checkpoint [checkpoint] \
    --input [input audio] \
    --output [output audio]


# Gradio Web 推理, 其他参数会被转为 Gradio 默认参数
python inference/gradio_inference.py --config [config] \
    --checkpoint [checkpoint] \
    --gradio

将 DiffSVC 模型转换为 Fish Diffusion 模型

python tools/diff_svc_converter.py --config configs/svc_hubert_soft_diff_svc.py \
    --input-path [DiffSVC ckpt] \
    --output-path [Fish Diffusion ckpt]

参与本项目

如果你有任何问题, 请提交 issue 或 pull request.
你应该在提交 pull request 之前运行 tools/lint.sh

实时预览文档

sphinx-autobuild docs docs/_build/html

参考项目

感谢所有贡献者作出的努力

fish-diffusion's People

Contributors

geraint-dou avatar huanlinoto avatar innnky avatar kangarroar avatar leng-yue avatar lordelf avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.