Skip to content

Commit

Permalink
fix(__main__,gui): fix some parameters not passed (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
34j authored Mar 26, 2023
1 parent 74c3578 commit 6cfe3d3
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 12 deletions.
23 changes: 19 additions & 4 deletions src/so_vits_svc_fork/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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,
Expand All @@ -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,
Expand Down
24 changes: 16 additions & 8 deletions src/so_vits_svc_fork/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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 (
Expand Down Expand Up @@ -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,
Expand All @@ -606,25 +612,27 @@ 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"
],
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"],
),
)
Expand Down

0 comments on commit 6cfe3d3

Please sign in to comment.