Support comma-separated list of llama.cpp sequence breakers #3026

This commit is contained in:
Cohee 2024-10-28 11:44:26 +00:00
parent 542f77aeb8
commit 00f0f755fc

View File

@ -1307,7 +1307,17 @@ 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 sequenceBreakers = (() => {
try {
return JSON.parse(params.dry_sequence_breakers);
} catch {
if (typeof params.dry_sequence_breakers === 'string') {
return params.dry_sequence_breakers.split(',');
}
return undefined;
}
})();
const llamaCppParams = {
'logit_bias': logitBiasArray,
// Conflicts with ooba's grammar_string