Update README.md
Browse files
README.md
CHANGED
@@ -9,46 +9,50 @@ language:
|
|
9 |
pipeline_tag: text-to-speech
|
10 |
---
|
11 |
|
|
|
|
|
12 |
<a target="_blank" href="https://huggingface.co/spaces/parler-tts/parler_tts_mini">
|
13 |
<img src="https://huggingface.co/datasets/huggingface/badges/raw/main/open-in-hf-spaces-sm.svg" alt="Open in HuggingFace"/>
|
14 |
</a>
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
**Parler-TTS v0.1** is a lightweight text-to-speech (TTS) model, trained on 10.5K hours of audio data, that can generate high-quality, natural sounding speech with features that can be controlled using a simple text prompt (e.g. gender, background noise, speaking rate, pitch and reverberation)
|
19 |
|
20 |
## Usage
|
21 |
|
22 |
Using Parler-TTS is as simple as "bonjour". Simply install the library once:
|
|
|
23 |
```sh
|
24 |
pip install git+https://github.com/huggingface/parler-tts.git
|
25 |
```
|
26 |
|
27 |
-
|
28 |
|
29 |
```py
|
|
|
30 |
from parler_tts import ParlerTTSForConditionalGeneration
|
31 |
-
from transformers import AutoTokenizer
|
32 |
import soundfile as sf
|
33 |
|
34 |
-
|
|
|
|
|
35 |
tokenizer = AutoTokenizer.from_pretrained("parler-tts/parler_tts_300M_v0.1")
|
36 |
|
37 |
prompt = "Hey, how are you doing today?"
|
38 |
description = "A female speaker with a slightly low-pitched voice delivers her words quite expressively, in a very confined sounding environment with clear audio quality. She speaks very fast."
|
39 |
|
40 |
-
input_ids = tokenizer(description, return_tensors="pt").input_ids
|
41 |
-
prompt_input_ids = tokenizer(prompt, return_tensors="pt").input_ids
|
42 |
|
43 |
generation = model.generate(input_ids=input_ids, prompt_input_ids=prompt_input_ids)
|
44 |
audio_arr = generation.cpu().numpy().squeeze()
|
45 |
sf.write("parler_tts_out.wav", audio_arr, model.config.sampling_rate)
|
46 |
```
|
47 |
|
48 |
-
|
49 |
**Tips**:
|
50 |
* Include the term "very clear audio" to generate the highest quality audio, and "very noisy audio" for high levels of background noise
|
51 |
-
*
|
52 |
* The remaining speech features (gender, speaking rate, pitch and reverberation) can be controlled directly through the prompt
|
53 |
|
54 |
## Motivation
|
@@ -90,4 +94,3 @@ If you found this repository useful, please consider citing this work and also t
|
|
90 |
## License
|
91 |
|
92 |
This model is permissively licensed under the Apache 2.0 license.
|
93 |
-
|
|
|
9 |
pipeline_tag: text-to-speech
|
10 |
---
|
11 |
|
12 |
+
# Parler-TTS v0.1
|
13 |
+
|
14 |
<a target="_blank" href="https://huggingface.co/spaces/parler-tts/parler_tts_mini">
|
15 |
<img src="https://huggingface.co/datasets/huggingface/badges/raw/main/open-in-hf-spaces-sm.svg" alt="Open in HuggingFace"/>
|
16 |
</a>
|
17 |
|
18 |
+
**Parler-TTS v0.1** is a lightweight text-to-speech (TTS) model, trained on 10.5K hours of audio data, that can generate high-quality, natural sounding speech with features that can be controlled using a simple text prompt (e.g. gender, background noise, speaking rate, pitch and reverberation).
|
19 |
+
It is the first release model from the [Parler-TTS](https://github.com/huggingface/parler-tts) project, which aims to provide the community with TTS training resources and dataset pre-processing code.
|
|
|
20 |
|
21 |
## Usage
|
22 |
|
23 |
Using Parler-TTS is as simple as "bonjour". Simply install the library once:
|
24 |
+
|
25 |
```sh
|
26 |
pip install git+https://github.com/huggingface/parler-tts.git
|
27 |
```
|
28 |
|
29 |
+
You can then use the model with the following inference snippet:
|
30 |
|
31 |
```py
|
32 |
+
import torch
|
33 |
from parler_tts import ParlerTTSForConditionalGeneration
|
34 |
+
from transformers import AutoTokenizer
|
35 |
import soundfile as sf
|
36 |
|
37 |
+
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
38 |
+
|
39 |
+
model = ParlerTTSForConditionalGeneration.from_pretrained("parler-tts/parler_tts_300M_v0.1").to(device)
|
40 |
tokenizer = AutoTokenizer.from_pretrained("parler-tts/parler_tts_300M_v0.1")
|
41 |
|
42 |
prompt = "Hey, how are you doing today?"
|
43 |
description = "A female speaker with a slightly low-pitched voice delivers her words quite expressively, in a very confined sounding environment with clear audio quality. She speaks very fast."
|
44 |
|
45 |
+
input_ids = tokenizer(description, return_tensors="pt").input_ids.to(device)
|
46 |
+
prompt_input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(device)
|
47 |
|
48 |
generation = model.generate(input_ids=input_ids, prompt_input_ids=prompt_input_ids)
|
49 |
audio_arr = generation.cpu().numpy().squeeze()
|
50 |
sf.write("parler_tts_out.wav", audio_arr, model.config.sampling_rate)
|
51 |
```
|
52 |
|
|
|
53 |
**Tips**:
|
54 |
* Include the term "very clear audio" to generate the highest quality audio, and "very noisy audio" for high levels of background noise
|
55 |
+
* Punctuation can be used to control the prosody of the generations, e.g. use commas to add small breaks in speech
|
56 |
* The remaining speech features (gender, speaking rate, pitch and reverberation) can be controlled directly through the prompt
|
57 |
|
58 |
## Motivation
|
|
|
94 |
## License
|
95 |
|
96 |
This model is permissively licensed under the Apache 2.0 license.
|
|