Textgen: Add repetition decay for TabbyAPI

Repetition decay softens the drop off for repetition penalty. It's
best paired with rep pen range.

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri 2024-05-22 00:09:10 -04:00
parent 99d143263d
commit 74b6ed97c2
2 changed files with 9 additions and 0 deletions

View File

@ -1224,6 +1224,11 @@
<input class="neo-range-slider" type="range" id="rep_pen_range_textgenerationwebui" name="volume" min="-1" max="8192" step="1">
<input class="neo-range-input" type="number" min="-1" max="8192" step="1" data-for="rep_pen_range_textgenerationwebui" id="rep_pen_range_counter_textgenerationwebui">
</div>
<div data-tg-type="tabby" class="alignitemscenter flex-container flexFlowColumn flexBasis30p flexGrow flexShrink gap0">
<small data-i18n="rep.pen decay">Rep Pen Decay</small>
<input class="neo-range-slider" type="range" id="rep_pen_decay_textgenerationwebui" name="volume" min="-1" max="8192" step="1">
<input class="neo-range-input" type="number" min="-1" max="8192" step="1" data-for="rep_pen_decay_textgenerationwebui" id="rep_pen_decay_counter_textgenerationwebui">
</div>
<div data-tg-type="ooba" data-newbie-hidden class="alignitemscenter flex-container flexFlowColumn flexBasis30p flexGrow flexShrink gap0">
<small data-i18n="Encoder Rep. Pen.">Encoder Penalty</small>
<input class="neo-range-slider" type="range" id="encoder_rep_pen_textgenerationwebui" name="volume" min="0.8" max="1.5" step="0.01" />

View File

@ -100,6 +100,7 @@ const settings = {
min_p: 0,
rep_pen: 1.2,
rep_pen_range: 0,
rep_pen_decay: 0,
no_repeat_ngram_size: 0,
penalty_alpha: 0,
num_beams: 1,
@ -173,6 +174,7 @@ export const setting_names = [
'temperature_last',
'rep_pen',
'rep_pen_range',
'rep_pen_decay',
'no_repeat_ngram_size',
'top_k',
'top_p',
@ -642,6 +644,7 @@ jQuery(function () {
'min_p_textgenerationwebui': 0,
'rep_pen_textgenerationwebui': 1,
'rep_pen_range_textgenerationwebui': 0,
'rep_pen_decay_textgenerationwebui': 0,
'dynatemp_textgenerationwebui': false,
'seed_textgenerationwebui': -1,
'ban_eos_token_textgenerationwebui': false,
@ -1062,6 +1065,7 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
const nonAphroditeParams = {
'rep_pen': settings.rep_pen,
'rep_pen_range': settings.rep_pen_range,
'repetition_decay': settings.type === TABBY ? settings.rep_pen_decay : undefined,
'repetition_penalty_range': settings.rep_pen_range,
'encoder_repetition_penalty': settings.type === OOBA ? settings.encoder_rep_pen : undefined,
'no_repeat_ngram_size': settings.type === OOBA ? settings.no_repeat_ngram_size : undefined,