Coder Social home page Coder Social logo

alexanderxuan / tts Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mozilla/tts

0.0 1.0 0.0 119.92 MB

:robot: :speech_balloon: Deep learning for Text to Speech (Discussion forum: https://discourse.mozilla.org/c/tts)

License: Mozilla Public License 2.0

Python 10.27% Jupyter Notebook 89.60% HTML 0.06% Shell 0.06% Dockerfile 0.01%

tts's Introduction



Mozilla TTS is a deep learning based Text2Speech project, low in cost and high in quality.

This project is a part of Mozilla Common Voice.

English Voice Samples: https://erogol.github.io/ddc-samples/

TTS training recipes: https://github.com/erogol/TTS_recipes

TTS paper collection: https://github.com/erogol/TTS-papers

TTS Performance

"Mozilla*" and "Judy*" are our models. Details...

Provided Models and Methods

Text-to-Spectrogram:

Attention Methods:

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

Speaker Encoder:

Vocoders:

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

Features

  • High performance Deep Learning models for Text2Speech tasks.
    • Text2Spec models (Tacotron, Tacotron2).
    • Speaker Encoder to compute speaker embeddings efficiently.
    • Vocoder models (MelGAN, Multiband-MelGAN, GAN-TTS, ParallelWaveGAN)
  • 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.

Main Requirements and Installation

Highly recommended to use miniconda for easier installation.

  • python>=3.6
  • pytorch>=1.4.1
  • tensorflow>=2.2
  • 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

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)

Docker

A docker image is created by @synesthesiam and shared in a separate repository with the latest LJSpeech models.

Release Models

Please visit our wiki.

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:

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 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 file (check the example) and call with the command below. You also set the model architecture in config.json.

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

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

python TTS/bin/train_tts.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_tts.py --continue_path /path/to/your/run_folder/

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" TTS/bin/distribute.py --config_path TTS/tts/configs/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.

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)

Major TODOs

Acknowledgement

tts's People

Contributors

erogol avatar edresson avatar twerkmeister avatar reuben avatar lexkoro avatar thllwg avatar thorstenmueller avatar nmstoker avatar weberjulian avatar mittimithai avatar m-toman avatar geneing avatar sanjaesc avatar jyegerlehner avatar luhavis avatar fatihkiralioglu avatar yweweler avatar tomzx avatar mic92 avatar forcecore avatar bajibabu avatar anand-371 avatar lstolcman avatar tset-tset-tset avatar richardburleigh avatar repodiac avatar maxbachmann avatar lokkelvin2 avatar gnosly avatar ayush-1506 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.