From 6e6043fffea255c829f98c8581e93265e67cfc5a Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Fri, 14 Feb 2025 11:34:43 +0800 Subject: [PATCH] fixed autoguess breaking img gen --- koboldcpp.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/koboldcpp.py b/koboldcpp.py index 0d2d959e0..0ed444e28 100644 --- a/koboldcpp.py +++ b/koboldcpp.py @@ -5355,21 +5355,22 @@ def kcpp_main_process(launch_args, g_memory=None, gui_launcher=False): exitcounter = 999 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 # Try to derive chat completions adapter from chat template, now that we have the model loaded - ctbytes = handle.get_chat_template() - chat_template = ctypes.string_at(ctbytes).decode("UTF-8","ignore") - candidates = chatcompl_adapter - chatcompl_adapter = None - if chat_template != "": - for entry in candidates: - if all(s in chat_template for s in entry['search']): - print(f"Chat completion heuristic: {entry['name']}") - chatcompl_adapter = entry['adapter'] - break - if chatcompl_adapter is None: - print("Chat template heuristics failed to identify chat completions format. Alpaca will be used.") + chatcompl_adapter = None #if no text model loaded, erase the list. + if not args.nomodel and args.model_param: + ctbytes = handle.get_chat_template() + chat_template = ctypes.string_at(ctbytes).decode("UTF-8","ignore") + candidates = chatcompl_adapter + if chat_template != "": + for entry in candidates: + if all(s in chat_template for s in entry['search']): + print(f"Chat completion heuristic: {entry['name']}") + chatcompl_adapter = entry['adapter'] + break + if chatcompl_adapter is None: + print("Chat template heuristics failed to identify chat completions format. Alpaca will be used.") #handle loading image model if args.sdmodel and args.sdmodel!="":