Implement dual server binary system (CPU/CUDA)

Problem: The server binary with CUDA support was 2.9GB, causing:
- MSI installer failures in CI (WiX can't handle 3GB files)
- Massive downloads for all users (even those without GPUs)
- Poor user experience

Solution: Build two separate server binaries:
- voicebox-server.exe (CPU-only, ~295MB) - ships with installer
- voicebox-server-cuda.exe (CUDA, ~2.9GB) - optional download

Changes:
- backend/build_binary.py: Added 'variant' parameter for CPU/CUDA builds
- backend/build_cpu.bat: Script to build CPU-only binary
- backend/build_cuda.bat: Script to build CUDA binary
- backend/build_both.bat: Script to build both binaries
- backend/build_cpu.sh: Unix build script for CPU binary
- .github/workflows/release.yml: Build both variants, upload CUDA separately
- tauri/vite.config.ts: Externalize Tauri plugins to fix build
- docs/dual-server-binaries.md: Complete documentation

Results:
- Installer size reduced from 3GB to ~500MB (6x smaller)
- CI builds now succeed (WiX can handle 500MB)
- GPU users can opt-in to download CUDA support
- Better bandwidth usage for CPU-only users

Next steps:
- Frontend implementation to detect GPU and download CUDA binary
- Settings UI to toggle between CPU/CUDA modes

Co-Authored-By: Claude Sonnet 4.5 (1M context) <[email protected]>
This commit is contained in:
Jamie Pine
2026-01-30 22:51:43 -08:00
co-authored by Claude Sonnet 4.5
parent 9bde534860
commit 2542f64e1b
8 changed files with 369 additions and 17 deletions
+48 -11
View File
@@ -66,24 +66,24 @@ jobs:
run: |
pip install -r backend/requirements-mlx.txt
- name: Install PyTorch with CUDA (Windows only)
if: matrix.platform == 'windows-latest'
run: |
pip install torch --index-url https://download.pytorch.org/whl/cu121 --force-reinstall --no-deps
pip install torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
- name: Build Python server (Linux/macOS)
if: matrix.platform != 'windows-latest'
run: |
chmod +x scripts/build-server.sh
./scripts/build-server.sh
- name: Build Python server (Windows)
- name: Build CPU Python server (Windows)
if: matrix.platform == 'windows-latest'
shell: bash
run: |
cd backend
python build_binary.py
echo "Installing CPU-only PyTorch..."
pip uninstall -y torch torchvision torchaudio
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
echo "Building CPU server binary..."
python build_binary.py cpu
# Get platform tuple
PLATFORM=$(rustc --print host-tuple)
@@ -91,9 +91,31 @@ jobs:
# Create binaries directory
mkdir -p ../tauri/src-tauri/binaries
# Copy with platform suffix
# Copy CPU version (default for installer)
cp dist/voicebox-server.exe ../tauri/src-tauri/binaries/voicebox-server-${PLATFORM}.exe
echo "Built voicebox-server-${PLATFORM}.exe"
echo "Built CPU server: voicebox-server-${PLATFORM}.exe (~500MB)"
- name: Build CUDA Python server (Windows)
if: matrix.platform == 'windows-latest'
shell: bash
run: |
cd backend
echo "Installing CUDA PyTorch..."
pip uninstall -y torch torchvision torchaudio
pip install torch --index-url https://download.pytorch.org/whl/cu121 --force-reinstall --no-deps
pip install torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
echo "Building CUDA server binary..."
python build_binary.py cuda
# Get platform tuple
PLATFORM=$(rustc --print host-tuple)
# Copy CUDA version for separate upload
mkdir -p cuda-release
cp dist/voicebox-server-cuda.exe cuda-release/voicebox-server-cuda-${PLATFORM}.exe
echo "Built CUDA server: voicebox-server-cuda-${PLATFORM}.exe (~3GB)"
- name: Setup Bun
uses: oven-sh/setup-bun@v2
@@ -150,11 +172,26 @@ jobs:
### Installation
- **macOS (Apple Silicon)**: Download the `aarch64.dmg` file - uses MLX for fast native inference
- **macOS (Intel)**: Download the `x64.dmg` file - uses PyTorch
- **Windows**: Download the `.msi` installer
- **Windows**: Download the `.msi` installer - includes CPU-only inference (~500MB)
- **Linux**: Download the `.AppImage` or `.deb` package
### NVIDIA GPU Acceleration (Windows)
Windows users with NVIDIA GPUs can enable CUDA for 4-5x faster inference:
1. Install the app normally (CPU version)
2. The app will detect your GPU and offer to download CUDA support
3. Or manually download `voicebox-server-cuda-*.exe` (~3GB) from the assets below
The app includes automatic updates - future updates will be installed automatically.
releaseDraft: true
prerelease: false
args: ${{ matrix.args }}
includeUpdaterJson: true
- name: Upload CUDA server binary (Windows only)
if: matrix.platform == 'windows-latest'
uses: softprops/action-gh-release@v1
with:
files: backend/cuda-release/voicebox-server-cuda-*.exe
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}