首页
开源项目
搜索 TinyTools
CoquiTTS文本转语音生成库
41.6k
在线演示
Github仓库
Gitee仓库
 **🐸TTS 是一个用于高级文本转语音生成的库。** 🚀 预训练模型,支持超过 1100 种语言。 🛠️ 用于训练新模型和微调任何语言现有模型的工具。 📚 用于数据集分析和管理的实用程序。 ## 功能 - 用于 Text2Speech 任务的高性能深度学习模型。 - Text2Spec 模型(Tacotron、Tacotron2、Glow-TTS、SpeedySpeech)。 - 说话人编码器,可高效计算说话人嵌入。 - 声码器模型(MelGAN、Multiband-MelGAN、GAN-TTS、ParallelWaveGAN、WaveGrad、WaveRNN) - 快速高效的模型训练。 - 终端和 Tensorboard 上提供详细的训练日志。 - 支持多说话人 TTS。 - 高效、灵活、轻量级且功能齐全的“Trainer API”。 - 已发布且随时可用的模型。 - 在“dataset_analysis”下管理 Text2Speech 数据集的工具。 - 使用和测试模型的实用程序。 - 模块化(但不会过多)的代码库,可轻松实现新想法。 ## 💬 在哪里提问 请使用我们的专用渠道提问和讨论。公开分享的帮助更有价值,可以让更多人受益。 | 类型 | 平台 | | ------------------------------- | --------------------------- | | 🚨 **Bug 报告** | [GitHub 问题跟踪器] | | 🎁 **功能请求和想法** | [GitHub 问题跟踪器] | | 👩💻 **使用问题** | [GitHub 讨论区] | | 🗯 **常规讨论** | [GitHub 讨论区] 或 [Discord] | [GitHub 问题跟踪器]:https://github.com/coqui-ai/tts/issues [GitHub 讨论]:https://github.com/coqui-ai/TTS/discussions [Discord]:https://discord.gg/5eXr5seRrv [教程和示例]:https://github.com/coqui-ai/TTS/wiki/TTS-Notebooks-and-Tutorials ## 🔗 链接和资源 | 类型 | 链接 | | ------------------------------- | --------------------------- | | 💼 **文档** | [ReadTheDocs](https://tts.readthedocs.io/en/latest/) | 💾 **安装** | [TTS/README.md](https://github.com/coqui-ai/TTS/tree/dev#installation)| | 👩💻 **贡献** | [CONTRIBUTING.md](https://github.com/coqui-ai/TTS/blob/main/CONTRIBUTING.md)| | 📌 **路线图** | [主要开发计划](https://github.com/coqui-ai/TTS/issues/378) | 🚀 **已发布模型** | [TTS 发布](https://github.com/coqui-ai/TTS/releases) 和 [实验模型](https://github.com/coqui-ai/TTS/wiki/Experimental-Released-Models)| | 📰 **论文** | [TTS 论文](https://github.com/erogol/TTS-papers)| ## 🥇 TTS 性能  带下划线的“TTS*”和“Judy*”是**内部**🐸TTS 模型,尚未开源。它们是为了展示其潜力。以点为前缀的模型(.Jofish、.Abe 和 .Janice)是真人声音。 ## 模型实现 ### 声谱图模型 - Tacotron:[论文](https://arxiv.org/abs/1703.10135) - Tacotron2:[论文](https://arxiv.org/abs/1712.05884) - Glow-TTS:[论文](https://arxiv.org/abs/2005.11129) - Speedy-Speech:[论文](https://arxiv.org/abs/2008.03802) - Align-TTS:[论文](https://arxiv.org/abs/2003.01950) - FastPitch:[论文](https://arxiv.org/pdf/2006.06873.pdf) - FastSpeech: [论文](https://arxiv.org/abs/1905.09263) - FastSpeech2:[论文](https://arxiv.org/abs/2006.04558) - SC-GlowTTS:[论文](https://arxiv.org/abs/2104.05557) - Capacitron:[论文](https://arxiv.org/abs/1906.03402) - OverFlow:[论文](https://arxiv.org/abs/2211.06892) - Neural HMM TTS:[论文](https://arxiv.org/abs/2108.13320) - Delightful TTS:[论文](https://arxiv.org/abs/2110.12612) ### 端到端模型 - ⓍTTS: [blog](https://coqui.ai/blog/tts/open_xtts) - VITS: [paper](https://arxiv.org/pdf/2106.06103) - 🐸 YourTTS: [paper](https://arxiv.org/abs/2112.02418) - 🐢 Tortoise: [orig. repo](https://github.com/neonbjb/tortoise-tts) - 🐶 Bark: [orig. repo](https://github.com/suno-ai/bark) ### 注意力机制 - 引导注意力机制:[论文](https://arxiv.org/abs/1710.08969) - 前向后向解码:[论文](https://arxiv.org/abs/1907.09006) - Graves 注意力机制:[论文](https://arxiv.org/abs/1910.10288) - 双解码器一致性:[博客](https://erogol.com/solving-attention-problems-of-tts-models-with-double-decoder-consistency/) - 动态卷积注意力机制:[论文](https://arxiv.org/pdf/1910.10288.pdf) - 对齐网络:[论文](https://arxiv.org/abs/2108.10447) ### 说话人编码器 - GE2E: [论文](https://arxiv.org/abs/1710.10467) - Angular Loss:[论文](https://arxiv.org/pdf/2003.11982.pdf) ### 声码器 - MelGAN:[论文](https://arxiv.org/abs/1910.06711) - MultiBandMelGAN:[论文](https://arxiv.org/abs/2005.05106) - ParallelWaveGAN:[论文](https://arxiv.org/abs/1910.11480) - GAN-TTS 鉴别器:[论文](https://arxiv.org/abs/1909.11646) - WaveRNN:[来源](https://github.com/fatchord/WaveRNN/) - WaveGrad: [论文](https://arxiv.org/abs/2009.00713) - HiFiGAN:[论文](https://arxiv.org/abs/2010.05646) - UnivNet:[论文](https://arxiv.org/abs/2106.07889) ### 语音转换 - FreeVC:[论文](https://arxiv.org/abs/2210.15418) 您也可以帮助我们实现更多模型。 ## 安装 🐸TTS 在 Ubuntu 18.04 上测试通过,python 版本高于 3.9,低于 3.12。 如果您只对使用已发布的 🐸TTS 模型进行语音合成感兴趣,那么从 PyPI 安装是最简单的选择。 ```bash pip install TTS ``` 如果您计划编写代码或训练模型,请克隆 🐸TTS 并将其安装在本地。 ```bash git clone https://github.com/coqui-ai/TTS pip install -e .[all,dev,notebooks] # 选择相关的附加组件 ``` 如果您使用的是 Ubuntu (Debian) 系统,也可以运行以下命令进行安装。 ```bash $ make system-deps # 适用于 Ubuntu (Debian)。如果您使用的是其他操作系统,请告知我们。 $ make install ``` 如果您使用的是 Windows,👑@GuyPaddock 在此处 (https://stackoverflow.com/questions/66726331/how-can-i-run-mozilla-tts-coqui-tts-training-with-cuda-on-a-windows-system) 提供了安装说明。 ## Docker 镜像 您也可以使用 Docker 镜像尝试无需安装的 TTS。 只需运行以下命令,即可在不安装的情况下运行 TTS。 ```bash docker run --rm -it -p 5002:5002 --entrypoint /bin/bash ghcr.io/coqui-ai/tts-cpu python3 TTS/server/server.py --list_models # 获取可用模型列表 python3 TTS/server/server.py --model_name tts_models/en/vctk/vits # 启动服务器 ``` 然后您可以在[此处](http://[::1]:5002/) 使用 TTS 服务器。 更多关于 Docker 镜像的详细信息(例如 GPU 支持),请访问[此处](https://tts.readthedocs.io/en/latest/docker_images.html) ## 通过 🐸TTS 合成语音 ### 🐍 Python API #### 运行多说话人和多语言模型 ```python import torch from TTS.api import TTS # Get device device = "cuda" if torch.cuda.is_available() else "cpu" # List available 🐸TTS models print(TTS().list_models()) # Init TTS tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device) # Run TTS # ❗ Since this model is multi-lingual voice cloning model, we must set the target speaker_wav and language # Text to speech list of amplitude values as output wav = tts.tts(text="Hello world!", speaker_wav="my/cloning/audio.wav", language="en") # Text to speech to a file tts.tts_to_file(text="Hello world!", speaker_wav="my/cloning/audio.wav", language="en", file_path="output.wav") ``` #### 运行单个扬声器模型 ```python # Init TTS with the target model name tts = TTS(model_name="tts_models/de/thorsten/tacotron2-DDC", progress_bar=False).to(device) # Run TTS tts.tts_to_file(text="Ich bin eine Testnachricht.", file_path=OUTPUT_PATH) # Example voice cloning with YourTTS in English, French and Portuguese tts = TTS(model_name="tts_models/multilingual/multi-dataset/your_tts", progress_bar=False).to(device) tts.tts_to_file("This is voice cloning.", speaker_wav="my/cloning/audio.wav", language="en", file_path="output.wav") tts.tts_to_file("C'est le clonage de la voix.", speaker_wav="my/cloning/audio.wav", language="fr-fr", file_path="output.wav") tts.tts_to_file("Isso é clonagem de voz.", speaker_wav="my/cloning/audio.wav", language="pt-br", file_path="output.wav") ``` #### 语音转换示例 将 `source_wav` 中的语音转换为 `target_wav` 中的语音 ```python tts = TTS(model_name="voice_conversion_models/multilingual/vctk/freevc24", progress_bar=False).to("cuda") tts.voice_conversion_to_file(source_wav="my/source.wav", target_wav="my/target.wav", file_path="output.wav") ``` #### 示例语音克隆与语音转换模型。 这样,您可以使用🐸TTS 中的任何模型克隆语音。 ```python tts = TTS("tts_models/de/thorsten/tacotron2-DDC") tts.tts_with_vc_to_file( "Wie sage ich auf Italienisch, dass ich dich liebe?", speaker_wav="target/speaker.wav", file_path="output.wav" ) ``` #### 使用 **Fairseq 模型,支持约 1100 种语言** 的文本转语音示例 🤯。 对于 Fairseq 模型,请使用以下命名格式:`tts_models/
