🐸💬 - a deep learning toolkit for Text-to-Speech, battle-tested in research and production
 
 
 
 
Go to file
Eren Gölge 1cdf8498d7 new CONTRIBUTING.md 2021-04-09 13:51:04 +02:00
.circleci do not test server and modelManager until fixing #657 2021-03-08 02:54:47 +01:00
.github [ci skip]restructure templates 2021-04-06 14:01:17 +02:00
TTS style update #3 2021-04-09 01:17:15 +02:00
images new performance graph 2021-03-05 03:01:49 +01:00
notebooks style update #3 2021-04-09 01:17:15 +02:00
tests move bash based tests to a separate folder and rename the calling script file. Fix align_tts training test. 2021-04-09 03:07:58 +02:00
.cardboardlint.yml cardboard config update 2020-06-15 19:04:05 +02:00
.compute check against NaN loss in tacotron_loss 2020-11-02 12:44:41 +01:00
.dockerignore multispeaker 2019-06-26 12:59:14 +02:00
.gitignore gitignore update 2021-03-30 14:39:16 +02:00
.pre-commit-config.yaml new CONTRIBUTING.md 2021-04-09 13:51:04 +02:00
.pylintrc cardboard config update 2020-06-15 19:04:05 +02:00
CODE_OF_CONDUCT.md Update CODE_OF_CONDUCT.md 2021-03-07 11:22:34 +01:00
CODE_OWNERS.rst add CODE_OWNERS.rst 2020-12-17 16:44:50 +01:00
CONTRIBUTING.md new CONTRIBUTING.md 2021-04-09 13:51:04 +02:00
LICENSE.txt Create LICENSE.txt 2018-02-13 22:37:59 +01:00
MANIFEST.in manifest.in update 2021-01-26 02:56:55 +01:00
Makefile add bash tests and linux system requirements to Makefile 2021-04-09 03:09:24 +02:00
README.md readme update 2021-04-09 12:06:38 +02:00
hubconf.py isort all imports 2021-04-09 00:45:20 +02:00
pyproject.toml style update #3 2021-04-09 01:17:15 +02:00
requirements.txt initial Makefile, requirements update and use nosetests 2021-04-09 01:40:02 +02:00
requirements_tests.txt Bump tensorflow from 2.3.0 to 2.3.1 2020-10-27 12:17:38 +01:00
run_bash_tests.sh small fix 2021-04-09 11:29:55 +02:00
setup.cfg Make running the server easier 2019-11-27 16:44:33 +01:00
setup.py isort all imports 2021-04-09 00:45:20 +02:00

README.md

🐸TTS is a library for advanced Text-to-Speech generation. It's built on the latest research, was designed to achieve the best trade-off among ease-of-training, speed and quality. 🐸TTS comes with pretrained models, tools for measuring dataset quality and already used in 20+ languages for products and research projects.

CircleCI License PyPI version Covenant Downloads Gitter

📰 Subscribe to 🐸Coqui.ai Newsletter

📢 English Voice Samples and SoundCloud playlist

👩🏽‍🍳 TTS training recipes

📄 Text-to-Speech paper collection

💬 Where to ask questions

Please use our dedicated channels for questions and discussion. Help is much more valuable if it's shared publicly, so that more people can benefit from it.

Type Platforms
🚨 Bug Reports GitHub Issue Tracker
FAQ TTS/Wiki
🎁 Feature Requests & Ideas GitHub Issue Tracker
👩‍💻 Usage Questions Github Discussions
🗯 General Discussion Github Discussions or Gitter Room or Matrix Room
Type Links
💾 Installation TTS/README.md
👩🏾‍🏫 Tutorials and Examples TTS/Wiki
🚀 Released Models TTS Releases and Experimental Models
💻 Docker Image Repository by @synesthesiam
🖥️ Demo Server TTS/server
🤖 Synthesize speech TTS/README.md

🥇 TTS Performance

Underlined "TTS*" and "Judy*" are 🐸TTS models

Features

  • High performance Deep Learning models for Text2Speech tasks.
    • Text2Spec models (Tacotron, Tacotron2, Glow-TTS, SpeedySpeech).
    • Speaker Encoder to compute speaker embeddings efficiently.
    • Vocoder models (MelGAN, Multiband-MelGAN, GAN-TTS, ParallelWaveGAN, WaveGrad, WaveRNN)
  • Fast and efficient model training.
  • Detailed training logs on console and Tensorboard.
  • Support for multi-speaker TTS.
  • Efficient Multi-GPUs training.
  • Ability to convert PyTorch models to Tensorflow 2.0 and TFLite for inference.
  • Released models in PyTorch, Tensorflow and TFLite.
  • Tools to curate Text2Speech datasets underdataset_analysis.
  • Demo server for model testing.
  • Notebooks for extensive model benchmarking.
  • Modular (but not too much) code base enabling easy testing for new ideas.

Implemented Models

Text-to-Spectrogram

Attention Methods

  • Guided Attention: paper
  • Forward Backward Decoding: paper
  • Graves Attention: paper
  • Double Decoder Consistency: blog
  • Dynamic Convolutional Attention: paper

Speaker Encoder

