
基于卷积网络基于文本到语音综合模型的Pytorch实现:
音频样本可在https://r9y9.github.io/deepvoice3_pytorch/上找到。
笔记本应该在https://colab.research.google.com上执行:
注意:验证的模型与主体不兼容。即将更新。
| URL | 模型 | 数据 | 超级参数 | git提交 | 步骤 |
|---|---|---|---|---|---|
| 关联 | DeepVoice3 | ljspeech | 关联 | ABF0A21 | 640k |
| 关联 | Nyanko | ljspeech | builder=nyanko,preset=nyanko_ljspeech | BA59DC7 | 585k |
| 关联 | 多演讲者DeepVoice3 | VCTK | builder=deepvoice3_multispeaker,preset=deepvoice3_vctk | 0421749 | 300k + 300k |
要使用预训练的模型,强烈建议您使用上述特定的git订单。 IE,
git checkout ${commit_hash}
然后遵循“从检查点的合成”部分,在“特定git commit”的读书中。请注意,最新的开发版本可能无法使用。
您可以尝试:
# pretrained model (20180505_deepvoice3_checkpoint_step000640000.pth)
# hparams (20180505_deepvoice3_ljspeech.json)
git checkout 4357976
python synthesis.py --preset=20180505_deepvoice3_ljspeech.json
20180505_deepvoice3_checkpoint_step000640000.pth
sentences.txt
output_dir
hparams.py 。builder指定您要使用的型号。 deepvoice3 , deepvoice3_multispeaker [1]和nyanko [2]被覆盖。请首先安装上面列出的软件包,然后
git clone https://github.com/r9y9/deepvoice3_pytorch && cd deepvoice3_pytorch
pip install -e ".[bin]"
有许多超级参数要转动取决于您正在使用的模型和数据。对于典型的数据集和模型,存储库中提供了已知工作良好的参数(预设)。有关详细信息,请参见presets目录。注意
preprocess.pytrain.pysynthesis.py接受--preset=<json>可选参数,该参数指定在哪里加载预设参数。如果要使用预设参数,则必须在整个预处理,培训和评估中使用相同的--preset=<json> 。例如,
python preprocess.py --preset=presets/deepvoice3_ljspeech.json ljspeech ~/data/LJSpeech-1.0
python train.py --preset=presets/deepvoice3_ljspeech.json --data-root=./data/ljspeech
而不是
python preprocess.py ljspeech ~/data/LJSpeech-1.0
# warning! this may use different hyper parameters used at preprocessing stage
python train.py --preset=presets/deepvoice3_ljspeech.json --data-root=./data/ljspeech
用法:
python preprocess.py ${dataset_name} ${dataset_path} ${out_dir} --preset=<json>
支持的${dataset_name} s是:
ljspeech (en,单扬声器)vctk (EN,多演讲者)jsut (JP,单人扬声器)nikl_m (KO,多演讲者)nikl_s (KO,单扬声器)假设您使用已知的预设参数可用于ljspeech数据集/deepVoice3,并且在~/data/LJSpeech-1.0中具有数据,则可以通过以下方式进行预处理数据
python preprocess.py --preset=presets/deepvoice3_ljspeech.json ljspeech ~/data/LJSpeech-1.0/ ./data/ljspeech
完成此操作后,您将在./data/ljspeech中看到提取的功能(MEL-SPECTROGINS和线性谱图)。
目前支持使用JSON格式的元数据(与CARPEDM20/Multi-E-Takotron-TensorFlow)建立自己的数据集。用法:
python preprocess.py json_meta ${list-of-JSON-metadata-paths} ${out_dir} --preset=<json>
您可能需要修改预先存在的预设JSON文件,尤其是n_speakers 。对于英语MultiSpeaker,请从presets/deepvoice3_vctk.json开始。
假设您有数据集A(扬声器A)和数据集B(扬声器B),则每个数据集在JSON Metadata File ./datasets/datasetA/alignment.json and ./datasets/datasetB/alignment.json中进行了描述。
python preprocess.py json_meta "./datasets/datasetA/alignment.json,./datasets/datasetB/alignment.json" "./datasets/processed_A+B" --preset=(path to preset json file)
一些数据集,尤其是自动生成的数据集可能包括长时间的沉默和不良的前导/尾声噪声,从而破坏了char-Level SEQ2SEQ模型。 (例如,VCTK,尽管它用VCTK_PREPROCESS涵盖)
为了解决问题, gentle_web_align.py将
gentle_web_align.py使用Gentle,一种基于Kaldi的语音文本对齐工具。这访问了网络安装的温和应用程序,对成绩单的声音段对齐,并将结果转换为htk式标签文件,并在preprocess.py中处理。温和可以在Linux/Mac/Windows(通过Docker)中运行。
初步结果表明,虽然vctk_preprocess/prepare_vctk_labels.py在VCTK上的htk/Festival/基于Merlin的方法在VCTK上的工作效果更好,但柔和的音频剪辑具有带有环境噪音的音频剪辑。 (例如电影摘录)
用法:(假设温柔在localhost:8567 (未指定时默认值))
datasetA/wavs和成绩单位于datasetA/txts ) python gentle_web_align.py -w "datasetA/wavs/*.wav" -t "datasetA/txts/*.txt" --server_addr=localhost --port=8567
datasetB/speakerN/blahblah.wav和datasetB/speakerN/blahblah.txt ) python gentle_web_align.py --nested-directories="datasetB" --server_addr=localhost --port=8567
每种话语都具有音素对齐后,您可以通过运行preprocess.py提取功能
用法:
python train.py --data-root=${data-root} --preset=<json> --hparams="parameters you may want to override"
假设您使用LJSpeech数据集构建DeepVoice3风格的模型,然后可以通过以下方式训练您的模型
python train.py --preset=presets/deepvoice3_ljspeech.json --data-root=./data/ljspeech/
默认情况下,模型检查点(.pth)和对齐(.png ./checkpoints保存在每10000个步骤中。
请先检查一下,然后按照以下命令进行检查。
python preprocess.py nikl_s ${your_nikl_root_path} data/nikl_s --preset=presets/deepvoice3_nikls.json
python train.py --data-root=./data/nikl_s --checkpoint-dir checkpoint_nikl_s --preset=presets/deepvoice3_nikls.json
默认情况下,将日志倾倒在./log目录中。您可以通过张板监视日志:
tensorboard --logdir=log
给定文本列表, synthesis.py合成了训练有素的模型的音频信号。用法是:
python synthesis.py ${checkpoint_path} ${text_list.txt} ${output_dir} --preset=<json>
示例test_list.txt:
Generative adversarial network or variational auto-encoder.
Once upon a time there was a dear little girl who was loved by every one who looked at her, but most of all by her grandmother, and there was nothing that she would not have given to the child.
A text-to-speech synthesis system typically consists of multiple stages, such as a text analysis frontend, an acoustic model and an audio synthesis module.
VCTK和NIKL受支持用于构建多演讲型模型的数据集。
由于VCTK中的某些音频样本会影响性能长时间,因此建议进行音素对齐并根据VCTK_PREPROCESS去除沉默。
一旦对每种话语进行音素对齐,就可以通过以下方式提取功能:
python preprocess.py vctk ${your_vctk_root_path} ./data/vctk
现在您准备了数据,然后您可以通过以下方式培训DeepVoice3的多演讲者版本
python train.py --data-root=./data/vctk --checkpoint-dir=checkpoints_vctk
--preset=presets/deepvoice3_vctk.json
--log-event-path=log/deepvoice3_multispeaker_vctk_preset
如果您想重用从其他数据集中学习的学习嵌入,则可以通过:
python train.py --data-root=./data/vctk --checkpoint-dir=checkpoints_vctk
--preset=presets/deepvoice3_vctk.json
--log-event-path=log/deepvoice3_multispeaker_vctk_preset
--load-embedding=20171213_deepvoice3_checkpoint_step000210000.pth
这可能会提高训练速度。
您将能够在../ nikl_preprocoess中获得清理的音频样本。详细信息在此处找到。
一旦Nikl语料库准备从预处理中使用,您就可以通过以下方式提取功能
python preprocess.py nikl_m ${your_nikl_root_path} data/nikl_m
现在您准备了数据,然后您可以通过以下方式培训DeepVoice3的多演讲者版本
python train.py --data-root=./data/nikl_m --checkpoint-dir checkpoint_nikl_m
--preset=presets/deepvoice3_niklm.json
如果您的数据非常有限,则可以考虑尝试微调预训练的模型。例如,使用LJSpeech上的预训练模型,您可以通过以下命令将其调整为VCTK扬声器p225 (30分钟)的数据:
python train.py --data-root=./data/vctk --checkpoint-dir=checkpoints_vctk_adaptation
--preset=presets/deepvoice3_ljspeech.json
--log-event-path=log/deepvoice3_vctk_adaptation
--restore-parts="20171213_deepvoice3_checkpoint_step000210000.pth"
--speaker-id=0
根据我的经验,它可以很快获得合理的语音质量,而不是从头开始训练模型。
上面有两个重要的选项:
--restore-parts=<N> :它指定了加载模型参数的位置。选项--checkpoint=<N>的差异为1) --restore-parts=<N>忽略所有无效的参数,而--checkpoint=<N>则没有。 2) --restore-parts=<N>告诉教练从0步启动,而--checkpoint=<N>告诉教练从最后一步开始。 --checkpoint=<N>如果您使用完全相同的型号并继续训练,则应该可以,但是如果您想自定义模型体系结构并获得预训练的模型,那将是有用的。--speaker-id=<N> :它指定数据使用者用于培训。仅当您使用多演讲者数据集时,才能指定这一点。至于VCTK,根据数据集中的speaker_info.txt ,将自动分配扬声器ID(0,1,...,107)。如果您正在培训多演讲型模型,则只有在n_speakers相同的情况下,扬声器的改编才能起作用。
这可能会根据Matplotlib的后端而定。尝试更改matplotlib的后端,看看它是否工作如下:
MPLBACKEND=Qt5Agg python train.py ${args...}
在#78中,Engiecat报告说,将Matplotlib的后端从TKINTER(TKAGG)更改为PYQT5(QT5AGG)解决了问题。
代码的一部分是根据以下项目改编的:
@jraulhernandezi创建的横幅和徽标(#76)