Local Development¶
Setting up WakeBuilder for local development and personal use.
Quick Start¶
The fastest way to get started:
# Clone the repository
git clone https://github.com/XableTech/WakeBuilder.git
cd WakeBuilder
# Run the interactive setup
python run.py
Manual Setup¶
For more control over the setup process:
1. Create Virtual Environment¶
2. Install Dependencies¶
3. Install PyTorch with CUDA (Optional)¶
For GPU acceleration:
Replace cu128 with your CUDA version.
4. Download TTS Models¶
This downloads ~5GB of Piper TTS voice models.
5. Start the Server¶
Open http://localhost:8000 in your browser.
Server Options¶
Command Line Options¶
uvicorn src.wakebuilder.backend.main:app \
--host 0.0.0.0 \
--port 8000 \
--reload \
--log-level info
| Option | Description |
|---|---|
--host | Bind address (0.0.0.0 for all interfaces) |
--port | Port number (default: 8000) |
--reload | Auto-reload on code changes |
--log-level | Logging verbosity |
Using run.py¶
Development Workflow¶
Code Changes¶
With --reload enabled, the server automatically restarts when you modify:
- Python files in
src/ - Configuration files
Running Tests¶
# All tests
pytest
# Specific test file
pytest tests/test_training.py
# With coverage
pytest --cov=src/wakebuilder
Code Quality¶
Directory Setup¶
WakeBuilder creates these directories on first run:
WakeBuilder/
├── models/
│ ├── default/ # Pre-trained models
│ └── custom/ # Your trained models
├── data/
│ ├── negative/ # UNAC dataset
│ └── cache/ # Pre-processed chunks
├── recordings/ # Temporary recordings
└── tts_voices/ # Piper TTS models
GPU Configuration¶
Checking GPU Availability¶
import torch
print(f"CUDA available: {torch.cuda.is_available()}")
print(f"GPU: {torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'None'}")
Selecting GPU¶
# Use specific GPU
CUDA_VISIBLE_DEVICES=0 python run.py
# Use CPU only
CUDA_VISIBLE_DEVICES=-1 python run.py
Troubleshooting¶
Server Issues¶
Server won't start
-
Check port is not in use:
-
Try a different port:
-
Check Python version:
Import errors
- Ensure virtual environment is activated
- Reinstall dependencies:
- Check for conflicting packages
Out of memory
- Close other applications
- Reduce batch size in training
- Disable some TTS providers
Training Issues¶
Training is very slow
- Enable GPU acceleration
- Reduce target positive samples
- Lower hard negative ratio
Training fails with error
- Check server logs for stack trace
- Verify audio files are valid
- Ensure sufficient disk space
Audio Issues¶
Audio recording not working
- Check browser microphone permissions
- Ensure microphone is not muted
- Try a different browser
TTS generation fails
- Verify TTS voices are downloaded:
- Check available disk space
- Review server logs for errors
Recommended Development Tools¶
| Tool | Purpose |
|---|---|
| VS Code | IDE with Python support |
| Postman/Insomnia | API testing |
| Chrome DevTools | Frontend debugging |
| htop/nvtop | System monitoring |