From 6cfe3d3f567c03e1c59065ff827f564a13a7aaaf Mon Sep 17 00:00:00 2001 From: 34j <55338215+34j@users.noreply.github.com> Date: Sun, 26 Mar 2023 17:07:32 +0900 Subject: [PATCH] fix(__main__,gui): fix some parameters not passed (#124) --- src/so_vits_svc_fork/__main__.py | 23 +++++++++++++++++++---- src/so_vits_svc_fork/gui.py | 24 ++++++++++++++++-------- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/src/so_vits_svc_fork/__main__.py b/src/so_vits_svc_fork/__main__.py index e88fd070..7f603349 100644 --- a/src/so_vits_svc_fork/__main__.py +++ b/src/so_vits_svc_fork/__main__.py @@ -165,6 +165,13 @@ def train(config_path: Path, model_path: Path): @click.option( "-db", "--db-thresh", type=int, default=-20, help="threshold (DB) (RELATIVE)" ) +@click.option( + "-fm", + "--f0-method", + type=click.Choice(["crepe", "crepe-tiny", "parselmouth", "dio", "harvest"]), + default="dio", + help="f0 prediction method", +) @click.option( "-a", "--auto-predict-f0", type=bool, default=True, help="auto predict f0" ) @@ -185,17 +192,21 @@ def train(config_path: Path, model_path: Path): "-ab", "--absolute-thresh", type=bool, default=False, help="absolute thresh" ) def infer( + # paths input_path: Path, output_path: Path, - speaker: str, model_path: Path, config_path: Path, + # svc config + speaker: str, cluster_model_path: Path | None = None, transpose: int = 0, - db_thresh: int = -40, auto_predict_f0: bool = False, cluster_infer_ratio: float = 0, noise_scale: float = 0.4, + f0_method: Literal["crepe", "crepe-tiny", "parselmouth", "dio", "harvest"] = "dio", + # slice config + db_thresh: int = -40, pad_seconds: float = 0.5, chunk_seconds: float = 0.5, absolute_thresh: bool = False, @@ -222,17 +233,21 @@ def infer( if cluster_model_path is not None: cluster_model_path = Path(cluster_model_path) infer( + # paths input_path=input_path, output_path=output_path, - speaker=speaker, model_path=model_path, config_path=config_path, + # svc config + speaker=speaker, cluster_model_path=cluster_model_path, transpose=transpose, - db_thresh=db_thresh, auto_predict_f0=auto_predict_f0, cluster_infer_ratio=cluster_infer_ratio, noise_scale=noise_scale, + f0_method=f0_method, + # slice config + db_thresh=db_thresh, pad_seconds=pad_seconds, chunk_seconds=chunk_seconds, absolute_thresh=absolute_thresh, diff --git a/src/so_vits_svc_fork/gui.py b/src/so_vits_svc_fork/gui.py index 8e10420a..9bd162a4 100644 --- a/src/so_vits_svc_fork/gui.py +++ b/src/so_vits_svc_fork/gui.py @@ -550,10 +550,12 @@ def apply_preset(name: str) -> None: continue try: infer( + # paths model_path=Path(values["model_path"]), - config_path=Path(values["config_path"]), - input_path=input_path, output_path=output_path, + input_path=input_path, + config_path=Path(values["config_path"]), + # svc config speaker=values["speaker"], cluster_model_path=Path(values["cluster_model_path"]) if values["cluster_model_path"] @@ -562,10 +564,12 @@ def apply_preset(name: str) -> None: auto_predict_f0=values["auto_predict_f0"], cluster_infer_ratio=values["cluster_infer_ratio"], noise_scale=values["noise_scale"], + f0_method=values["f0_method"], + # slice config db_thresh=values["silence_threshold"], pad_seconds=values["pad_seconds"], - absolute_thresh=values["absolute_thresh"], chunk_seconds=values["chunk_seconds"], + absolute_thresh=values["absolute_thresh"], device="cpu" if not values["use_gpu"] else ( @@ -595,9 +599,11 @@ def apply_preset(name: str) -> None: future = pool.schedule( realtime, kwargs=dict( + # paths model_path=Path(values["model_path"]), config_path=Path(values["config_path"]), speaker=values["speaker"], + # svc config cluster_model_path=Path(values["cluster_model_path"]) if values["cluster_model_path"] else None, @@ -606,6 +612,11 @@ def apply_preset(name: str) -> None: cluster_infer_ratio=values["cluster_infer_ratio"], noise_scale=values["noise_scale"], f0_method=values["f0_method"], + # slice config + db_thresh=values["silence_threshold"], + pad_seconds=values["pad_seconds"], + chunk_seconds=values["chunk_seconds"], + # realtime config crossfade_seconds=values["crossfade_seconds"], additional_infer_before_seconds=values[ "additional_infer_before_seconds" @@ -613,18 +624,15 @@ def apply_preset(name: str) -> None: additional_infer_after_seconds=values[ "additional_infer_after_seconds" ], - db_thresh=values["silence_threshold"], - pad_seconds=values["pad_seconds"], - chunk_seconds=values["chunk_seconds"], - version=int(values["realtime_algorithm"][0]), - device="cuda" if values["use_gpu"] else "cpu", block_seconds=values["block_seconds"], + version=int(values["realtime_algorithm"][0]), input_device=input_device_indices[ window["input_device"].widget.current() ], output_device=output_device_indices[ window["output_device"].widget.current() ], + device="cuda" if values["use_gpu"] else "cpu", passthrough_original=values["passthrough_original"], ), )