Add "Best match" tokenizer option

This commit is contained in:
Cohee
2023-08-04 14:17:05 +03:00
parent 14827d6135
commit 84283bc2b4
4 changed files with 31 additions and 6 deletions

View File

@ -546,6 +546,25 @@ async function getClientVersion() {
}
}
function getTokenizerBestMatch() {
if (main_api === 'novel') {
if (nai_settings.model_novel.includes('krake') || nai_settings.model_novel.includes('euterpe')) {
return tokenizers.CLASSIC;
}
if (nai_settings.model_novel.includes('clio')) {
return tokenizers.NERD;
}
if (nai_settings.model_novel.includes('kayra')) {
return tokenizers.NERD2;
}
}
if (main_api === 'kobold' || main_api === 'textgenerationwebui' || main_api === 'koboldhorde') {
return tokenizers.LLAMA;
}
return power_user.NONE;
}
function getTokenCount(str, padding = undefined) {
if (typeof str !== 'string') {
return 0;
@ -563,6 +582,10 @@ function getTokenCount(str, padding = undefined) {
}
}
if (tokenizerType === tokenizers.BEST_MATCH) {
tokenizerType = getTokenizerBestMatch();
}
if (padding === undefined) {
padding = 0;
}
@ -7729,7 +7752,7 @@ $(document).ready(function () {
const enabled = $("#use-mancer-api-checkbox").prop("checked");
$("#mancer-api-ui").toggle(enabled);
api_use_mancer_webui = enabled;
saveSettingsDebounced();
saveSettingsDebounced();
getStatus();
});