Basic changes to allow loading of local model files (#59)
-modify main,py to not hardcode using DEFAULT_VARIANT -allow submission of path string to path of variant.yaml file saved in custom directory in lieu of model variant identifier in CLI to use when loading model -addresses #57
This commit is contained in:
+11
-3
@@ -181,11 +181,17 @@ def serve(
|
||||
host: Annotated[str, typer.Option(help="Host to bind to")] = "localhost",
|
||||
port: Annotated[int, typer.Option(help="Port to bind to")] = 8000,
|
||||
reload: Annotated[bool, typer.Option(help="Enable auto-reload")] = False,
|
||||
config: Annotated[
|
||||
str,
|
||||
typer.Option(
|
||||
help="Model variant signature or path to locally-saved model config .yaml file"
|
||||
),
|
||||
] = DEFAULT_VARIANT,
|
||||
):
|
||||
"""Start the FastAPI server."""
|
||||
|
||||
global tts_model, global_model_state
|
||||
tts_model = TTSModel.load_model(DEFAULT_VARIANT)
|
||||
tts_model = TTSModel.load_model(config)
|
||||
|
||||
# Pre-load the voice prompt
|
||||
global_model_state = tts_model.get_state_for_audio_prompt(voice)
|
||||
@@ -208,7 +214,9 @@ def generate(
|
||||
str, typer.Option(help="Path to audio conditioning file (voice to clone)")
|
||||
] = DEFAULT_AUDIO_PROMPT,
|
||||
quiet: Annotated[bool, typer.Option("-q", "--quiet", help="Disable logging output")] = False,
|
||||
variant: Annotated[str, typer.Option(help="Model signature")] = DEFAULT_VARIANT,
|
||||
config: Annotated[
|
||||
str, typer.Option(help="Model signature or path to config .yaml file")
|
||||
] = DEFAULT_VARIANT,
|
||||
lsd_decode_steps: Annotated[
|
||||
int, typer.Option(help="Number of generation steps")
|
||||
] = DEFAULT_LSD_DECODE_STEPS,
|
||||
@@ -236,7 +244,7 @@ def generate(
|
||||
log_level = logging.ERROR if quiet else logging.INFO
|
||||
with enable_logging("pocket_tts", log_level):
|
||||
tts_model = TTSModel.load_model(
|
||||
variant, temperature, lsd_decode_steps, noise_clamp, eos_threshold
|
||||
config, temperature, lsd_decode_steps, noise_clamp, eos_threshold
|
||||
)
|
||||
tts_model.to(device)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user