-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathexample-tts.py
More file actions
25 lines (19 loc) · 895 Bytes
/
Copy pathexample-tts.py
File metadata and controls
25 lines (19 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env python3
from typing import List
import torchaudio as ta
from chatterbox_vllm.tts import ChatterboxTTS
if __name__ == "__main__":
model = ChatterboxTTS.from_pretrained(
max_batch_size = 3,
max_model_len = 1000,
)
for i, audio_prompt_path in enumerate([None, "docs/audio-sample-01.mp3", "docs/audio-sample-03.mp3"]):
prompts = [
"You are listening to a demo of the Chatterbox TTS model running on VLLM.",
"This is a separate prompt to test the batching implementation.",
"And here is a third prompt. It's a bit longer than the first one, but not by much.",
]
audios = model.generate(prompts, audio_prompt_path=audio_prompt_path, exaggeration=0.5)
for audio_idx, audio in enumerate(audios):
ta.save(f"test-{i}-{audio_idx}.mp3", audio, model.sr)
model.shutdown()