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>

a3ca407b2714df5af5a9f83aa925fd64fb778e24

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

Signed
2 files changed, +13 -2Ignore whitespace
public/index.html+1 -2
@@ -1397,8 +1397,7 @@
13971397 </div>
13981398 </div>
13991399
1400- <!-- Enable for llama.cpp when the PR is merged: https://github.com/ggerganov/llama.cpp/pull/6839 -->
1400+ <div data-tg-type="ooba, koboldcpp, tabby, llamacpp" id="dryBlock" class="wide100p">
1401- <div data-tg-type="ooba, koboldcpp, tabby" id="dryBlock" class="wide100p">
14021401 <h4 class="wide100p textAlignCenter" title="DRY penalizes tokens that would extend the end of the input into a sequence that has previously occurred in the input. Set multiplier to 0 to disable." data-i18n="[title]DRY_Repetition_Penalty_desc">
14031402 <label data-i18n="DRY Repetition Penalty">DRY Repetition Penalty</label>
14041403 <a href="https://github.com/oobabooga/text-generation-webui/pull/5677" target="_blank">
public/scripts/textgen-settings.js+12 -0
@@ -1307,11 +1307,23 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
13071307 : [];
13081308 const tokenBans = toIntArray(banned_tokens);
13091309 logitBiasArray.push(...tokenBans.map(x => [Number(x), false]));
1310+ const sequenceBreakers = (() => {
1311+ try {
1312+ return JSON.parse(params.dry_sequence_breakers);
1313+ } catch {
1314+ if (typeof params.dry_sequence_breakers === 'string') {
1315+ return params.dry_sequence_breakers.split(',');
1316+ }
1317+
1318+ return undefined;
1319+ }
1320+ })();
13101321 const llamaCppParams = {
13111322 'logit_bias': logitBiasArray,
13121323 // Conflicts with ooba's grammar_string
13131324 'grammar': settings.grammar_string,
13141325 'cache_prompt': true,
1326+ 'dry_sequence_breakers': sequenceBreakers,
13151327 };
13161328 params = Object.assign(params, llamaCppParams);
13171329 }