fix for stop sequence missing, added print for exception when loading GUI

This commit is contained in:
Concedo 2023-05-02 14:18:04 +08:00
parent 0703cdf2eb
commit 433fa1e8b2

View file

@ -162,11 +162,12 @@ def generate(prompt,max_length=20, max_context_length=512,temperature=0.8,top_k=
inputs.rep_pen = rep_pen inputs.rep_pen = rep_pen
inputs.rep_pen_range = rep_pen_range inputs.rep_pen_range = rep_pen_range
inputs.seed = seed inputs.seed = seed
for n in range(0,stop_token_max): if stop_sequence:
if n >= len(stop_sequence): for n in range(0,stop_token_max):
inputs.stop_sequence[n] = "".encode("UTF-8") if n >= len(stop_sequence):
else: inputs.stop_sequence[n] = "".encode("UTF-8")
inputs.stop_sequence[n] = stop_sequence[n].encode("UTF-8") else:
inputs.stop_sequence[n] = stop_sequence[n].encode("UTF-8")
ret = handle.generate(inputs,outputs) ret = handle.generate(inputs,outputs)
if(ret.status==1): if(ret.status==1):
return ret.text.decode("UTF-8","ignore") return ret.text.decode("UTF-8","ignore")
@ -503,6 +504,7 @@ def main(args):
show_gui() show_gui()
except Exception as ex: except Exception as ex:
print("File selection GUI unsupported. Please check command line: script.py --help") print("File selection GUI unsupported. Please check command line: script.py --help")
print("Reason for no GUI: " + str(ex))
time.sleep(2) time.sleep(2)
sys.exit(2) sys.exit(2)