Parler-TTS est un modèle de synthèse vocale (TTS) léger, capable de générer une voix de haute qualité et naturelle, tout en permettant de contrôler le style de l'orateur (genre, ton, débit, etc.). Ce projet est une implémentation open source de l'article de recherche de Stability AI et de l'Université d'Édimbourg intitulé "Natural language guidance of high-fidelity text-to-speech with synthetic annotations".
pip install git+https://github.com/huggingface/parler-tts.git
pip3 install --pre torch torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu
import torch
from parler_tts import ParlerTTSForConditionalGeneration
from transformers import AutoTokenizer
import soundfile as sf
device = "cuda:0" if torch.cuda.is_available() else "cpu"
model = ParlerTTSForConditionalGeneration.from_pretrained("parler-tts/parler-tts-mini-v1").to(device)
tokenizer = AutoTokenizer.from_pretrained("parler-tts/parler-tts-mini-v1")
prompt = "Hey, how are you doing today?"
description = "A female speaker delivers a slightly expressive and animated speech with a moderate speed and pitch. The recording is of very high quality, with the speaker's voice sounding clear and very close up."
input_ids = tokenizer(description, return_tensors="pt").input_ids.to(device)
prompt_input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(device)
generation = model.generate(input_ids=input_ids, prompt_input_ids=prompt_input_ids)
audio_arr = generation.cpu().numpy().squeeze()
sf.write("parler_tts_out.wav", audio_arr, model.config.sampling_rate)
Le modèle prend en charge 34 orateurs prédéfinis, notamment : Laura, Gary, Jon, Lea, Karen, Rick, Brenda, David, Eileen, Jordan, Mike, Yann, Joy, James, Eric, Lauren, Rose, Will, Jason, Aaron, Naomie, Alisa, Patrick, Jerry, Tina, Jenna, Bill, Tom, Carol, Barbara, Rebecca, Anna, Bruce, Emily.
prompt = "Hey, how are you doing today?"
description = "Jon's voice is monotone yet slightly fast in delivery, with a very close recording that almost has no background noise."
input_ids = tokenizer(description, return_tensors="pt").input_ids.to(device)
prompt_input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(device)
generation = model.generate(input_ids=input_ids, prompt_input_ids=prompt_input_ids)
audio_arr = generation.cpu().numpy().squeeze()
sf.write("parler_tts_out.wav", audio_arr, model.config.sampling_rate)
accelerate launch ./training/run_parler_tts_training.py ./helpers/training_configs/starting_point_v1.json
Le projet fournit un guide complet d'entraînement et d'affinage, comprenant :
Le projet comprend plusieurs optimisations de performance :
Le projet est sous une licence open source permissive, encourageant la contribution de la communauté et l'utilisation commerciale. Si vous utilisez ce projet, veuillez citer :
@misc{lacombe-etal-2024-parler-tts,
author = {Yoach Lacombe and Vaibhav Srivastav and Sanchit Gandhi},
title = {Parler-TTS},
year = {2024},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/huggingface/parler-tts}}
}
Le projet accueille les contributions de la communauté, en particulier dans les domaines suivants :
Parler TTS représente une avancée significative dans la technologie TTS open source, offrant aux chercheurs et aux développeurs une solution de synthèse vocale puissante et flexible.