mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-18 06:10:43 -07:00
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:
co-authored by
Claude Sonnet 4.5
parent
9bde534860
commit
2542f64e1b
+24
-6
@@ -5,6 +5,7 @@ PyInstaller build script for creating standalone Python server binary.
|
||||
import PyInstaller.__main__
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
@@ -13,15 +14,27 @@ def is_apple_silicon():
|
||||
return platform.system() == "Darwin" and platform.machine() == "arm64"
|
||||
|
||||
|
||||
def build_server():
|
||||
"""Build Python server as standalone binary."""
|
||||
def build_server(variant="cpu"):
|
||||
"""Build Python server as standalone binary.
|
||||
|
||||
Args:
|
||||
variant: 'cpu' for CPU-only build (~500MB) or 'cuda' for CUDA build (~3GB)
|
||||
"""
|
||||
backend_dir = Path(__file__).parent
|
||||
|
||||
if variant not in ['cpu', 'cuda']:
|
||||
raise ValueError(f"Invalid variant: {variant}. Must be 'cpu' or 'cuda'")
|
||||
|
||||
# Set binary name based on variant
|
||||
binary_name = f'voicebox-server-{variant}' if variant == 'cuda' else 'voicebox-server'
|
||||
|
||||
print(f"Building {variant.upper()} variant: {binary_name}")
|
||||
|
||||
# PyInstaller arguments
|
||||
args = [
|
||||
'server.py', # Use server.py as entry point instead of main.py
|
||||
'--onefile',
|
||||
'--name', 'voicebox-server',
|
||||
'--name', binary_name,
|
||||
]
|
||||
|
||||
# Add local qwen_tts path if specified (for editable installs)
|
||||
@@ -100,9 +113,14 @@ def build_server():
|
||||
|
||||
# Run PyInstaller
|
||||
PyInstaller.__main__.run(args)
|
||||
|
||||
print(f"Binary built in {backend_dir / 'dist' / 'voicebox-server'}")
|
||||
|
||||
print(f"\n{'='*60}")
|
||||
print(f"Build complete: {variant.upper()} variant")
|
||||
print(f"Binary: {backend_dir / 'dist' / binary_name}")
|
||||
print(f"{'='*60}\n")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
build_server()
|
||||
# Accept variant as command line argument
|
||||
variant = sys.argv[1] if len(sys.argv) > 1 else 'cpu'
|
||||
build_server(variant)
|
||||
|
||||
Reference in New Issue
Block a user