allow launching with no models loaded

This commit is contained in:
Concedo 2024-08-25 23:57:32 +08:00
parent efb8be013e
commit 97aa8648ed
2 changed files with 59 additions and 9 deletions

View file

@ -2199,7 +2199,7 @@ def show_gui():
root.quit()
if args.model_param and args.model_param!="" and (args.model_param.lower().endswith('.kcpps') or args.model_param.lower().endswith('.kcppt')):
load_config_cli(args.model_param)
if not args.model_param and not args.sdmodel and not args.whispermodel:
if not args.model_param and not args.sdmodel and not args.whispermodel and not args.nomodel:
global exitcounter
exitcounter = 999
exit_with_error(2,"No ggml model or kcpps file was selected. Exiting.")
@ -2364,6 +2364,7 @@ def show_gui():
lora_base_var = ctk.StringVar()
preloadstory_var = ctk.StringVar()
mmproj_var = ctk.StringVar()
nomodel = ctk.IntVar(value=0)
port_var = ctk.StringVar(value=defaultport)
host_var = ctk.StringVar(value="")
@ -2829,6 +2830,7 @@ def show_gui():
ctk.CTkButton(model_tab, 64, text="Pick Premade", command=pickpremadetemplate).grid(row=13, column=0, padx=322, stick="nw")
mmproj_var.trace("w", gui_changed_modelfile)
makecheckbox(model_tab, "Allow Launch Without Models", nomodel, 15, tooltiptxt="Allows running the WebUI with no model loaded.")
# Network Tab
network_tab = tabcontent["Network"]
@ -2959,7 +2961,7 @@ def show_gui():
# launch
def guilaunch():
if model_var.get() == "" and sd_model_var.get() == "" and whisper_model_var.get() == "":
if model_var.get() == "" and sd_model_var.get() == "" and whisper_model_var.get() == "" and nomodel.get()!=1:
tmp = askopenfilename(title="Select ggml model .bin or .gguf file")
model_var.set(tmp)
nonlocal nextstate
@ -2983,6 +2985,7 @@ def show_gui():
args.foreground = keepforeground.get()==1
args.quiet = quietmode.get()==1
args.nocertify = nocertifymode.get()==1
args.nomodel = nomodel.get()==1
if contextshift.get()==0 and flashattention.get()==1:
args.quantkv = quantkv_var.get()
else:
@ -3120,6 +3123,7 @@ def show_gui():
keepforeground.set(1 if "foreground" in dict and dict["foreground"] else 0)
quietmode.set(1 if "quiet" in dict and dict["quiet"] else 0)
nocertifymode.set(1 if "nocertify" in dict and dict["nocertify"] else 0)
nomodel.set(1 if "nomodel" in dict and dict["nomodel"] else 0)
if "quantkv" in dict:
quantkv_var.set(dict["quantkv"])
if "useclblast" in dict and dict["useclblast"]:
@ -3310,7 +3314,7 @@ def show_gui():
kcpp_exporting_template = False
export_vars()
if not args.model_param and not args.sdmodel and not args.whispermodel:
if not args.model_param and not args.sdmodel and not args.whispermodel and not args.nomodel:
exitcounter = 999
exit_with_error(2,"No text or image model file was selected. Exiting.")
@ -3825,7 +3829,7 @@ def main(launch_args,start_server=True):
if not args.model_param:
args.model_param = args.model
if not args.model_param and not args.sdmodel and not args.whispermodel:
if not args.model_param and not args.sdmodel and not args.whispermodel and not args.nomodel:
#give them a chance to pick a file
print("For command line arguments, please refer to --help")
print("***")
@ -4407,7 +4411,7 @@ if __name__ == '__main__':
advparser.add_argument("--forceversion", help="If the model file format detection fails (e.g. rogue modified model) you can set this to override the detected format (enter desired version, e.g. 401 for GPTNeoX-Type2).",metavar=('[version]'), type=int, default=0)
advparser.add_argument("--smartcontext", help="Reserving a portion of context to try processing less frequently. Outdated. Not recommended.", action='store_true')
advparser.add_argument("--unpack", help="Extracts the file contents of the KoboldCpp binary into a target directory.", metavar=('destination'), type=str, default="")
advparser.add_argument("--nomodel", help="Allows you to launch the GUI alone, without selecting any model.", action='store_true')
hordeparsergroup = parser.add_argument_group('Horde Worker Commands')
hordeparsergroup.add_argument("--hordemodelname", metavar=('[name]'), help="Sets your AI Horde display model name.", default="")