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)