Change voices available without voice cloning (#12)

This commit is contained in:
Gabriel de Marmiesse
2026-01-13 11:06:23 +01:00
committed by GitHub
parent f5b66f6e3e
commit 366aa68c23
5 changed files with 28 additions and 14 deletions
+16 -5
View File
@@ -1,6 +1,6 @@
# Pocket TTS
![logo](./docs/logo.png)
![logo](https://raw.githubusercontent.com/kyutai-labs/pocket-tts/refs/heads/main/docs/logo.png)
A lightweight text-to-speech (TTS) application designed to run efficiently on CPUs.
Forget about the hassle of using GPUs and web APIs serving TTS models. With Kyutai's Pocket TTS, generating audio is just a pip install and a function call away.
@@ -43,12 +43,23 @@ uvx pocket-tts generate
# or if you installed it manually with pip:
pocket-tts generate
```
Modify the voice with `--voice` and the text with `--text`. We provide a small catalog of voices:
```
"marius", "javert", "jean", "fantine", "cosette", "eponine", "azelma"
```
Modify the voice with `--voice` and the text with `--text`. We provide a small catalog of voices.
You can take a look at [this page](https://huggingface.co/kyutai/tts-voices) which details the licenses
for each voice.
* [alba](https://huggingface.co/kyutai/tts-voices/blob/main/alba-mackenna/casual.wav)
* [marius](https://huggingface.co/kyutai/tts-voices/blob/main/voice-donations/Selfie.wav)
* [javert](https://huggingface.co/kyutai/tts-voices/blob/main/voice-donations/Butter.wav)
* [jean](https://huggingface.co/kyutai/tts-voices/blob/main/ears/p010/freeform_speech_01.wav)
* [fantine](https://huggingface.co/kyutai/tts-voices/blob/main/vctk/p244_023.wav)
* [cosette](https://huggingface.co/kyutai/tts-voices/blob/main/expresso/ex04-ex02_confused_001_channel1_499s.wav)
* [eponine](https://huggingface.co/kyutai/tts-voices/blob/main/vctk/p262_023.wav)
* [azelma](https://huggingface.co/kyutai/tts-voices/blob/main/vctk/p303_023.wav)
The `--voice` argument can also take a plain wav file as input for voice cloning.
Feel free to check out the [generate documentation](https://github.com/kyutai-labs/pocket-tts/tree/main/docs/generate.md) for more details and examples.
For trying multiple voices and prompts quickly, prefer using the `serve` command.
### The `serve` command
+1 -1
View File
@@ -1,4 +1,4 @@
DEFAULT_AUDIO_PROMPT = "marius"
DEFAULT_AUDIO_PROMPT = "alba"
DEFAULT_VARIANT = "b6369a24"
DEFAULT_TEMPERATURE = 0.7
DEFAULT_LSD_DECODE_STEPS = 1
+3
View File
@@ -248,6 +248,9 @@ def generate(
# Only print the result message if not writing to stdout
if output_path != "-":
logger.info("Results written in %s", output_path)
logger.info(
"If you want to try multiple voices and prompts quickly, try the `serve` command."
)
if __name__ == "__main__":
+4 -1
View File
@@ -620,7 +620,10 @@ class TTSModel(nn.Module):
with display_execution_time("Encoding audio prompt"):
prompt = self._encode_audio(audio_conditioning.unsqueeze(0).to(self.device))
# import safetensors.torch
# safetensors.torch.save_file({"audio_prompt": prompt}, "embeddings/eponine.safetensors")
# safetensors.torch.save_file(
# {"audio_prompt": prompt},
# "/projects/huggingface/pocket-tts/embeddings/cosette.safetensors"
# )
model_state = init_states(self.flow_lm, batch_size=1, sequence_length=1000)
+4 -7
View File
@@ -11,14 +11,11 @@ from torch import nn
PROJECT_ROOT = Path(__file__).parent.parent.parent
_voices_names = ["alba", "marius", "javert", "jean", "fantine", "cosette", "eponine", "azelma"]
PREDEFINED_VOICES = {
"marius": "hf://kyutai/pocket-tts-without-voice-cloning/embeddings/marius.safetensors",
"javert": "hf://kyutai/pocket-tts-without-voice-cloning/embeddings/javert.safetensors",
"jean": "hf://kyutai/pocket-tts-without-voice-cloning/embeddings/jean.safetensors",
"fantine": "hf://kyutai/pocket-tts-without-voice-cloning/embeddings/fantine.safetensors",
"cosette": "hf://kyutai/pocket-tts-without-voice-cloning/embeddings/cosette.safetensors",
"eponine": "hf://kyutai/pocket-tts-without-voice-cloning/embeddings/eponine.safetensors",
"azelma": "hf://kyutai/pocket-tts-without-voice-cloning/embeddings/azelma.safetensors",
# don't forget to change this
x: f"hf://kyutai/pocket-tts-without-voice-cloning/embeddings/{x}.safetensors"
for x in _voices_names
}