Vocoders

You can also help us implement more models. Some 🐸TTS related work can be found here.

Install TTS

🐸TTS is tested on Ubuntu 18.04 with python >= 3.6, < 3.9.

If you are only interested in synthesizing speech with the released 🐸TTS models, installing from PyPI is the easiest option.

pip install TTS

If you plan to code or train models, clone 🐸TTS and install it locally.

git clone https://github.com/coqui-ai/TTS
pip install -e .

We use espeak-ng to convert graphemes to phonemes. You might need to install separately.

sudo apt-get install espeak-ng

If you are on Ubuntu (Debian), you can also run following commands for installation.

$ make system-deps  # intended to be used on Ubuntu (Debian). Let us know if you have a diffent OS.
$ make install

If you are on Windows 👑@GuyPaddock wrote instructions here.

Directory Structure

|- notebooks/       (Jupyter Notebooks for model evaluation, parameter selection and data analysis.)
|- utils/           (common utilities.)
|- TTS
    |- bin/             (folder for all the executables.)
      |- train*.py                  (train your target model.)
      |- distribute.py              (train your TTS model using Multiple GPUs.)
      |- compute_statistics.py      (compute dataset statistics for normalization.)
      |- convert*.py                (convert target torch model to TF.)
    |- tts/             (text to speech models)
        |- layers/          (model layer definitions)
        |- models/          (model definitions)
        |- tf/              (Tensorflow 2 utilities and model implementations)
        |- utils/           (model specific utilities.)
    |- speaker_encoder/ (Speaker Encoder models.)
        |- (same)
    |- vocoder/         (Vocoder models.)
        |- (same)

Sample Model Output

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: soundcloud

example_output

Datasets and Data-Loading

🐸TTS provides a generic dataloader easy to use for your custom dataset. You just need to write a simple function to format the dataset. Check datasets/preprocess.py to see some examples. After that, you need to set dataset fields in config.json.

Some of the public datasets that we successfully applied 🐸TTS:

Example: Synthesizing Speech on Terminal Using the Released Models.

After the installation, 🐸TTS provides a CLI interface for synthesizing speech using pre-trained models. You can either use your own model or the release models under 🐸TTS.

Listing released 🐸TTS models.

tts --list_models

Run a tts and a vocoder model from the released model list. (Simply copy and paste the full model names from the list as arguments for the command below.)

tts --text "Text for TTS" \
    --model_name "<type>/<language>/<dataset>/<model_name>" \
    --vocoder_name "<type>/<language>/<dataset>/<model_name>" \
    --out_path folder/to/save/output.wav

Run your own TTS model (Using Griffin-Lim Vocoder)

tts --text "Text for TTS" \
    --model_path path/to/model.pth.tar \
    --config_path path/to/config.json \
    --out_path folder/to/save/output.wav

Run your own TTS and Vocoder models

tts --text "Text for TTS" \
    --model_path path/to/config.json \
    --config_path path/to/model.pth.tar \
    --out_path folder/to/save/output.wav \
    --vocoder_path path/to/vocoder.pth.tar \
    --vocoder_config_path path/to/vocoder_config.json

Note: You can use ./TTS/bin/synthesize.py if you prefer running tts from the TTS project folder.

Example: Training and Fine-tuning LJ-Speech Dataset

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 listening to 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 to define model details, trainin configuration and more (check the examples). Then call the corressponding train script.

For instance, in order to train a tacotron or tacotron2 model on LJSpeech dataset, follow these steps.

python TTS/bin/train_tacotron.py --config_path TTS/tts/configs/config.json

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

python TTS/bin/train_tacotron.py --config_path TTS/tts/configs/config.json --restore_path /path/to/your/model.pth.tar

To continue an old training run, use --continue_path.

python TTS/bin/train_tacotron.py --continue_path /path/to/your/run_folder/

For multi-GPU training, call distribute.py. It runs any provided train script in multi-GPU setting.

CUDA_VISIBLE_DEVICES="0,1,4" python TTS/bin/distribute.py --script train_tacotron.py --config_path TTS/tts/configs/config.json

Each run creates a new output folder accomodating used config.json, model checkpoints and tensorboard logs.

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.

Contribution guidelines

Please follow the steps below as you send a PR to 🐸. It helps us to keep things organized.

Following steps are tested on an Ubuntu system.

  • Clone 🐸TTS.
$ git clone https://github.com/coqui-ai/TTS
  • Install 🐸TTS for development.
$ make system-deps  # intended to be used on Ubuntu (Debian). Let us know if you have a diffent OS.
$ make install
  • Create a new branch
$ git checkout -b my_branch
  • Implement your changes.
  • Use Google Style docstrings.
  • Implement a test case under tests folder.
  • (Optional but Prefered) Run tests.
$ make tests
  • Correct the style of your code.
$ make style
  • Run the linter.
$ make lint
  • Send a PR to dev branch, explain what the change is about.
  • Let's discuss until it is perfect. 💪
  • Once things look perfect, We merge it to the dev branch for the next version.

Feel free to ping us at any step you need help using our communication channels.

If you are new on Github or open-source contribution, here are good resources.

Acknowledgement