Skip to content

Commit ab3a1c4

Browse files
chore(pre-commit.ci): auto fixes
1 parent e3befaf commit ab3a1c4

File tree

5 files changed

+69
-49
lines changed

5 files changed

+69
-49
lines changed

src/so_vits_svc_fork/gui.py

Lines changed: 51 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,11 @@ def get_supported_file_types() -> tuple[tuple[str, str], ...]:
8686
common_file_types = ["WAV", "MP3", "FLAC", "OGG", "M4A", "WMA"]
8787
res = sorted(
8888
res,
89-
key=lambda x: common_file_types.index(x[0])
90-
if x[0] in common_file_types
91-
else len(common_file_types),
89+
key=lambda x: (
90+
common_file_types.index(x[0])
91+
if x[0] in common_file_types
92+
else len(common_file_types)
93+
),
9294
)
9395
return res
9496

@@ -187,15 +189,19 @@ def main():
187189
sg.Push(),
188190
sg.InputText(
189191
key="model_path",
190-
default_text=model_candidates[-1].absolute().as_posix()
191-
if model_candidates
192-
else "",
192+
default_text=(
193+
model_candidates[-1].absolute().as_posix()
194+
if model_candidates
195+
else ""
196+
),
193197
enable_events=True,
194198
),
195199
sg.FileBrowse(
196-
initial_folder=Path("./logs/44k/").absolute
197-
if Path("./logs/44k/").exists()
198-
else Path(".").absolute().as_posix(),
200+
initial_folder=(
201+
Path("./logs/44k/").absolute
202+
if Path("./logs/44k/").exists()
203+
else Path(".").absolute().as_posix()
204+
),
199205
key="model_path_browse",
200206
file_types=(
201207
("PyTorch", "G_*.pth G_*.pt"),
@@ -208,15 +214,19 @@ def main():
208214
sg.Push(),
209215
sg.InputText(
210216
key="config_path",
211-
default_text=Path("./configs/44k/config.json").absolute().as_posix()
212-
if Path("./configs/44k/config.json").exists()
213-
else "",
217+
default_text=(
218+
Path("./configs/44k/config.json").absolute().as_posix()
219+
if Path("./configs/44k/config.json").exists()
220+
else ""
221+
),
214222
enable_events=True,
215223
),
216224
sg.FileBrowse(
217-
initial_folder=Path("./configs/44k/").as_posix()
218-
if Path("./configs/44k/").exists()
219-
else Path(".").absolute().as_posix(),
225+
initial_folder=(
226+
Path("./configs/44k/").as_posix()
227+
if Path("./configs/44k/").exists()
228+
else Path(".").absolute().as_posix()
229+
),
220230
key="config_path_browse",
221231
file_types=(("JSON", "*.json"),),
222232
),
@@ -226,15 +236,17 @@ def main():
226236
sg.Push(),
227237
sg.InputText(
228238
key="cluster_model_path",
229-
default_text=Path("./logs/44k/kmeans.pt").absolute().as_posix()
230-
if Path("./logs/44k/kmeans.pt").exists()
231-
else "",
239+
default_text=(
240+
Path("./logs/44k/kmeans.pt").absolute().as_posix()
241+
if Path("./logs/44k/kmeans.pt").exists()
242+
else ""
243+
),
232244
enable_events=True,
233245
),
234246
sg.FileBrowse(
235-
initial_folder="./logs/44k/"
236-
if Path("./logs/44k/").exists()
237-
else ".",
247+
initial_folder=(
248+
"./logs/44k/" if Path("./logs/44k/").exists() else "."
249+
),
238250
key="cluster_model_path_browse",
239251
file_types=(("PyTorch", "*.pt"), ("Pickle", "*.pt *.pth *.pkl")),
240252
),
@@ -350,9 +362,11 @@ def main():
350362
sg.FileBrowse(
351363
initial_folder=".",
352364
key="input_path_browse",
353-
file_types=get_supported_file_types_concat()
354-
if os.name == "nt"
355-
else get_supported_file_types(),
365+
file_types=(
366+
get_supported_file_types_concat()
367+
if os.name == "nt"
368+
else get_supported_file_types()
369+
),
356370
),
357371
sg.FolderBrowse(
358372
button_text="Browse(Folder)",
@@ -737,9 +751,11 @@ def apply_preset(name: str) -> None:
737751
recursive=True,
738752
# svc config
739753
speaker=values["speaker"],
740-
cluster_model_path=Path(values["cluster_model_path"])
741-
if values["cluster_model_path"]
742-
else None,
754+
cluster_model_path=(
755+
Path(values["cluster_model_path"])
756+
if values["cluster_model_path"]
757+
else None
758+
),
743759
transpose=values["transpose"],
744760
auto_predict_f0=values["auto_predict_f0"],
745761
cluster_infer_ratio=values["cluster_infer_ratio"],
@@ -751,9 +767,9 @@ def apply_preset(name: str) -> None:
751767
chunk_seconds=values["chunk_seconds"],
752768
absolute_thresh=values["absolute_thresh"],
753769
max_chunk_seconds=values["max_chunk_seconds"],
754-
device="cpu"
755-
if not values["use_gpu"]
756-
else get_optimal_device(),
770+
device=(
771+
"cpu" if not values["use_gpu"] else get_optimal_device()
772+
),
757773
),
758774
)
759775
infer_future.add_done_callback(
@@ -784,9 +800,11 @@ def apply_preset(name: str) -> None:
784800
config_path=Path(values["config_path"]),
785801
speaker=values["speaker"],
786802
# svc config
787-
cluster_model_path=Path(values["cluster_model_path"])
788-
if values["cluster_model_path"]
789-
else None,
803+
cluster_model_path=(
804+
Path(values["cluster_model_path"])
805+
if values["cluster_model_path"]
806+
else None
807+
),
790808
transpose=values["transpose"],
791809
auto_predict_f0=values["auto_predict_f0"],
792810
cluster_infer_ratio=values["cluster_infer_ratio"],

src/so_vits_svc_fork/inference/main.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ def infer(
7575
svc_model = Svc(
7676
net_g_path=model_path.as_posix(),
7777
config_path=config_path.as_posix(),
78-
cluster_model_path=cluster_model_path.as_posix()
79-
if cluster_model_path
80-
else None,
78+
cluster_model_path=(
79+
cluster_model_path.as_posix() if cluster_model_path else None
80+
),
8181
device=device,
8282
)
8383

@@ -148,9 +148,9 @@ def realtime(
148148
svc_model = Svc(
149149
net_g_path=model_path.as_posix(),
150150
config_path=config_path.as_posix(),
151-
cluster_model_path=cluster_model_path.as_posix()
152-
if cluster_model_path
153-
else None,
151+
cluster_model_path=(
152+
cluster_model_path.as_posix() if cluster_model_path else None
153+
),
154154
device=device,
155155
)
156156

src/so_vits_svc_fork/preprocessing/preprocess_hubert_f0.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,12 @@ def preprocess_hubert_f0(
131131
memory = get_total_gpu_memory("total")
132132
n_jobs = min(
133133
max(
134-
memory
135-
// (HUBERT_MEMORY_CREPE if f0_method == "crepe" else HUBERT_MEMORY)
136-
if memory is not None
137-
else 1,
134+
(
135+
memory
136+
// (HUBERT_MEMORY_CREPE if f0_method == "crepe" else HUBERT_MEMORY)
137+
if memory is not None
138+
else 1
139+
),
138140
1,
139141
),
140142
cpu_count(),

src/so_vits_svc_fork/preprocessing/preprocess_resample.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def preprocess_resample(
116116
warnings.warn(
117117
f"Recommended folder structure has changed since v1.0.0. "
118118
"Please move your dataset directly under dataset_raw folder. "
119-
f"Recoginzed {in_path_relative} as {new_in_path_relative}"
119+
f"Recognized {in_path_relative} as {new_in_path_relative}"
120120
)
121121
in_path_relative = new_in_path_relative
122122

src/so_vits_svc_fork/train.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,11 @@ def train(
104104
val_check_interval=hparams.train.eval_interval,
105105
max_epochs=hparams.train.epochs,
106106
check_val_every_n_epoch=None,
107-
precision="16-mixed"
108-
if hparams.train.fp16_run
109-
else "bf16-mixed"
110-
if hparams.train.get("bf16_run", False)
111-
else 32,
107+
precision=(
108+
"16-mixed"
109+
if hparams.train.fp16_run
110+
else "bf16-mixed" if hparams.train.get("bf16_run", False) else 32
111+
),
112112
strategy=strategy,
113113
callbacks=([pl.callbacks.RichProgressBar()] if not is_notebook() else [])
114114
+ [DeviceStatsMonitor()],

0 commit comments

Comments
 (0)