mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-10-03 09:05:17 -07:00
Fix LuxTTS + Chatterbox in prod: bundle espeak/perth data, fix multiprocessing
- collect-all piper_phonemize to bundle espeak-ng-data for LuxTTS phonemization - Set ESPEAK_DATA_PATH in frozen builds so the C library finds bundled data - collect-all perth to bundle pretrained watermark model for Chatterbox - Add multiprocessing.freeze_support() to fix resource_tracker subprocess crash
This commit is contained in:
@@ -111,6 +111,12 @@ def build_server(cuda=False):
|
|||||||
# inflect uses typeguard @typechecked which calls inspect.getsource()
|
# inflect uses typeguard @typechecked which calls inspect.getsource()
|
||||||
# at import time — needs .py source files, not just .pyc bytecode
|
# at import time — needs .py source files, not just .pyc bytecode
|
||||||
'--collect-all', 'inflect',
|
'--collect-all', 'inflect',
|
||||||
|
# perth ships pretrained watermark model files (hparams.yaml, .pth.tar)
|
||||||
|
# in perth/perth_net/pretrained/ — needed by chatterbox at runtime
|
||||||
|
'--collect-all', 'perth',
|
||||||
|
# piper_phonemize ships espeak-ng-data/ (phoneme tables, language dicts)
|
||||||
|
# needed by LuxTTS for text-to-phoneme conversion
|
||||||
|
'--collect-all', 'piper_phonemize',
|
||||||
])
|
])
|
||||||
|
|
||||||
# Add CUDA-specific hidden imports
|
# Add CUDA-specific hidden imports
|
||||||
|
|||||||
@@ -26,6 +26,20 @@ if not _is_writable(sys.stdout):
|
|||||||
if not _is_writable(sys.stderr):
|
if not _is_writable(sys.stderr):
|
||||||
sys.stderr = open(os.devnull, 'w')
|
sys.stderr = open(os.devnull, 'w')
|
||||||
|
|
||||||
|
# PyInstaller + multiprocessing: child processes re-execute the frozen binary
|
||||||
|
# with internal arguments. freeze_support() handles this and exits early.
|
||||||
|
import multiprocessing
|
||||||
|
multiprocessing.freeze_support()
|
||||||
|
|
||||||
|
# In frozen builds, piper_phonemize's espeak-ng C library falls back to
|
||||||
|
# /usr/share/espeak-ng-data/ which doesn't exist. Point it at the bundled
|
||||||
|
# data directory instead.
|
||||||
|
if getattr(sys, 'frozen', False):
|
||||||
|
_meipass = getattr(sys, '_MEIPASS', os.path.dirname(sys.executable))
|
||||||
|
_espeak_data = os.path.join(_meipass, 'piper_phonemize', 'espeak-ng-data')
|
||||||
|
if os.path.isdir(_espeak_data):
|
||||||
|
os.environ.setdefault('ESPEAK_DATA_PATH', _espeak_data)
|
||||||
|
|
||||||
# Fast path: handle --version before any heavy imports so the Rust
|
# Fast path: handle --version before any heavy imports so the Rust
|
||||||
# version check doesn't block for 30+ seconds loading torch etc.
|
# version check doesn't block for 30+ seconds loading torch etc.
|
||||||
if "--version" in sys.argv:
|
if "--version" in sys.argv:
|
||||||
|
|||||||
Reference in New Issue
Block a user