From 746b19bedb0bb09de54fd0beb86c082cae6c2a92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=82=A6?= Date: Thu, 8 Feb 2024 15:14:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=98=BE=E5=8D=A1=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E7=BC=96=E5=8F=B7=E5=BE=AA=E7=8E=AF=E5=86=99=E5=85=A5?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改显卡设备编号循环写入的bug,导致首次循环报错 --- webui.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/webui.py b/webui.py index fb18112d..b2eb19a5 100644 --- a/webui.py +++ b/webui.py @@ -377,10 +377,14 @@ def open1a(inp_text,inp_wav_dir,exp_name,gpu_numbers,bert_pretrained_dir): p.wait() opt = [] for i_part in range(all_parts): - txt_path = "%s/2-name2text-%s.txt" % (opt_dir, i_part) - with open(txt_path, "r", encoding="utf8") as f: - opt += f.read().strip("\n").split("\n") - os.remove(txt_path) + try: + txt_path = "%s/2-name2text-%s.txt" % (opt_dir, i_part) + with open(txt_path, "r", encoding="utf8") as f: + opt += f.read().strip("\n").split("\n") + os.remove(txt_path) + except Exception as e: + print(str(e)) + pass path_text = "%s/2-name2text.txt" % opt_dir with open(path_text, "w", encoding="utf8") as f: f.write("\n".join(opt) + "\n")