Skip to content

Commit 11bc832

Browse files
authored
fix: Autoswap with override configs (#2091)
* fix: Autoswap with overrides * fix: Autoswap with overrides
1 parent 376aaf2 commit 11bc832

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

embd_res/klite.embd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31295,11 +31295,11 @@ Current version indicated by LITEVER below.
3129531295
<b class="color_white" style="padding: 5px;">Change Loaded Model / Config:</b><br>
3129631296
<div class="color_white" style="padding: 5px;">
3129731297
<div style="padding-top:3px">
31298-
Select New Target: <select title="Select New Config" style="padding:4px; width:100%" class="form-control" id="adminconfigdropdown">
31298+
Select Primary Target: <select title="Select New Config" style="padding:4px; width:100%" class="form-control" id="adminconfigdropdown">
3129931299
</select>
3130031300
</div>
3130131301
<div style="padding-top:3px">
31302-
Select Base Config: <select title="Override Config" style="padding:4px; width:100%" class="form-control" id="adminconfigoverridedropdown">
31302+
Select Secondary Target (optional): <select title="Override Config" style="padding:4px; width:100%" class="form-control" id="adminconfigoverridedropdown">
3130331303
</select>
3130431304
</div>
3130531305
<div style="display:flex; padding: 5px; justify-content: center;">

koboldcpp.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
KcppVersion = "1.111.1"
7575
showdebug = True
7676
kcpp_instance = None #global running instance
77-
global_memory = {"tunnel_url": "", "restart_target":"", "input_to_exit":False, "load_complete":False, "restart_override_config_target":"", "last_active_timestamp":datetime.now(), "triggered_sleeping":False, "current_model":"initial_model", "swapReqType": None, "autoswapmode": False}
77+
global_memory = {"tunnel_url": "", "restart_target":"", "input_to_exit":False, "load_complete":False, "restart_override_config_target":"", "last_active_timestamp":datetime.now(), "triggered_sleeping":False, "current_model":"initial_model", "current_override":"", "swapReqType": None, "autoswapmode": False}
7878
using_gui_launcher = False
7979

8080
handle = None
@@ -4075,7 +4075,7 @@ def _handle(self):
40754075

40764076
if (global_memory["swapReqType"] is not None and swapModeChanged):
40774077
with proxy_reload_lock:
4078-
reqbody = json.dumps({"filename":global_memory["current_model"]})
4078+
reqbody = json.dumps({"filename":global_memory["current_model"], "overrideconfig": global_memory["current_override"]})
40794079
reqheaders = {
40804080
'Content-Type': 'application/json',
40814081
'Content-Length': str(len(reqbody)),
@@ -9454,7 +9454,7 @@ def main(launch_args, default_args):
94549454
input()
94559455
else: # manager command queue for admin mode
94569456
with multiprocessing.Manager() as mp_manager:
9457-
global_memory = mp_manager.dict({"tunnel_url": "", "restart_target":"", "input_to_exit":False, "load_complete":False, "restart_override_config_target":"", "last_active_timestamp":datetime.now(), "triggered_sleeping":False, "current_model":"initial_model", "swapReqType": None, "autoswapmode": False})
9457+
global_memory = mp_manager.dict({"tunnel_url": "", "restart_target":"", "input_to_exit":False, "load_complete":False, "restart_override_config_target":"", "last_active_timestamp":datetime.now(), "triggered_sleeping":False, "current_model":"initial_model", "current_override":"", "swapReqType": None, "autoswapmode": False})
94589458

94599459
if args.remotetunnel and not args.prompt and not args.benchmark and not args.cli:
94609460
setuptunnel(global_memory, True if args.sdmodel else False)
@@ -9558,6 +9558,10 @@ def main(launch_args, default_args):
95589558
kcpp_instance.daemon = True
95599559
kcpp_instance.start()
95609560
global_memory["restart_target"] = ""
9561+
if (restart_override_config_target and restart_override_config_target!=""):
9562+
global_memory["current_override"] = restart_override_config_target
9563+
else:
9564+
global_memory["current_override"] = ""
95619565
global_memory["restart_override_config_target"] = ""
95629566
global_memory["current_model"] = restart_target
95639567
time.sleep(3)

0 commit comments

Comments
 (0)