llamacpp broke

This commit is contained in:
Cohee
2024-05-12 21:41:07 +03:00
parent 4ccedb939c
commit c7d75b7789

View File

@ -373,7 +373,7 @@ function getCustomTokenBans() {
} else if (line.startsWith('"') && line.endsWith('"')) { } else if (line.startsWith('"') && line.endsWith('"')) {
// Remove the enclosing quotes // Remove the enclosing quotes
banned_strings.push(line.slice(1, -1)) banned_strings.push(line.slice(1, -1));
} else { } else {
try { try {
const tokens = getTextTokens(tokenizer, line); const tokens = getTextTokens(tokenizer, line);
@ -1137,7 +1137,7 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
const logitBiasArray = (params.logit_bias && typeof params.logit_bias === 'object' && Object.keys(params.logit_bias).length > 0) const logitBiasArray = (params.logit_bias && typeof params.logit_bias === 'object' && Object.keys(params.logit_bias).length > 0)
? Object.entries(params.logit_bias).map(([key, value]) => [Number(key), value]) ? Object.entries(params.logit_bias).map(([key, value]) => [Number(key), value])
: []; : [];
const tokenBans = toIntArray(getCustomTokenBans()); const tokenBans = toIntArray(banned_tokens);
logitBiasArray.push(...tokenBans.map(x => [Number(x), false])); logitBiasArray.push(...tokenBans.map(x => [Number(x), false]));
const llamaCppParams = { const llamaCppParams = {
'logit_bias': logitBiasArray, 'logit_bias': logitBiasArray,