πŸ€– πŸ’¬ Deep learning for Text to Speech (Discussion forum: https://discourse.mozilla.org/c/tts)
ΠŸΠ΅Ρ€Π΅ΠΉΡ‚ΠΈ ΠΊ Ρ„Π°ΠΉΠ»Ρƒ
Eren Golge 6906adc39e speaker encoder implementation 2019-11-01 12:23:03 +01:00
.github Update ISSUE_TEMPLATE.md 2019-05-07 13:02:27 +02:00
.travis Fix tests 2019-08-29 12:18:33 +02:00
dataset_analysis Fix Pylint issues 2019-07-19 09:08:51 +02:00
datasets bug fix for load__meta_data 2019-09-30 18:04:15 +02:00
images add TTS MOS figure to readme 2019-05-01 00:56:58 +02:00
layers bug fix argparser 2019-10-31 15:13:39 +01:00
models bug fix for synthesis.py 2019-10-29 17:38:59 +01:00
notebooks update benchmark notebook 2019-09-24 16:58:52 +02:00
server remove files 2019-09-05 16:57:24 +02:00
speaker_encoder speaker encoder implementation 2019-11-01 12:23:03 +01:00
tests fix test 2019-10-30 17:36:13 +01:00
tts_namespace Fix installation by using an explicit symlink 2019-08-29 11:49:53 +02:00
utils call truncated inference 2019-10-29 17:41:07 +01:00
.cardboardlint.yml Add pylint and cardboardlinter config, enable Travis lint check on PRs 2019-07-19 09:03:03 +02:00
.compute compute and config update with new attention entropy loss 2019-10-15 15:05:42 +02:00
.dockerignore multispeaker 2019-06-26 12:59:14 +02:00
.gitignore improvements CheckSNR 2019-07-12 14:25:10 +02:00
.pylintrc Address additional lint problems 2019-07-19 11:35:06 +02:00
.travis.yml no caching for travis 2019-07-23 18:46:14 +02:00
CODE_OF_CONDUCT.md Add Mozilla Code of Conduct file 2019-03-29 23:47:52 -07:00
CONTRIBUTING.md Add pylint and cardboardlinter config, enable Travis lint check on PRs 2019-07-19 09:03:03 +02:00
Dockerfile multispeaker 2019-06-26 12:59:14 +02:00
LICENSE.txt Create LICENSE.txt 2018-02-13 22:37:59 +01:00
README.md readme and config.json update 2019-08-16 14:28:11 +02:00
__init__.py Fix installation by using an explicit symlink 2019-08-29 11:49:53 +02:00
best_model_config.json Merge branch 'master' of https://github.com/Mozilla/TTS 2018-05-25 05:14:04 -07:00
config.json continuining training from where it is left off 2019-10-30 15:48:38 +01:00
config_tacotron.json fixed config comment strings for attention parameters 2019-07-23 13:31:10 +02:00
config_tacotron2.json fixed config comment strings for attention parameters 2019-07-23 13:31:10 +02:00
config_tacotron_de.json fixed config comment strings for attention parameters 2019-07-23 13:31:10 +02:00
config_tacotron_gst.json Merge branch 'dev' of github.com:mozilla/TTS into stylemel_in_testing 2019-07-25 13:23:41 +02:00
de_sentences.txt config new parameter for text sentences 2019-05-28 14:40:38 +02:00
debug_config.json Fix Pylint issues 2019-07-19 09:08:51 +02:00
distribute.py bug fix argparser 2019-10-31 15:13:39 +01:00
requirements.txt multispeaker 2019-06-26 12:59:14 +02:00
setup.py setup.py update 2019-09-05 12:54:45 +02:00
synthesize.py formatting 2019-09-24 17:20:01 +02:00
test_cluster.py Fix Pylint issues 2019-07-19 09:08:51 +02:00
train.py bug fix argparser 2019-10-31 15:13:39 +01:00

README.md

This project is a part of Mozilla Common Voice. TTS aims a deep learning based Text2Speech engine, low in cost and high in quality. To begin with, you can hear a sample generated voice from here.

TTS includes two different model implementations which are based on Tacotron and Tacotron2. Tacotron is smaller, efficient and easier to train but Tacotron2 provides better results, especially when it is combined with a Neural vocoder. Therefore, choose depending on your project requirements.

If you are new, you can also find here a brief post about TTS architectures and their comparisons.

TTS Performance

Details...

Requirements and Installation

Highly recommended to use miniconda for easier installation.

  • python>=3.6
  • pytorch>=0.4.1
  • librosa
  • tensorboard
  • tensorboardX
  • matplotlib
  • unidecode

Install TTS using setup.py. It will install all of the requirements automatically and make TTS available to all the python environment as an ordinary python module.

python setup.py develop

Or you can use requirements.txt to install the requirements only.

pip install -r requirements.txt

Docker

A barebone Dockerfile exists at the root of the project, which should let you quickly setup the environment. By default, it will start the server and let you query it. Make sure to use nvidia-docker to use your GPUs. Make sure you follow the instructions in the server README before you build your image so that the server can find the model within the image.

docker build -t mozilla-tts .
nvidia-docker run -it --rm -p 5002:5002 mozilla-tts

Checkpoints and Audio Samples

Please visit our wiki.

Example Model Outputs

Below you see Tacotron model state after 16K iterations with batch-size 32 with LJSpeech dataset.

"Recent research at Harvard has shown meditating for as little as 8 weeks can actually increase the grey matter in the parts of the brain responsible for emotional regulation and learning."

Audio examples: https://soundcloud.com/user-565970875

example_model_output

Runtime

The most time-consuming part is the vocoder algorithm (Griffin-Lim) which runs on CPU. By setting its number of iterations lower, you might have faster execution with a small loss of quality. Some of the experimental values are below.

Sentence: "It took me quite a long time to develop a voice, and now that I have it I'm not going to be silent."

Audio length is approximately 6 secs.

Time (secs) System # GL iters Model
2.00 GTX1080Ti 30 Tacotron
3.01 GTX1080Ti 60 Tacotron
3.57 CPU 60 Tacotron
5.27 GTX1080Ti 60 Tacotron2
6.50 CPU 60 Tacotron2

Datasets and Data-Loading

TTS provides a generic dataloder easy to use for new datasets. You need to write an preprocessor function to integrade your own dataset.Check datasets/preprocess.py to see some examples. After the function, you need to set dataset field in config.json. Do not forget other data related fields too.

Some of the open-sourced datasets that we successfully applied TTS, are linked below.

Training and Fine-tuning LJ-Speech

Here you can find a CoLab notebook for a hands-on example, training LJSpeech. Or you can manually follow the guideline below.

To start with, split metadata.csv into train and validation subsets respectively metadata_train.csv and metadata_val.csv. Note that for text-to-speech, validation performance might be misleading since the loss value does not directly measure the voice quality to the human ear and it also does not measure the attention module performance. Therefore, running the model with new sentences and listenning the results is the best way to go.

shuf metadata.csv > metadata_shuf.csv
head -n 12000 metadata_shuf.csv > metadata_train.csv
tail -n 1100 metadata_shuf.csv > metadata_val.csv

To train a new model, you need to define your own config.json file (check the example) and call with the command below. You also set the model architecture in config.json.

train.py --config_path config.json

To fine-tune a model, use --restore_path.

train.py --config_path config.json --restore_path /path/to/your/model.pth.tar

For multi-GPU training use distribute.py. It enables process based multi-GPU training where each process uses a single GPU.

CUDA_VISIBLE_DEVICES="0,1,4" distribute.py --config_path config.json

Each run creates a new output folder and config.json is copied under this folder.

In case of any error or intercepted execution, if there is no checkpoint yet under the output folder, the whole folder is going to be removed.

You can also enjoy Tensorboard, if you point Tensorboard argument--logdir to the experiment folder.

Testing

Best way to test your network is to use Notebooks under notebooks folder.

Contribution guidelines

This repository is governed by Mozilla's code of conduct and etiquette guidelines. For more details, please read the Mozilla Community Participation Guidelines.

Please send your Pull Request to dev branch. Before making a Pull Request, check your changes for basic mistakes and style problems by using a linter. We have cardboardlinter setup in this repository, so for example, if you've made some changes and would like to run the linter on just the changed code, you can use the follow command:

pip install pylint cardboardlint
cardboardlinter --refspec master

Collaborative Experimentation Guide

If you like to use TTS to try a new idea and like to share your experiments with the community, we urge you to use the following guideline for a better collaboration. (If you have an idea for better collaboration, let us know)

  • Create a new branch.
  • Open an issue pointing your branch.
  • Explain your experiment.
  • Share your results as you proceed. (Tensorboard log files, audio results, visuals etc.)
  • Use LJSpeech dataset (for English) if you like to compare results with the released models. (It is the most open scalable dataset for quick experimentation)

Contact/Getting Help

  • Wiki

  • Discourse Forums - If your question is not addressed in the Wiki, the Discourse Forums is the next place to look. They contain conversations on General Topics, Using TTS, and TTS Development.

  • Issues - Finally, if all else fails, you can open an issue in our repo.

Major TODOs

  • Implement the model.
  • Generate human-like speech on LJSpeech dataset.
  • Generate human-like speech on a different dataset (Nancy) (TWEB).
  • Train TTS with r=1 successfully.
  • Enable process based distributed training. Similar to (https://github.com/fastai/imagenet-fast/).
  • Adapting Neural Vocoder. TTS works with (https://github.com/erogol/WaveRNN)
  • Multi-speaker embedding.
  • Model optimization (model export, prunning etc.)

References