TTS

2025-12-10 0 925

TTS: Text-to-Speech for all.

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.

? 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 Discourse Forum
? General Discussion Discourse Forum and Matrix Channel

? Links and Resources

Type Links
? Installation TTS/README.md
??‍? Tutorials and Examples TTS/Wiki
Released Models TTS/Wiki
Docker Image Repository by @synesthesiam
Demo Server TTS/server
? Running TTS on Terminal TTS/README.md
How to contribute TTS/README.md

? TTS Performance

\”Mozilla*\” and \”Judy*\” are our models.
Details…

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

  • Tacotron: paper
  • Tacotron2: paper
  • Glow-TTS: paper
  • Speedy-Speech: paper

Attention Methods

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

Speaker Encoder

  • GE2E: paper
  • Angular Loss: paper

Vocoders

  • 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.

Install TTS

TTS supports 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.c**om/mozilla/TTS
pip install -e .

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

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:

  • LJ Speech
  • Nancy
  • TWEB
  • M-AI-Labs
  • LibriTTS
  • Spanish – thx! @carlfm01

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 the TTS project.

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/

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 output/path/speech.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 output/path/speech.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

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

  1. Create a new branch.
  2. Implement your changes.
  3. (if applicable) Add Google Style docstrings.
  4. (if applicable) Implement a test case under tests folder.
  5. (Optional but Prefered) Run tests.
./run_tests.sh
  1. Run the linter.
pip install pylint cardboardlint
cardboardlinter --refspec master
  1. Send a PR to dev branch, explain what the change is about.
  2. Let us discuss until we make it perfect :).
  3. We merge it to the dev branch once things look good.

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

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 idea and experiment.
  • Share your results regularly. (Tensorboard log files, audio results, visuals etc.)

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://g*ithub*.co*m/fastai/imagenet-fast/).
  • Adapting Neural Vocoder. TTS works with WaveRNN and ParallelWaveGAN (https://*githu*b*.com/erogol/WaveRNN and https://*g*ithub.*com/erogol/ParallelWaveGAN)
  • Multi-speaker embedding.
  • Model optimization (model export, model pruning etc.)

Acknowledgement

  • https://gi*thub.c*o*m/keithito/tacotron (Dataset pre-processing)
  • https://*gi*thub.c*om/r9y9/tacotron_pytorch (Initial Tacotron architecture)
  • https://**github.c*om/kan-bayashi/ParallelWaveGAN (vocoder library)
  • https://githu*b.c*om*/jaywalnut310/glow-tts (Original Glow-TTS implementation)
  • https://git*hu*b*.com/fatchord/WaveRNN/ (Original WaveRNN implementation)

下载源码

通过命令行克隆项目:

git clone https://github.com/mozilla/TTS.git

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

申明:本文由第三方发布,内容仅代表作者观点,与本网站无关。对本文以及其中全部或者部分内容的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。本网发布或转载文章出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,也不代表本网对其真实性负责。

左子网 编程相关 TTS https://www.zuozi.net/33186.html

常见问题
  • 1、自动:拍下后,点击(下载)链接即可下载;2、手动:拍下后,联系卖家发放即可或者联系官方找开发者发货。
查看详情
  • 1、源码默认交易周期:手动发货商品为1-3天,并且用户付款金额将会进入平台担保直到交易完成或者3-7天即可发放,如遇纠纷无限期延长收款金额直至纠纷解决或者退款!;
查看详情
  • 1、描述:源码描述(含标题)与实际源码不一致的(例:货不对板); 2、演示:有演示站时,与实际源码小于95%一致的(但描述中有”不保证完全一样、有变化的可能性”类似显著声明的除外); 3、发货:不发货可无理由退款; 4、安装:免费提供安装服务的源码但卖家不履行的; 5、收费:价格虚标,额外收取其他费用的(但描述中有显著声明或双方交易前有商定的除外); 6、其他:如质量方面的硬性常规问题BUG等。 注:经核实符合上述任一,均支持退款,但卖家予以积极解决问题则除外。
查看详情
  • 1、左子会对双方交易的过程及交易商品的快照进行永久存档,以确保交易的真实、有效、安全! 2、左子无法对如“永久包更新”、“永久技术支持”等类似交易之后的商家承诺做担保,请买家自行鉴别; 3、在源码同时有网站演示与图片演示,且站演与图演不一致时,默认按图演作为纠纷评判依据(特别声明或有商定除外); 4、在没有”无任何正当退款依据”的前提下,商品写有”一旦售出,概不支持退款”等类似的声明,视为无效声明; 5、在未拍下前,双方在QQ上所商定的交易内容,亦可成为纠纷评判依据(商定与描述冲突时,商定为准); 6、因聊天记录可作为纠纷评判依据,故双方联系时,只与对方在左子上所留的QQ、手机号沟通,以防对方不承认自我承诺。 7、虽然交易产生纠纷的几率很小,但一定要保留如聊天记录、手机短信等这样的重要信息,以防产生纠纷时便于左子介入快速处理。
查看详情

相关文章

猜你喜欢
发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务