Skip to content

Commit 955cf66

Browse files
committed
load embedding at current maxctx instead of max trained ctx by default
1 parent 06a3ee4 commit 955cf66

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

klite.embd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3431,6 +3431,7 @@ Current version indicated by LITEVER below.
34313431

34323432
max_context_length: (localflag?4096:3072),
34333433
max_length: (localflag?512:256),
3434+
last_maxctx: 0,
34343435
auto_ctxlen: true,
34353436
auto_genamt: true,
34363437
rep_pen: 1.06,
@@ -11156,9 +11157,10 @@ Current version indicated by LITEVER below.
1115611157
document.getElementById("max_length_slide").max = 4096;
1115711158
document.getElementById("max_length_slide_label").innerText = 4096;
1115811159
}
11159-
if(localflag && localsettings.max_context_length==defaultsettings.max_context_length && ep_maxctx>4096)
11160+
if(localflag && ep_maxctx>=4096 && localsettings.max_context_length<ep_maxctx && (localsettings.last_maxctx!=ep_maxctx || localsettings.max_context_length==defaultsettings.max_context_length))
1116011161
{
1116111162
localsettings.max_context_length = ep_maxctx;
11163+
localsettings.last_maxctx = ep_maxctx;
1116211164
}
1116311165
}).catch(error => {
1116411166
console.log("Failed to get true max ctx: " + error);

koboldcpp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1901,7 +1901,7 @@ def embeddings_load_model(model_filename):
19011901
inputs.flash_attention = False
19021902
inputs.threads = args.threads
19031903
inputs.use_mmap = args.usemmap
1904-
inputs.embeddingsmaxctx = args.embeddingsmaxctx
1904+
inputs.embeddingsmaxctx = (args.embeddingsmaxctx if args.embeddingsmaxctx else args.contextsize) # for us to clamp to contextsize if embeddingsmaxctx unspecified
19051905
inputs = set_backend_props(inputs)
19061906
ret = handle.embeddings_load_model(inputs)
19071907
return ret

0 commit comments

Comments
 (0)