From 9ee9f5fd811ec518acbab35bcbc399165af8dcf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Thu, 10 Oct 2024 01:57:04 +0900 Subject: [PATCH] fix: Pipeline.pipeline for empty f0_file - Added checks for empty f0_file, skipping faulty inp_f0 creation if empty as it should --- infer/modules/vc/pipeline.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/infer/modules/vc/pipeline.py b/infer/modules/vc/pipeline.py index 4f4a401..f8857e8 100644 --- a/infer/modules/vc/pipeline.py +++ b/infer/modules/vc/pipeline.py @@ -324,11 +324,13 @@ class Pipeline(object): if hasattr(f0_file, "name"): try: with open(f0_file.name, "r") as f: - lines = f.read().strip("\n").split("\n") - inp_f0 = [] - for line in lines: - inp_f0.append([float(i) for i in line.split(",")]) - inp_f0 = np.array(inp_f0, dtype="float32") + raw_lines = f.read() + if len(raw_lines) > 0: + lines = raw_lines.strip("\n").split("\n") + inp_f0 = [] + for line in lines: + inp_f0.append([float(i) for i in line.split(",")]) + inp_f0 = np.array(inp_f0, dtype="float32") except: traceback.print_exc() sid = torch.tensor(sid, device=self.device).unsqueeze(0).long()