Skip to content

Commit 0635a26

Browse files
committed
Use os.path.basename to extract the file name
This function should handle paths in Windows correctly. Previously, if the path for the source data contained a backslash, the script could not write the result.
1 parent a516247 commit 0635a26

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

inference.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,8 @@ def main(args):
390390
time_vc_end = time.time()
391391
print(f"RTF: {(time_vc_end - time_vc_start) / vc_wave.size(-1) * sr}")
392392

393-
source_name = source.split("/")[-1].split(".")[0]
394-
target_name = target_name.split("/")[-1].split(".")[0]
393+
source_name = os.path.basename(source).split(".")[0]
394+
target_name = os.path.basename(target_name).split(".")[0]
395395
os.makedirs(args.output, exist_ok=True)
396396
torchaudio.save(os.path.join(args.output, f"vc_{source_name}_{target_name}_{length_adjust}_{diffusion_steps}_{inference_cfg_rate}.wav"), vc_wave.cpu(), sr)
397397

0 commit comments

Comments
 (0)