Skip to content

Commit e85557f

Browse files
committed
launcher for rope
1 parent 39dc1a4 commit e85557f

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

koboldcpp.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,10 @@ def getfilename(var, text):
764764

765765
context_var = ctk.IntVar()
766766

767+
customrope_var = ctk.IntVar()
768+
customrope_scale = ctk.StringVar(value="1.0")
769+
customrope_base = ctk.StringVar(value="10000")
770+
767771
model_var = ctk.StringVar()
768772
lora_var = ctk.StringVar()
769773
lora_base_var = ctk.StringVar()
@@ -904,6 +908,19 @@ def togglemiro(a,b,c):
904908
# context size
905909
makeslider(tokens_tab, "Context Size:",contextsize_text, context_var, 0, 4, 20, set=2)
906910

911+
912+
customrope_scale_entry, customrope_scale_label = makelabelentry(tokens_tab, "RoPE Scale:", customrope_scale)
913+
customrope_base_entry, customrope_base_label = makelabelentry(tokens_tab, "RoPE Base:", customrope_base)
914+
def togglerope(a,b,c):
915+
items = [customrope_scale_label, customrope_scale_entry,customrope_base_label, customrope_base_entry]
916+
for idx, item in enumerate(items):
917+
if customrope_var.get() == 1:
918+
item.grid(row=23 + int(idx/2), column=idx%2, padx=8, stick="nw")
919+
else:
920+
item.grid_forget()
921+
makecheckbox(tokens_tab, "Custom RoPE Config", variable=customrope_var, row=22, command=togglerope)
922+
togglerope(1,1,1)
923+
907924
# Model Tab
908925
model_tab = tabcontent["Model"]
909926

@@ -996,6 +1013,9 @@ def export_vars():
9961013
args.mirostat = [int(mirostat_var.get()), float(mirostat_tau.get()), float(mirostat_eta.get())] if usemirostat.get()==1 else None
9971014
args.contextsize = int(contextsize_text[context_var.get()])
9981015

1016+
if customrope_var.get()==1:
1017+
args.ropeconfig = [float(customrope_scale.get()),float(customrope_base.get())]
1018+
9991019
args.model_param = None if model_var.get() == "" else model_var.get()
10001020
args.lora = None if lora_var.get() == "" else ([lora_var.get()] if lora_base_var.get()=="" else [lora_var.get(), lora_base_var.get()])
10011021

@@ -1046,6 +1066,15 @@ def import_vars(dict):
10461066

10471067
if dict["contextsize"]:
10481068
context_var.set(contextsize_text.index(str(dict["contextsize"])))
1069+
1070+
if dict["ropeconfig"] and len(dict["ropeconfig"])>1:
1071+
if dict["ropeconfig"][0]>0:
1072+
customrope_var.set(1)
1073+
customrope_scale.set(str(dict["ropeconfig"][0]))
1074+
customrope_base.set(str(dict["ropeconfig"][1]))
1075+
else:
1076+
customrope_var.set(0)
1077+
10491078
if dict["blasbatchsize"]:
10501079
blas_size_var.set(blasbatchsize_values.index(str(dict["blasbatchsize"])))
10511080
if dict["forceversion"]:

0 commit comments

Comments
 (0)