修改显卡设备编号循环写入的bug

修改显卡设备编号循环写入的bug,导致首次循环报错
This commit is contained in:
刘悦 2024-02-08 15:14:17 +08:00 committed by GitHub
parent 57dde51e11
commit 746b19bedb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -377,10 +377,14 @@ def open1a(inp_text,inp_wav_dir,exp_name,gpu_numbers,bert_pretrained_dir):
p.wait() p.wait()
opt = [] opt = []
for i_part in range(all_parts): for i_part in range(all_parts):
txt_path = "%s/2-name2text-%s.txt" % (opt_dir, i_part) try:
with open(txt_path, "r", encoding="utf8") as f: txt_path = "%s/2-name2text-%s.txt" % (opt_dir, i_part)
opt += f.read().strip("\n").split("\n") with open(txt_path, "r", encoding="utf8") as f:
os.remove(txt_path) 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 path_text = "%s/2-name2text.txt" % opt_dir
with open(path_text, "w", encoding="utf8") as f: with open(path_text, "w", encoding="utf8") as f:
f.write("\n".join(opt) + "\n") f.write("\n".join(opt) + "\n")