Skip to content

Commit a5a5839

Browse files
committed
handle accidentally selecting a kcpps file as model instead
1 parent 8602f5a commit a5a5839

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Diff for: koboldcpp.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -1196,6 +1196,15 @@ def auto_gpu_heuristics():
11961196
changed_gpu_choice_var()
11971197
return
11981198

1199+
def on_picked_model_file(filepath):
1200+
if filepath.lower().endswith('.kcpps'):
1201+
#load it as a config file instead
1202+
with open(filepath, 'r') as f:
1203+
dict = json.load(f)
1204+
import_vars(dict)
1205+
else:
1206+
autoset_gpu_layers(filepath)
1207+
11991208
def autoset_gpu_layers(filepath): #shitty algo to determine how many layers to use
12001209
try:
12011210
global gui_layers_untouched
@@ -1370,7 +1379,7 @@ def changerunmode(a,b,c):
13701379
makeslider(quick_tab, "Context Size:", contextsize_text, context_var, 0, len(contextsize_text)-1, 30, set=3)
13711380

13721381
# load model
1373-
makefileentry(quick_tab, "Model:", "Select GGML Model File", model_var, 40, 170, onchoosefile=autoset_gpu_layers)
1382+
makefileentry(quick_tab, "Model:", "Select GGML Model File", model_var, 40, 170, onchoosefile=on_picked_model_file)
13741383

13751384
# Hardware Tab
13761385
hardware_tab = tabcontent["Hardware"]
@@ -1441,7 +1450,7 @@ def togglerope(a,b,c):
14411450
# Model Tab
14421451
model_tab = tabcontent["Model"]
14431452

1444-
makefileentry(model_tab, "Model:", "Select GGML Model File", model_var, 1, onchoosefile=autoset_gpu_layers)
1453+
makefileentry(model_tab, "Model:", "Select GGML Model File", model_var, 1, onchoosefile=on_picked_model_file)
14451454
makefileentry(model_tab, "Lora:", "Select Lora File",lora_var, 3)
14461455
makefileentry(model_tab, "Lora Base:", "Select Lora Base File", lora_base_var, 5)
14471456
makefileentry(model_tab, "Preloaded Story:", "Select Preloaded Story File", preloadstory_var, 7)

0 commit comments

Comments
 (0)