mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2025-09-10 17:14:36 +00:00
allow launching with no models loaded
This commit is contained in:
parent
efb8be013e
commit
97aa8648ed
2 changed files with 59 additions and 9 deletions
54
klite.embd
54
klite.embd
|
@ -12,7 +12,7 @@ Current version indicated by LITEVER below.
|
|||
-->
|
||||
|
||||
<script>
|
||||
const LITEVER = 169;
|
||||
const LITEVER = 171;
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const localflag = true;
|
||||
const STORAGE_PREFIX = (localflag?"e_":"")+"kaihordewebui_";
|
||||
|
@ -8524,7 +8524,7 @@ Current version indicated by LITEVER below.
|
|||
koboldcpp_has_whisper = (data.transcribe?true:false);
|
||||
let has_password = (data.protected?true:false);
|
||||
let has_txt2img = (data.txt2img?true:false);
|
||||
let no_model = (mdlname=="inactive");
|
||||
let no_txt_model = (mdlname=="inactive");
|
||||
|
||||
//also check against kcpp's max true context length
|
||||
fetch(apply_proxy_url(desiredkoboldendpoint + koboldcpp_truemaxctxlen_endpoint),
|
||||
|
@ -8615,13 +8615,17 @@ Current version indicated by LITEVER below.
|
|||
}
|
||||
},false,false,true);
|
||||
}
|
||||
else if(localflag && has_txt2img && no_model && safe_to_overwrite())
|
||||
else if(localflag && has_txt2img && no_txt_model && safe_to_overwrite())
|
||||
{
|
||||
msgboxYesNo("This KoboldCpp instance seems to be running an Image Generation model without any Text Generation model loaded.\n\nWould you like to launch StableUI (Dedicated Image Generation WebUI bundled with KoboldCpp)?\n\nIf unsure, select 'No'.","Launch StableUI?", ()=>{
|
||||
go_to_stableui();
|
||||
},()=>{
|
||||
});
|
||||
}
|
||||
else if(localflag && no_txt_model && !has_txt2img && !koboldcpp_has_vision && !koboldcpp_has_whisper)
|
||||
{
|
||||
msgbox("This KoboldCpp instance has no models loaded. You can still use the WebUI to edit or view existing stories.<br><br>You can also <a href='#' class='color_blueurl' onclick='hide_popups();display_endpoint_container();'>connect to an external service</a> instead","No Models Loaded",true);
|
||||
}
|
||||
|
||||
}else{
|
||||
console.log("Unknown KoboldCpp Check Response: " + data);
|
||||
|
@ -11018,10 +11022,52 @@ Current version indicated by LITEVER below.
|
|||
}
|
||||
|
||||
|
||||
var dragdropimgsetup = false;
|
||||
function add_img_btn_paste()
|
||||
{
|
||||
document.getElementById("addimgcontainer").classList.add("hidden");
|
||||
document.getElementById("pasteimgcontainer").classList.remove("hidden");
|
||||
|
||||
if(!dragdropimgsetup)
|
||||
{
|
||||
const dropZone = document.getElementById('pasteimgwin');
|
||||
const onDropFn = function(e){
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
let draggedData = e.dataTransfer;
|
||||
let files = draggedData.files;
|
||||
|
||||
console.log(files);
|
||||
if (files.length > 0 && files[0] != null && files[0].name && files[0].name != "") {
|
||||
const file = files[0];
|
||||
const reader = new FileReader();
|
||||
reader.onload = function(img) {
|
||||
let origImg = img.target.result;
|
||||
self_upload_img(origImg);
|
||||
}
|
||||
reader.readAsDataURL(file);
|
||||
document.getElementById("pasteimgcontainer").classList.add("hidden");
|
||||
}
|
||||
}
|
||||
|
||||
dropZone.addEventListener(
|
||||
"dragover",
|
||||
(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
},
|
||||
false
|
||||
);
|
||||
dropZone.addEventListener(
|
||||
"drop",
|
||||
(e) => {
|
||||
onDropFn(e);
|
||||
},
|
||||
false
|
||||
);
|
||||
dragdropimgsetup = true;
|
||||
}
|
||||
}
|
||||
|
||||
function add_img_btn_upload()
|
||||
|
@ -12001,7 +12047,7 @@ Current version indicated by LITEVER below.
|
|||
seqs = [st, et];
|
||||
if(localsettings.fix_alpaca_leak && st.toLowerCase().includes("### instruction"))
|
||||
{
|
||||
seqs.push("\n\n### ");
|
||||
seqs.push("\n### ");
|
||||
}
|
||||
if(localsettings.inject_chatnames_instruct)
|
||||
{
|
||||
|
|
14
koboldcpp.py
14
koboldcpp.py
|
@ -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="")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue