diff options
| author | historia <historiavg@proton.me> | 2026-08-24 16:18:38 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-24 16:18:38 -0400 |
| commit | 919544c0931d53bb81904b6212ff14f856549da3 (patch) | |
| tree | aef7161db4cdb43bbd572fdc6c2fa2539726f4ee /app/converter | |
| parent | 1ff9a635bd9b033b631a6b525891b7eb44e189d3 (diff) | |
| download | tts-audiobook-generator-919544c0931d53bb81904b6212ff14f856549da3.tar.gz | |
feat: option to unload models from audio.cpp per-run
Diffstat (limited to 'app/converter')
| -rw-r--r-- | app/converter/config.py | 7 | ||||
| -rw-r--r-- | app/converter/tts.py | 5 |
2 files changed, 11 insertions, 1 deletions
diff --git a/app/converter/config.py b/app/converter/config.py index 9f70a73..6eacb41 100644 --- a/app/converter/config.py +++ b/app/converter/config.py @@ -83,3 +83,10 @@ AUDIOCPP_CLONE_MODEL_ID = "qwen" # VoiceDesign); on other families it acts as a style/delivery instruction # when the model supports one and is ignored otherwise. Empty by default. AUDIOCPP_INSTRUCTIONS = "" + +# Ask the audio.cpp server to unload all currently loaded models before +# converting, so models left resident by earlier runs free their memory +# (e.g. VRAM on GPU backends) and only the selected entry loads. Set to +# False to keep other models resident across runs (the TUI Settings menu +# exposes this as "Unload models", default Yes). +AUDIOCPP_UNLOAD_MODELS = True diff --git a/app/converter/tts.py b/app/converter/tts.py index 41e3aa5..a83896d 100644 --- a/app/converter/tts.py +++ b/app/converter/tts.py @@ -919,7 +919,8 @@ class AudioCppTTSClient(_BaseTTSClient): print(f"[INFO] Sending instruction with every request: {self.instructions}") print("[INFO] Its effect (style, emotion, delivery) depends on the " "model family; models without instruction support ignore it.") - self._unload_server_models() + if config.AUDIOCPP_UNLOAD_MODELS: + self._unload_server_models() def _unload_server_models(self) -> None: """Ask the server to unload every loaded model before generating. @@ -930,6 +931,8 @@ class AudioCppTTSClient(_BaseTTSClient): first frees those leftovers; this run's model reloads transparently on its first request. Failures only warn: an older server without the endpoint, or a busy one, must not block a working setup. + Controlled by config.AUDIOCPP_UNLOAD_MODELS (the TUI Settings + "Unload models" option). """ request = urllib.request.Request( f"{self.api_url}/v1/tasks/unload_all_models", data=b"", |
