fixed autoguess breaking img gen

This commit is contained in:
Concedo 2025-02-14 11:34:43 +08:00
parent 39fad991cc
commit 6e6043fffe

View file

@ -5355,13 +5355,14 @@ def kcpp_main_process(launch_args, g_memory=None, gui_launcher=False):
exitcounter = 999 exitcounter = 999
exit_with_error(3,"Could not load text model: " + modelname) exit_with_error(3,"Could not load text model: " + modelname)
if (chatcompl_adapter is not None and isinstance(chatcompl_adapter, list) and not args.nomodel and args.model_param): if (chatcompl_adapter is not None and isinstance(chatcompl_adapter, list)):
# The chat completions adapter is a list that needs derivation from chat templates # The chat completions adapter is a list that needs derivation from chat templates
# Try to derive chat completions adapter from chat template, now that we have the model loaded # Try to derive chat completions adapter from chat template, now that we have the model loaded
chatcompl_adapter = None #if no text model loaded, erase the list.
if not args.nomodel and args.model_param:
ctbytes = handle.get_chat_template() ctbytes = handle.get_chat_template()
chat_template = ctypes.string_at(ctbytes).decode("UTF-8","ignore") chat_template = ctypes.string_at(ctbytes).decode("UTF-8","ignore")
candidates = chatcompl_adapter candidates = chatcompl_adapter
chatcompl_adapter = None
if chat_template != "": if chat_template != "":
for entry in candidates: for entry in candidates:
if all(s in chat_template for s in entry['search']): if all(s in chat_template for s in entry['search']):