Fix logit bias with best match tokenizer Fixes #5017

e77c1d33a67d3fd0873acbcbea3069b7d49a167d

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +9 -1Ignore whitespace
public/scripts/textgen-settings.js+9 -1
@@ -24,7 +24,7 @@ import { getActiveManualApiSamplers, loadApiSelectedSamplers, isSamplerManualPri
2424import { SECRET_KEYS, writeSecret } from './secrets.js';
2525import { getEventSourceStream } from './sse-stream.js';
2626import { getCurrentDreamGenModelTokenizer, getCurrentOpenRouterModelTokenizer, loadAphroditeModels, loadDreamGenModels, loadFeatherlessModels, loadGenericModels, loadInfermaticAIModels, loadLlamaCppModels, loadMancerModels, loadOllamaModels, loadOpenRouterModels, loadTabbyModels, loadTogetherAIModels, loadVllmModels } from './textgen-models.js';
2727import { ENCODE_TOKENIZERS, TEXTGEN_TOKENIZERS, TOKENIZER_SUPPORTED_KEY, getTextTokens, getTokenizerBestMatch, tokenizers } from './tokenizers.js';
2828import { AbortReason } from './util/AbortReason.js';
2929import { getSortableDelay, onlyUnique, arraysEqual, isObject } from './utils.js';
3030
@@ -403,6 +403,11 @@ function convertPresets(presets) {
403403}
404404
405405function getTokenizerForTokenIds() {
406+ const bestMatchTokenizer = getTokenizerBestMatch('textgenerationwebui');
407+ if (bestMatchTokenizer === tokenizers.API_TEXTGENERATIONWEBUI) {
408+ return tokenizers.API_CURRENT;
409+ }
410+
406411 if (power_user.tokenizer === tokenizers.API_CURRENT && TEXTGEN_TOKENIZERS.includes(textgenerationwebui_settings.type)) {
407412 return tokenizers.API_CURRENT;
408413 }
@@ -658,6 +663,9 @@ async function getStatusTextgen() {
658663 return resultCheckStatus();
659664 }
660665
666+ // Clear logit bias cache
667+ BIAS_CACHE.delete(BIAS_KEY);
668+
661669 if ([textgen_types.GENERIC, textgen_types.OOBA].includes(textgenerationwebui_settings.type) && textgenerationwebui_settings.bypass_status_check) {
662670 setOnlineStatus(t`Status check bypassed`);
663671 return resultCheckStatus();