From 433fa1e8b268f269e81dfa3855d33b167d76eeb0 Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Tue, 2 May 2023 14:18:04 +0800 Subject: [PATCH] fix for stop sequence missing, added print for exception when loading GUI --- koboldcpp.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/koboldcpp.py b/koboldcpp.py index 52d3b5ffa..1e5130a17 100644 --- a/koboldcpp.py +++ b/koboldcpp.py @@ -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_range = rep_pen_range inputs.seed = seed - for n in range(0,stop_token_max): - if n >= len(stop_sequence): - inputs.stop_sequence[n] = "".encode("UTF-8") - else: - inputs.stop_sequence[n] = stop_sequence[n].encode("UTF-8") + if stop_sequence: + for n in range(0,stop_token_max): + if n >= len(stop_sequence): + inputs.stop_sequence[n] = "".encode("UTF-8") + else: + inputs.stop_sequence[n] = stop_sequence[n].encode("UTF-8") ret = handle.generate(inputs,outputs) if(ret.status==1): return ret.text.decode("UTF-8","ignore") @@ -501,8 +502,9 @@ def main(args): print("Otherwise, please manually select ggml file:") try: show_gui() - except Exception as ex: + except Exception as ex: print("File selection GUI unsupported. Please check command line: script.py --help") + print("Reason for no GUI: " + str(ex)) time.sleep(2) sys.exit(2)