From 916780eaf46ccab32580cf849f50f06e0c197b7b Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Wed, 31 Jan 2024 15:16:08 +0800 Subject: [PATCH] fixed a bug with stop seq processing --- koboldcpp.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/koboldcpp.py b/koboldcpp.py index 2d8b8ea4e..8f72fbe2c 100755 --- a/koboldcpp.py +++ b/koboldcpp.py @@ -336,6 +336,7 @@ def generate(prompt, memory="", max_length=32, max_context_length=512, temperatu inputs.memory = memory.encode("UTF-8") if max_length >= max_context_length: max_length = max_context_length-1 + print("\nWARNING: You are trying to generate with max_length near or exceeding max_context_length. Most of the context will be gone and your outputs will not be very coherent.") global showmaxctxwarning if max_context_length > maxctx: if showmaxctxwarning: @@ -382,6 +383,8 @@ def generate(prompt, memory="", max_length=32, max_context_length=512, temperatu for n in range(stop_token_max): if not stop_sequence or n >= len(stop_sequence): inputs.stop_sequence[n] = "".encode("UTF-8") + elif stop_sequence[n]==None: + inputs.stop_sequence[n] = "".encode("UTF-8") else: inputs.stop_sequence[n] = stop_sequence[n].encode("UTF-8")