FCH TTS
1.0.0
簡體中文| English
[TOC]
.
|--- config/ # 配置文件
|--- default.yaml
|--- ...
|--- datasets/ # 数据处理
|--- encoder/ # 声纹编码器
|--- voice_encoder.py
|--- ...
|--- helpers/ # 一些辅助类
|--- trainer.py
|--- synthesizer.py
|--- ...
|--- logdir/ # 训练过程保存目录
|--- losses/ # 一些损失函数
|--- models/ # 合成模型
|--- layers.py
|--- duration.py
|--- parallel.py
|--- pretrained/ # 预训练模型(LJSpeech 数据集)
|--- samples/ # 合成样例
|--- utils/ # 一些通用方法
|--- vocoder/ # 声码器
|--- melgan.py
|--- ...
|--- wandb/ # Wandb 保存目录
|--- extract-duration.py
|--- extract-embedding.py
|--- LICENSE
|--- prepare-dataset.py # 准备脚本
|--- README.md
|--- README_en.md
|--- requirements.txt # 依赖文件
|--- synthesize.py # 合成脚本
|--- train-duration.py # 训练脚本
|--- train-parallel.py
部分合成樣例見這裡。
部分預訓練模型見這裡。
步驟(1) :克隆倉庫
$ git clone https://github.com/atomicoo/ParallelTTS.git步驟(2) :安裝依賴
$ conda create -n ParallelTTS python=3.7.9
$ conda activate ParallelTTS
$ pip install -r requirements.txt步驟(3) :合成語音
$ python synthesize.py
--checkpoint ./pretrained/ljspeech-parallel-epoch0100.pth
--melgan_checkpoint ./pretrained/ljspeech-melgan-epoch3200.pth
--input_texts ./samples/english/synthesize.txt
--outputs_dir ./outputs/如果要合成其他語種的語音,需要通過--config指定相應的配置文件。
步驟(1) :準備數據
$ python prepare-dataset.py通過--config可以指定配置文件,默認的default.yaml針對LJSpeech 數據集。
步驟(2) :訓練對齊模型
$ python train-duration.py步驟(3) :提取持續時間
$ python extract-duration.py通過--ground_truth可以指定是否利用對齊模型生成Ground-Truth 聲譜圖。
步驟(4) :訓練合成模型
$ python train-parallel.py通過--ground_truth可以指定是否使用Ground-Truth 聲譜圖進行模型訓練。
如果使用TensorBoardX,則運行如下命令:
$ tensorboard --logdir logdir/[DIR]/
強烈推薦使用Wandb(Weights & Biases),只需在上述訓練命令中增加--enable_wandb選項。
TODO:待補充
訓練速度:對於LJSpeech 數據集,設置批次尺寸為64,可以在單張8GB 顯存的GTX 1080 顯卡上進行訓練,訓練~8h(~300 epochs)後即可合成質量較高的語音。
合成速度:以下測試在CPU @ Intel Core i7-8550U / GPU @ NVIDIA GeForce MX150 下進行,每段合成音頻在8 秒左右(約20 詞)
| 批次尺寸 | Spec (GPU) | Audio (GPU) | Spec (CPU) | Audio (CPU) |
|---|---|---|---|---|
| 1 | 0.042 | 0.218 | 0.100 | 2.004 |
| 2 | 0.046 | 0.453 | 0.209 | 3.922 |
| 4 | 0.053 | 0.863 | 0.407 | 7.897 |
| 8 | 0.062 | 2.386 | 0.878 | 14.599 |
注意,沒有進行多次測試取平均值,結果僅供參考。
vocoder代碼取自ParallelWaveGAN,由於聲學特徵提取方式不兼容,需要進行轉化,具體轉化代碼見這裡。