From db166e9759882ff99327c8c080f64aa59cbc1a81 Mon Sep 17 00:00:00 2001 From: LimitCantCode Date: Mon, 7 Oct 2024 20:40:46 -0400 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 9e3e387..9408f8c 100644 --- a/infer/modules/vc/pipeline.py +++ b/infer/modules/vc/pipeline.py @@ -341,11 +341,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()