mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Backport llama.cpp-related DRY fixes from staging (#3051)
* llama.cpp Enable dry w/ array convert The new PR that was merged needs an array instead of a str https://github.com/ggerganov/llama.cpp/pull/9702 * Safe sequence breakers parse * Support comma-separated list of llama.cpp sequence breakers #3026 --------- Co-authored-by: Beinsezii <beinsezii@gmail.com>
This commit is contained in:
@ -1307,11 +1307,23 @@ 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 {
|
||||
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
|
||||
'grammar': settings.grammar_string,
|
||||
'cache_prompt': true,
|
||||
'dry_sequence_breakers': sequenceBreakers,
|
||||
};
|
||||
params = Object.assign(params, llamaCppParams);
|
||||
}
|
||||
|
Reference in New Issue
Block a user