TTS is a library for advanced Text-to-Speech generation. It's built on the latest research, was designed to be 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.
π’ English Voice Samples and SoundCloud playlist
π¨βπ³ TTS training recipes
π Text-to-Speech paper collection
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 | Discourse Forum |
π― General Discussion | Discourse Forum and Matrix Channel |
Type | Links |
---|---|
π©πΎβπ« Tutorials and Examples | TTS/Wiki |
π€ Released Models | TTS/Wiki |
π» Docker Image | Repository by @synesthesiam |
"Mozilla*" and "Judy*" are our models. Details...
- 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 under
dataset_analysis
. - Demo server for model testing.
- Notebooks for extensive model benchmarking.
- Modular (but not too much) code base enabling easy testing for new ideas.
- Guided Attention: paper
- Forward Backward Decoding: paper
- Graves Attention: paper
- Double Decoder Consistency: blog
- MelGAN: paper
- MultiBandMelGAN: paper
- ParallelWaveGAN: paper
- GAN-TTS discriminators: paper
- WaveRNN: origin
- WaveGrad: paper
You can also help us implement more models. Some TTS related work can be found here.
TTS supports python >= 3.6.
python setup.py install
or python setup.py develop
to keep your installation in your working directory.
|- 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)
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
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:
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.
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
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 idea and experiment.
- Share your results regularly. (Tensorboard log files, audio results, visuals etc.)
- 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 WaveRNN and ParallelWaveGAN (https://github.com/erogol/WaveRNN and https://github.com/erogol/ParallelWaveGAN)
- Multi-speaker embedding.
- Model optimization (model export, model pruning etc.)
- https://github.com/keithito/tacotron (Dataset pre-processing)
- https://github.com/r9y9/tacotron_pytorch (Initial Tacotron architecture)
- https://github.com/kan-bayashi/ParallelWaveGAN (vocoder library)
- https://github.com/jaywalnut310/glow-tts (Original Glow-TTS implementation)
- https://github.com/fatchord/WaveRNN/ (Original WaveRNN implementation)