🦝 Fix args being None in worker processes
**Problem:** Worker processes had `args = None` causing AttributeError when accessing `args.xtts_device`, `args.use_deepspeed`, etc. This broke all non-Piper TTS engines (Silero, Kokoro, XTTS). **Root Cause:** `args` was parsed in `if __name__ == "__main__"` block which only runs in parent process, not in uvicorn worker processes. **Solution:** Created DefaultArgs class with sensible defaults for worker processes. Main process still overrides these with actual command-line arguments. **Impact:** All TTS engines now work in worker processes. 🦝 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
bc2071900c
commit
be374409d6
1 changed files with 13 additions and 1 deletions
14
speech.py
14
speech.py
|
|
@ -98,7 +98,19 @@ silero_model = None
|
||||||
silero_speakers = {}
|
silero_speakers = {}
|
||||||
kokoro_pipeline = None
|
kokoro_pipeline = None
|
||||||
kokoro_lang = None
|
kokoro_lang = None
|
||||||
args = None
|
|
||||||
|
# Default args for worker processes (will be overridden in __main__)
|
||||||
|
class DefaultArgs:
|
||||||
|
xtts_device = 'cpu'
|
||||||
|
use_deepspeed = False
|
||||||
|
unload_timer = None
|
||||||
|
log_level = 'INFO'
|
||||||
|
host = '0.0.0.0'
|
||||||
|
port = 8000
|
||||||
|
preload = None
|
||||||
|
no_cache_speaker = False
|
||||||
|
|
||||||
|
args = DefaultArgs()
|
||||||
|
|
||||||
# Voice-to-model lookup cache (loaded at startup)
|
# Voice-to-model lookup cache (loaded at startup)
|
||||||
voice_to_model_cache = {}
|
voice_to_model_cache = {}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue