mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2026-09-17 08:19:49 +02:00
fixed token counting limit (+1 squashed commits)
Squashed commits: [314528eb2] fixed token counting limit, set to max supported ctx of 256k
This commit is contained in:
+5
-1
@@ -2828,7 +2828,11 @@ def music_generate_audio(genparams):
|
||||
|
||||
def tokenize_ids(countprompt,tcaddspecial):
|
||||
rawcountdata = handle.token_count(countprompt.encode("UTF-8"),tcaddspecial)
|
||||
countlimit = rawcountdata.count if (rawcountdata.count>=0 and rawcountdata.count<50000) else 0
|
||||
count = rawcountdata.count
|
||||
hardlimit = (2**31) - 1
|
||||
countlimit = count if (count>=0 and count<=hardlimit) else 0
|
||||
if count > hardlimit:
|
||||
utfprint("Warning: TokenCount exceeds max limit.")
|
||||
# the above protects the server in case the count limit got corrupted
|
||||
countdata = [rawcountdata.ids[i] for i in range(countlimit)]
|
||||
return countdata
|
||||
|
||||
Reference in New Issue
Block a user