Automated Docs Site (#101)

This commit is contained in:
Sachin Sankar
2026-02-12 14:01:42 +01:00
committed by GitHub
parent ef56ab4972
commit 4ae9fb2590
12 changed files with 704 additions and 42 deletions
+47
View File
@@ -0,0 +1,47 @@
# Export Voice
Kyutai Pocket TTS allows you to generate speech from an audio sample. However, processing an audio file each time is relatively slow and inefficient.
The `export-voice` command allows you to convert an audio file to a voice embedding in safetensors format. The safetensors file can then be loaded very quickly whenever you generate speech.
## Basic Usage
```bash
uvx pocket-tts export-voice audio-path export-path
# or if installed manually:
pocket-tts export-voice audio-path export-path
```
## Command Options
### Required Parameters
- `audio-path`: Path of the audio file or directory to convert. `audio-path` can point to an `http:` or `hf:` (hugging face) file. If `audio-path` is a local directory, all audio files found inside it will be batch converted. Supports popular audio file formats like wav and mp3.
- `export-path`: Path of safetensors file or directory to export to. For batch conversion, export-path should be a directory. The directory will be created if it does not exist.
### Options
- `--truncate`: Automatically truncate long audio files down to 30 seconds.
The other parameters such as `--lsd-decode-steps` and `--temperature` are the same as for the `generate` command. See the [generate documentation](https://github.com/kyutai-labs/pocket-tts/tree/main/docs/generate.md) for more details.
## Examples
```bash
# export a single file
pocket-tts export-voice voice_memo127762.mp3 jack.safetensors
# export a single file to a different directory (output is embbeddings/mary.safetensors
pocket-tts export-voice voices/mary.wav embeddings/
# export an entire directory of audio files, truncate long audios
pocket-tts export-voice voices/ embeddings/ --truncate
# export an online file to current directory
pocket-tts export-voice https://huggingface.co/kyutai/tts-voices/resolve/main/alba-mackenna/announcer.wav .
# use the exported safetensors
pocket-tts generate --text "Hello, welcome to today's game between the Bears and Cubs." --voice announcer.safetensors
```
Note: to indicate a directory rather than a file, please be sure to include a trailing / (\ on Windows).
+100
View File
@@ -0,0 +1,100 @@
# Generate
The `generate` command allows you to generate speech from text directly from the command line using Kyutai Pocket TTS.
## Basic Usage
```bash
uvx pocket-tts generate
# or if installed manually:
pocket-tts generate
```
This will generate a WAV file `./tts_output.wav` with the default text and voice.
## Command Options
### Core Options
- `--text TEXT`: Text to generate (default: "Hello world! I am Kyutai Pocket TTS. I'm fast enough to run on small CPUs. I hope you'll like me.")
- `--voice VOICE`: Path to audio conditioning file (voice to clone) (default: "hf://kyutai/tts-voices/alba-mackenna/casual.wav"). Urls and local paths are supported.
- `--output-path OUTPUT_PATH`: Output path for generated audio (default: "./tts_output.wav")
### Generation Parameters
- `--config CONFIG_PATH`: Path to custom config.yaml (for loading local model files) or model signature (default: "b6369a24")
- `--lsd-decode-steps LSD_DECODE_STEPS`: Number of generation steps (default: 1)
- `--temperature TEMPERATURE`: Temperature for generation (default: 0.7)
- `--noise-clamp NOISE_CLAMP`: Noise clamp value (default: None)
- `--eos-threshold EOS_THRESHOLD`: EOS threshold (default: -4.0)
- `--frames-after-eos FRAMES_AFTER_EOS`: Number of frames to generate after EOS (default: None, auto-calculated based on the text length). Each frame is 80ms.
### Performance Options
- `--device DEVICE`: Device to use (default: "cpu", you may not get a speedup by using a gpu since it's a small model)
- `--quiet`, `-q`: Disable logging output
## Examples
### Basic Generation
```bash
# Generate with default settings
pocket-tts generate
# Custom text
pocket-tts generate --text "Hello, this is a custom message."
# Custom output path
pocket-tts generate --output-path "./my_audio.wav"
```
### Voice Selection
```bash
# Use different voice from HuggingFace
pocket-tts generate --voice "hf://kyutai/tts-voices/jessica-jian/casual.wav"
# Use local voice file
pocket-tts generate --voice "./my_voice.wav"
# Use a safetensors file (such as one created using `pocket-tts export-voice`)
pocket-tts generate --voice "./my_voice.safetensors"
```
### Quality Tuning
```bash
# Higher quality (more steps)
pocket-tts generate --lsd-decode-steps 5 --temperature 0.5
# More expressive (higher temperature)
pocket-tts generate --temperature 1.0
# Adjust EOS threshold, smaller means finishing earlier.
pocket-tts generate --eos-threshold -3.0
```
### Custom Model Config
If you'd like to override the paths from which the models are loaded, you can provide a custom YAML configuration.
Copy pocket_tts/config/b6369a24.yaml and change weights_path:, weights_path_without_voice_cloning: and tokenizer_path: to the paths of the models you want to load.
Then, use the --config option to point to your newly created config.
```bash
# Use a different config
pocket-tts generate --config "C://pocket-tts/my_config.yaml"
```
## Output Format
The generate command always outputs WAV files in the following format:
- **Sample Rate**: 24kHz
- **Channels**: Mono
- **Bit Depth**: 16-bit PCM
- **Format**: Standard WAV file
For more advanced usage, see the [Python API documentation](python-api.md) or consider using the [serve command](serve.md) for web-based generation and quick iteration.
+63
View File
@@ -0,0 +1,63 @@
# Serve
The `serve` command starts a FastAPI web server that provides both a web interface and HTTP API for text-to-speech generation.
## Basic Usage
```bash
uvx pocket-tts serve
# or if installed manually:
pocket-tts serve
```
This starts a server on `http://localhost:8000` with the default voice model.
## Command Options
- `--voice VOICE`: Path to voice prompt audio file (voice to clone) (default: "hf://kyutai/tts-voices/alba-mackenna/casual.wav")
- `--host HOST`: Host to bind to (default: "localhost")
- `--port PORT`: Port to bind to (default: 8000)
- `--reload`: Enable auto-reload for development
- `--config`: Path to a custom config .yaml
## Examples
### Basic Server
```bash
# Start with default settings
pocket-tts serve
# Custom host and port
pocket-tts serve --host "localhost" --port 8080
```
### Custom Voice
```bash
# Use different voice
pocket-tts serve --voice "hf://kyutai/tts-voices/jessica-jian/casual.wav"
# Use local voice file
pocket-tts serve --voice "./my_voice.wav"
```
### Custom Model Config
If you'd like to override the paths from which the models are loaded, you can provide a custom YAML configuration.
Copy pocket_tts/config/b6369a24.yaml and change weights_path:, weights_path_without_voice_cloning: and tokenizer_path: to the paths of the models you want to load.
Then, use the --config option to point to your newly created config.
```bash
# Use a different config
pocket-tts serve --config "C://pocket-tts/my_config.yaml"
```
## Web Interface
Once the server is running, navigate to `http://localhost:8000` to access the web interface.
For more advanced usage, see the [Python API documentation](python-api.md) for direct integration with the TTS model.