Refactor TTS provider management and enhance documentation

- Renamed `bundled-mlx` to `apple-mlx` for clarity in provider types.
- Updated the ProviderSettings component to reflect the new provider naming.
- Improved logging for provider startup and error handling in the backend.
- Added scripts for building and installing PyTorch CPU and CUDA providers locally.
- Enhanced the documentation to include details on TTS provider architecture and development setup.
This commit is contained in:
Jamie Pine
2026-02-01 01:23:20 -08:00
parent 3b14f81741
commit 580179eba3
15 changed files with 526 additions and 49 deletions
-1
View File
@@ -61,7 +61,6 @@ def build_provider():
'--exclude-module', 'torch.utils.tensorboard',
'--exclude-module', 'tensorboard',
'--exclude-module', 'triton',
'--exclude-module', 'torch.distributed',
'--exclude-module', 'torch._dynamo',
'--exclude-module', 'torch._inductor',
'--exclude-module', 'torch.testing',
@@ -0,0 +1,57 @@
"""
Build PyTorch CPU provider and install to local provider directory.
"""
import platform
import shutil
from pathlib import Path
from build import build_provider
def get_providers_dir() -> Path:
"""Get the directory where providers are stored."""
system = platform.system()
if system == "Windows":
appdata = Path.home() / "AppData" / "Roaming"
elif system == "Darwin":
appdata = Path.home() / "Library" / "Application Support"
else: # Linux
appdata = Path.home() / ".local" / "share"
providers_dir = appdata / "voicebox" / "providers"
providers_dir.mkdir(parents=True, exist_ok=True)
return providers_dir
def main():
"""Build and install provider."""
provider_dir = Path(__file__).parent
# Build the provider
print("Building PyTorch CPU provider...")
build_provider()
# Determine binary name
binary_name = "tts-provider-pytorch-cpu"
if platform.system() == "Windows":
binary_name += ".exe"
# Source and destination paths
source = provider_dir / "dist" / binary_name
destination = get_providers_dir() / binary_name
# Copy to provider directory
print(f"Installing to {destination}...")
shutil.copy2(source, destination)
# Make executable on Unix systems
if platform.system() != "Windows":
destination.chmod(0o755)
print(f"✓ Provider installed successfully to {destination}")
if __name__ == "__main__":
main()
@@ -0,0 +1,48 @@
# -*- mode: python ; coding: utf-8 -*-
from PyInstaller.utils.hooks import collect_data_files
from PyInstaller.utils.hooks import collect_submodules
from PyInstaller.utils.hooks import copy_metadata
datas = []
hiddenimports = ['backend', 'backend.backends', 'backend.backends.pytorch_backend', 'backend.config', 'backend.utils.audio', 'backend.utils.cache', 'backend.utils.progress', 'backend.utils.hf_progress', 'backend.utils.tasks', 'torch', 'transformers', 'qwen_tts', 'qwen_tts.inference', 'qwen_tts.inference.qwen3_tts_model', 'qwen_tts.inference.qwen3_tts_tokenizer', 'qwen_tts.core', 'qwen_tts.cli', 'pkg_resources.extern', 'fastapi', 'uvicorn', 'soundfile', 'numpy', 'librosa']
datas += collect_data_files('qwen_tts')
datas += copy_metadata('qwen-tts')
hiddenimports += collect_submodules('qwen_tts')
hiddenimports += collect_submodules('jaraco')
a = Analysis(
['main.py'],
pathex=['/Users/jamespine/Projects/voicebox'],
binaries=[],
datas=datas,
hiddenimports=hiddenimports,
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=['torch.utils.tensorboard', 'tensorboard', 'triton', 'torch._dynamo', 'torch._inductor', 'torch.testing', 'torch.utils.benchmark', 'IPython', 'matplotlib', 'PIL', 'cv2', 'torchvision', 'torchaudio'],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
name='tts-provider-pytorch-cpu',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
-1
View File
@@ -63,7 +63,6 @@ def build_provider():
'--exclude-module', 'torch.utils.tensorboard',
'--exclude-module', 'tensorboard',
'--exclude-module', 'triton',
'--exclude-module', 'torch.distributed',
'--exclude-module', 'torch._dynamo',
'--exclude-module', 'torch._inductor',
'--exclude-module', 'torch.testing',
@@ -0,0 +1,57 @@
"""
Build PyTorch CUDA provider and install to local provider directory.
"""
import platform
import shutil
from pathlib import Path
from build import build_provider
def get_providers_dir() -> Path:
"""Get the directory where providers are stored."""
system = platform.system()
if system == "Windows":
appdata = Path.home() / "AppData" / "Roaming"
elif system == "Darwin":
appdata = Path.home() / "Library" / "Application Support"
else: # Linux
appdata = Path.home() / ".local" / "share"
providers_dir = appdata / "voicebox" / "providers"
providers_dir.mkdir(parents=True, exist_ok=True)
return providers_dir
def main():
"""Build and install provider."""
provider_dir = Path(__file__).parent
# Build the provider
print("Building PyTorch CUDA provider...")
build_provider()
# Determine binary name
binary_name = "tts-provider-pytorch-cuda"
if platform.system() == "Windows":
binary_name += ".exe"
# Source and destination paths
source = provider_dir / "dist" / binary_name
destination = get_providers_dir() / binary_name
# Copy to provider directory
print(f"Installing to {destination}...")
shutil.copy2(source, destination)
# Make executable on Unix systems
if platform.system() != "Windows":
destination.chmod(0o755)
print(f"✓ Provider installed successfully to {destination}")
if __name__ == "__main__":
main()
@@ -0,0 +1,48 @@
# -*- mode: python ; coding: utf-8 -*-
from PyInstaller.utils.hooks import collect_data_files
from PyInstaller.utils.hooks import collect_submodules
from PyInstaller.utils.hooks import copy_metadata
datas = []
hiddenimports = ['backend', 'backend.backends', 'backend.backends.pytorch_backend', 'backend.config', 'backend.utils.audio', 'backend.utils.cache', 'backend.utils.progress', 'backend.utils.hf_progress', 'backend.utils.tasks', 'torch', 'torch.cuda', 'torch.backends.cudnn', 'transformers', 'qwen_tts', 'qwen_tts.inference', 'qwen_tts.inference.qwen3_tts_model', 'qwen_tts.inference.qwen3_tts_tokenizer', 'qwen_tts.core', 'qwen_tts.cli', 'pkg_resources.extern', 'fastapi', 'uvicorn', 'soundfile', 'numpy', 'librosa']
datas += collect_data_files('qwen_tts')
datas += copy_metadata('qwen-tts')
hiddenimports += collect_submodules('qwen_tts')
hiddenimports += collect_submodules('jaraco')
a = Analysis(
['main.py'],
pathex=['/Users/jamespine/Projects/voicebox'],
binaries=[],
datas=datas,
hiddenimports=hiddenimports,
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=['torch.utils.tensorboard', 'tensorboard', 'triton', 'torch._dynamo', 'torch._inductor', 'torch.testing', 'torch.utils.benchmark', 'IPython', 'matplotlib', 'PIL', 'cv2', 'torchvision', 'torchaudio'],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
name='tts-provider-pytorch-cuda',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)