From 5ccd4b2bf5536b53fd1b0ba2c694eb63f2a81a56 Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Thu, 15 May 2025 10:26:20 +0800 Subject: [PATCH] horde default max ctx matches main ctx --- koboldcpp.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/koboldcpp.py b/koboldcpp.py index 1c8dd0887..d0626b0bb 100644 --- a/koboldcpp.py +++ b/koboldcpp.py @@ -70,7 +70,7 @@ fullwhispermodelpath = "" #if empty, it's not initialized ttsmodelpath = "" #if empty, not initialized embeddingsmodelpath = "" #if empty, not initialized maxctx = 4096 -maxhordectx = 4096 +maxhordectx = 0 #set to whatever maxctx is if 0 maxhordelen = 512 modelbusy = threading.Lock() requestsinqueue = 0 @@ -2831,7 +2831,7 @@ Change Mode
response_body = (json.dumps({"value": maxhordelen}).encode()) elif self.path.endswith(('/api/v1/config/max_context_length', '/api/latest/config/max_context_length')): - response_body = (json.dumps({"value": min(maxctx,maxhordectx)}).encode()) + response_body = (json.dumps({"value": min(maxctx,(maxctx if maxhordectx==0 else maxhordectx))}).encode()) elif self.path.endswith(('/api/v1/config/soft_prompt', '/api/latest/config/soft_prompt')): response_body = (json.dumps({"value":""}).encode()) @@ -4685,8 +4685,8 @@ def show_gui(): makelabel(horde_tab, "Horde:", 18,0,"Settings for embedded AI Horde worker").grid(pady=10) horde_name_entry, horde_name_label = makelabelentry(horde_tab, "Horde Model Name:", horde_name_var, 20, 180,tooltip="The model name to be displayed on the AI Horde.") - horde_gen_entry, horde_gen_label = makelabelentry(horde_tab, "Gen. Length:", horde_gen_var, 21, 50,tooltip="The maximum amount to generate per request \nthat this worker will accept jobs for.") - horde_context_entry, horde_context_label = makelabelentry(horde_tab, "Max Context:",horde_context_var, 22, 50,tooltip="The maximum context length \nthat this worker will accept jobs for.") + horde_gen_entry, horde_gen_label = makelabelentry(horde_tab, "Gen. Length:", horde_gen_var, 21, 50,tooltip="The maximum amount to generate per request that this worker will accept jobs for.") + horde_context_entry, horde_context_label = makelabelentry(horde_tab, "Max Context:",horde_context_var, 22, 50,tooltip="The maximum context length that this worker will accept jobs for.\nIf 0, matches main context limit.") horde_apikey_entry, horde_apikey_label = makelabelentry(horde_tab, "API Key (If Embedded Worker):",horde_apikey_var, 23, 180,tooltip="Your AI Horde API Key that you have registered.") horde_workername_entry, horde_workername_label = makelabelentry(horde_tab, "Horde Worker Name:",horde_workername_var, 24, 180,tooltip="Your worker's name to be displayed.") @@ -5431,7 +5431,7 @@ def run_horde_worker(args, api_key, worker_name): "name": worker_name, "models": [friendlymodelname], "max_length": maxhordelen, - "max_context_length": min(maxctx,maxhordectx), + "max_context_length": min(maxctx,(maxctx if maxhordectx==0 else maxhordectx)), "priority_usernames": [], "softprompts": [], "bridge_agent": BRIDGE_AGENT, @@ -6177,7 +6177,7 @@ def kcpp_main_process(launch_args, g_memory=None, gui_launcher=False): args.debugmode = -1 if args.hordegenlen and args.hordegenlen > 0: maxhordelen = int(args.hordegenlen) - if args.hordemaxctx and args.hordemaxctx > 0: + if args.hordemaxctx and args.hordemaxctx >= 0: maxhordectx = int(args.hordemaxctx) if args.debugmode != 1: @@ -6815,7 +6815,7 @@ if __name__ == '__main__': hordeparsergroup.add_argument("--hordemodelname", metavar=('[name]'), help="Sets your AI Horde display model name.", default="") hordeparsergroup.add_argument("--hordeworkername", metavar=('[name]'), help="Sets your AI Horde worker name.", default="") hordeparsergroup.add_argument("--hordekey", metavar=('[apikey]'), help="Sets your AI Horde API key.", default="") - hordeparsergroup.add_argument("--hordemaxctx", metavar=('[amount]'), help="Sets the maximum context length your worker will accept from an AI Horde job.", type=int, default=0) + hordeparsergroup.add_argument("--hordemaxctx", metavar=('[amount]'), help="Sets the maximum context length your worker will accept from an AI Horde job. If 0, matches main context limit.", type=int, default=0) hordeparsergroup.add_argument("--hordegenlen", metavar=('[amount]'), help="Sets the maximum number of tokens your worker will generate from an AI horde job.", type=int, default=0) sdparsergroup = parser.add_argument_group('Image Generation Commands')