aboutsummaryrefslogtreecommitdiff
path: root/audiobook.py
diff options
context:
space:
mode:
Diffstat (limited to 'audiobook.py')
-rwxr-xr-xaudiobook.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/audiobook.py b/audiobook.py
index 88e8dca..302bb17 100755
--- a/audiobook.py
+++ b/audiobook.py
@@ -259,7 +259,7 @@ def convert(backend: str, voice: str = None, clone: str = None,
input_file: Path = None, output_file: Path = None,
progress=None, cancel=None, confirm=None,
book_files=None, planned=None, manage_server: bool = False,
- model_ids=None, model_voices=None,
+ chunk_size: int = None, model_ids=None, model_voices=None,
planned_by_model=None) -> int:
"""Run one conversion pass with explicit options (used by the CLI and hub).
@@ -382,6 +382,17 @@ def convert(backend: str, voice: str = None, clone: str = None,
model_id = sg_entry.key
voice_mode = voice_mode_for(backend, voice, clone, instructions,
model=model_id)
+ if planned is None:
+ # CLI runs pre-flight here: a model whose engine caps one
+ # request below a full CHUNK_SIZE sub-chunk (Higgs) gets the
+ # clamp popup before anything converts; Cancel stops the run
+ # unstarted. Hub runs asked in the TUI pre-flight and carry
+ # the answer as chunk_size.
+ try:
+ chunk_size = _converter_mod.prompt_chunk_clamp(sg_entry)
+ except _converter_mod.ChunkClampCancelled:
+ print("[INFO] Conversion cancelled; nothing was converted")
+ return 0
else:
# qwen: instructions design the voice (VoiceDesign model), a
# reference .wav clones one (Base), otherwise a built-in speaker.
@@ -435,6 +446,7 @@ def convert(backend: str, voice: str = None, clone: str = None,
language=language, backend=backend, voice=voice, debug=debug,
model_id=model_id, instructions=instructions,
request_options=request_options, api_url=api_url,
+ chunk_size=chunk_size,
progress=progress, cancel=cancel,
)
converter._book_files = book_files