Safe sequence breakers parse

This commit is contained in:
Cohee 2024-10-28 11:39:59 +00:00
parent ef3cb73477
commit 542f77aeb8
1 changed files with 2 additions and 1 deletions

View File

@ -1307,12 +1307,13 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
: [];
const tokenBans = toIntArray(banned_tokens);
logitBiasArray.push(...tokenBans.map(x => [Number(x), false]));
const sequenceBreakers = (() => { try { return JSON.parse(params.dry_sequence_breakers); } catch { return undefined; } })();
const llamaCppParams = {
'logit_bias': logitBiasArray,
// Conflicts with ooba's grammar_string
'grammar': settings.grammar_string,
'cache_prompt': true,
'dry_sequence_breakers': JSON.parse(params.dry_sequence_breakers),
'dry_sequence_breakers': sequenceBreakers,
};
params = Object.assign(params, llamaCppParams);
}