/fairseq/vits`。 您可以在 [此处](https://dl.fbaipublicfiles.com/mms/tts/all-tts-languages.html) 找到语言 ISO 代码,并在 [此处](https://github.com/facebookresearch/fairseq/tree/main/examples/mms) 了解 Fairseq 模型。 ```python # TTS with on the fly voice conversion api = TTS("tts_models/deu/fairseq/vits") api.tts_with_vc_to_file( "Wie sage ich auf Italienisch, dass ich dich liebe?", speaker_wav="target/speaker.wav", file_path="output.wav" ) ``` ### 命令行 `tts` 在命令行上合成语音。 您可以使用自己训练好的模型,也可以从提供的模型列表中选择一个。 如果您未指定任何模型,则使用基于 LJSpeech 的英语模型。 #### 单说话人模型 - 列出提供的模型: ``` $ tts --list_models ``` - 获取模型信息(tts_models 和 vocoder_models): - 按类型/名称查询: model_info_by_name 使用 --list_models 中的名称。 ``` $ tts --model_info_by_name "
/
/
/
" ``` For example: ``` $ tts --model_info_by_name tts_models/tr/common-voice/glow-tts $ tts --model_info_by_name vocoder_models/en/ljspeech/hifigan_v2 ``` - Query by type/idx: The model_query_idx uses the corresponding idx from --list_models. ``` $ tts --model_info_by_idx "
/
" ``` For example: ``` $ tts --model_info_by_idx tts_models/3 ``` - Query info for model info by full name: ``` $ tts --model_info_by_name "
/
/
/
" ``` - Run TTS with default models: ``` $ tts --text "Text for TTS" --out_path output/path/speech.wav ``` - Run TTS and pipe out the generated TTS wav file data: ``` $ tts --text "Text for TTS" --pipe_out --out_path output/path/speech.wav | aplay ``` - Run a TTS model with its default vocoder model: ``` $ tts --text "Text for TTS" --model_name "
/
/
/
" --out_path output/path/speech.wav ``` For example: ``` $ tts --text "Text for TTS" --model_name "tts_models/en/ljspeech/glow-tts" --out_path output/path/speech.wav ``` - Run with specific TTS and vocoder models from the list: ``` $ tts --text "Text for TTS" --model_name "
/
/
/
" --vocoder_name "
/
/
/
" --out_path output/path/speech.wav ``` For example: ``` $ tts --text "Text for TTS" --model_name "tts_models/en/ljspeech/glow-tts" --vocoder_name "vocoder_models/en/ljspeech/univnet" --out_path output/path/speech.wav ``` - Run your own TTS model (Using Griffin-Lim Vocoder): ``` $ tts --text "Text for TTS" --model_path path/to/model.pth --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/model.pth --config_path path/to/config.json --out_path output/path/speech.wav --vocoder_path path/to/vocoder.pth --vocoder_config_path path/to/vocoder_config.json ``` #### 多扬声器模型 - List the available speakers and choose a
among them: ``` $ tts --model_name "
/
/
" --list_speaker_idxs ``` - Run the multi-speaker TTS model with the target speaker ID: ``` $ tts --text "Text for TTS." --out_path output/path/speech.wav --model_name "
/
/
" --speaker_idx
``` - Run your own multi-speaker TTS model: ``` $ tts --text "Text for TTS" --out_path output/path/speech.wav --model_path path/to/model.pth --config_path path/to/config.json --speakers_file_path path/to/speaker.json --speaker_idx
``` ### 语音转换模型 ``` $ tts --out_path output/path/speech.wav --model_name "
/
/
" --source_wav
--target_wav
``` ## 目录结构 ``` |- 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.) |- ... |- tts/ (text to speech models) |- layers/ (model layer definitions) |- models/ (model definitions) |- utils/ (model specific utilities.) |- speaker_encoder/ (Speaker Encoder models.) |- (same) |- vocoder/ (Vocoder models.) |- (same) ```
tabler/tabler is licensed under the
MIT License
A short and simple permissive license with conditions only requiring preservation of copyright and license notices. Licensed works, modifications, and larger works may be distributed under different terms and without source code.
Permissions
Commercial use
Modification
Distribution
Private use
Limitations
Liability
Warranty
Conditions
License and copyright notice