Add DRY Samplers to ST Staging (#2211)
* Add files via upload * Add files via upload * Delete public/index.html * Add files via upload * Delete public/scripts/textgen-settings.js * Add files via upload * Delete public/scripts/power-user.js * Add files via upload * Delete public/scripts/power-user.js * Add files via upload * Update power-user.js * Update index.html * Fix control attribution * Fix app loading * Put sequence breakers under DRY block * DRY for DRY * Update public/index.html Co-authored-by: Philipp Emanuel Weidmann <pew@worldwidemann.com> * Merge fix * Add llamacpp control. Add default value for sequence breakers * Forgot reset --------- Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com> Co-authored-by: Philipp Emanuel Weidmann <pew@worldwidemann.com>
This commit is contained in:
parent
d33ca68620
commit
75a1ef4304
|
@ -1272,6 +1272,45 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Enable for llama.cpp when the PR is merged: https://github.com/ggerganov/llama.cpp/pull/6839 -->
|
||||
<div data-newbie-hidden data-tg-type="ooba" id="dryBlock" class="wide100p">
|
||||
<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.">
|
||||
<label data-i18n="DRY Repetition Penalty">DRY Repetition Penalty</label>
|
||||
<a href="https://github.com/oobabooga/text-generation-webui/pull/5677" target="_blank">
|
||||
<div class=" fa-solid fa-circle-info opacity50p"></div>
|
||||
</a>
|
||||
</h4>
|
||||
<div class="flex-container flexFlowRow gap10px flexShrink">
|
||||
<div class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0" title="Set to value > 0 to enable DRY. Controls the magnitude of the penalty for the shortest penalized sequences.">
|
||||
<small data-i18n="Multiplier">Multiplier</small>
|
||||
<input class="neo-range-slider" type="range" id="dry_multiplier_textgenerationwebui" min="0" max="5" step="0.01" />
|
||||
<input class="neo-range-input" type="number" min="0" max="5" step="0.01" data-for="dry_multiplier_textgenerationwebui" id="dry_multiplier_counter_textgenerationwebui">
|
||||
</div>
|
||||
<div class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0" title="Controls how fast the penalty grows with increasing sequence length.">
|
||||
<small data-i18n="Base">Base</small>
|
||||
<input class="neo-range-slider" type="range" id="dry_base_textgenerationwebui" min="1" max="4" step="0.01" />
|
||||
<input class="neo-range-input" type="number" min="1" max="4" step="0.01" data-for="dry_base_textgenerationwebui" id="dry_base_counter_textgenerationwebui">
|
||||
</div>
|
||||
<div class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0" title="Longest sequence that can be repeated without being penalized.">
|
||||
<small data-i18n="Allowed Length">Allowed Length</small>
|
||||
<input class="neo-range-slider" type="range" id="dry_allowed_length_textgenerationwebui" min="1" max="20" step="1" />
|
||||
<input class="neo-range-input" type="number" min="1" max="20" step="1" data-for="dry_allowed_length_textgenerationwebui" id="dry_allowed_length_counter_textgenerationwebui">
|
||||
</div>
|
||||
<div class="alignItemsCenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0" data-tg-type="llamacpp">
|
||||
<small data-i18n="Penalty Range">Penalty Range</small>
|
||||
<input class="neo-range-slider" type="range" id="dry_penalty_last_n_textgenerationwebui" min="0" max="8192" step="1" />
|
||||
<input class="neo-range-input" type="number" min="0" max="8192" step="1" data-for="dry_penalty_last_n_textgenerationwebui" id="dry_penalty_last_n_counter_textgenerationwebui">
|
||||
</div>
|
||||
</div>
|
||||
<div class="range-block marginTop5" title="Tokens across which sequence matching is not continued. Specified as a comma-separated list of quoted strings.">
|
||||
<div class="range-block-title textAlignCenter">
|
||||
<small data-i18n="Sequence Breakers">Sequence Breakers</small>
|
||||
</div>
|
||||
<div class="wide100p">
|
||||
<textarea id="dry_sequence_breakers_textgenerationwebui" class="text_pole textarea_compact" name="sequence_breakers" rows="3" data-i18n="[placeholder]JSON-serialized array of strings." placeholder="JSON-serialized array of strings."></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div data-newbie-hidden data-tg-type="ooba, mancer, koboldcpp, tabby, llamacpp, aphrodite" id="dynatemp_block_ooba" class="wide100p">
|
||||
<h4 class="wide100p textAlignCenter">
|
||||
<div class="flex-container alignitemscenter justifyCenter">
|
||||
|
|
|
@ -678,6 +678,8 @@ async function CreateZenSliders(elmnt) {
|
|||
sliderID == 'top_k' ||
|
||||
sliderID == 'mirostat_mode_kobold' ||
|
||||
sliderID == 'rep_pen_range' ||
|
||||
sliderID == 'dry_allowed_length_textgenerationwebui' ||
|
||||
sliderID == 'dry_penalty_last_n_textgenerationwebui' ||
|
||||
sliderID == 'max_tokens_second_textgenerationwebui') {
|
||||
decimals = 0;
|
||||
}
|
||||
|
@ -685,7 +687,9 @@ async function CreateZenSliders(elmnt) {
|
|||
sliderID == 'max_temp_textgenerationwebui' ||
|
||||
sliderID == 'dynatemp_exponent_textgenerationwebui' ||
|
||||
sliderID == 'smoothing_curve_textgenerationwebui' ||
|
||||
sliderID == 'smoothing_factor_textgenerationwebui') {
|
||||
sliderID == 'smoothing_factor_textgenerationwebui' ||
|
||||
sliderID == 'dry_multiplier_textgenerationwebui' ||
|
||||
sliderID == 'dry_base_textgenerationwebui') {
|
||||
decimals = 2;
|
||||
}
|
||||
if (sliderID == 'eta_cutoff_textgenerationwebui' ||
|
||||
|
@ -746,6 +750,7 @@ async function CreateZenSliders(elmnt) {
|
|||
sliderID == 'rep_pen_slope' ||
|
||||
sliderID == 'smoothing_factor_textgenerationwebui' ||
|
||||
sliderID == 'smoothing_curve_textgenerationwebui' ||
|
||||
sliderID == 'dry_multiplier_textgenerationwebui' ||
|
||||
sliderID == 'min_length_textgenerationwebui') {
|
||||
offVal = 0;
|
||||
}
|
||||
|
@ -1754,11 +1759,21 @@ function loadMaxContextUnlocked() {
|
|||
}
|
||||
|
||||
function switchMaxContextSize() {
|
||||
const elements = [$('#max_context'), $('#max_context_counter'), $('#rep_pen_range'), $('#rep_pen_range_counter'), $('#rep_pen_range_textgenerationwebui'), $('#rep_pen_range_counter_textgenerationwebui')];
|
||||
const elements = [
|
||||
$('#max_context'),
|
||||
$('#max_context_counter'),
|
||||
$('#rep_pen_range'),
|
||||
$('#rep_pen_range_counter'),
|
||||
$('#rep_pen_range_textgenerationwebui'),
|
||||
$('#rep_pen_range_counter_textgenerationwebui'),
|
||||
$('#dry_penalty_last_n_textgenerationwebui'),
|
||||
$('#dry_penalty_last_n_counter_textgenerationwebui'),
|
||||
];
|
||||
const maxValue = power_user.max_context_unlocked ? MAX_CONTEXT_UNLOCKED : MAX_CONTEXT_DEFAULT;
|
||||
const minValue = power_user.max_context_unlocked ? maxContextMin : maxContextMin;
|
||||
const steps = power_user.max_context_unlocked ? unlockedMaxContextStep : maxContextStep;
|
||||
$('#rep_pen_range_textgenerationwebui_zenslider').remove(); //unsure why, but this is necessary.
|
||||
$('#dry_penalty_last_n_textgenerationwebui_zenslider').remove();
|
||||
for (const element of elements) {
|
||||
const id = element.attr('id');
|
||||
element.attr('max', maxValue);
|
||||
|
@ -1787,6 +1802,8 @@ function switchMaxContextSize() {
|
|||
CreateZenSliders($('#max_context'));
|
||||
$('#rep_pen_range_textgenerationwebui_zenslider').remove();
|
||||
CreateZenSliders($('#rep_pen_range_textgenerationwebui'));
|
||||
$('#dry_penalty_last_n_textgenerationwebui_zenslider').remove();
|
||||
CreateZenSliders($('#dry_penalty_last_n_textgenerationwebui'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -116,6 +116,11 @@ const settings = {
|
|||
dynatemp_exponent: 1.0,
|
||||
smoothing_factor: 0.0,
|
||||
smoothing_curve: 1.0,
|
||||
dry_allowed_length: 2,
|
||||
dry_multiplier: 0.0,
|
||||
dry_base: 1.75,
|
||||
dry_sequence_breakers: '["\\n", ":", "\\"", "*"]',
|
||||
dry_penalty_last_n: 0,
|
||||
max_tokens_second: 0,
|
||||
seed: -1,
|
||||
preset: 'Default',
|
||||
|
@ -190,6 +195,11 @@ export const setting_names = [
|
|||
'dynatemp_exponent',
|
||||
'smoothing_factor',
|
||||
'smoothing_curve',
|
||||
'dry_allowed_length',
|
||||
'dry_multiplier',
|
||||
'dry_base',
|
||||
'dry_sequence_breakers',
|
||||
'dry_penalty_last_n',
|
||||
'max_tokens_second',
|
||||
'encoder_rep_pen',
|
||||
'freq_pen',
|
||||
|
@ -665,6 +675,10 @@ jQuery(function () {
|
|||
'guidance_scale_textgenerationwebui': 1,
|
||||
'smoothing_factor_textgenerationwebui': 0,
|
||||
'smoothing_curve_textgenerationwebui': 1,
|
||||
'dry_allowed_length_textgenerationwebui': 2,
|
||||
'dry_multiplier_textgenerationwebui': 0,
|
||||
'dry_base_textgenerationwebui': 1.75,
|
||||
'dry_penalty_last_n_textgenerationwebui': 0,
|
||||
};
|
||||
|
||||
for (const [id, value] of Object.entries(inputs)) {
|
||||
|
@ -1028,6 +1042,11 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
|
|||
'dynatemp_exponent': settings.dynatemp ? settings.dynatemp_exponent : undefined,
|
||||
'smoothing_factor': settings.smoothing_factor,
|
||||
'smoothing_curve': settings.smoothing_curve,
|
||||
'dry_allowed_length': settings.dry_allowed_length,
|
||||
'dry_multiplier': settings.dry_multiplier,
|
||||
'dry_base': settings.dry_base,
|
||||
'dry_sequence_breakers': settings.dry_sequence_breakers,
|
||||
'dry_penalty_last_n': settings.dry_penalty_last_n,
|
||||
'max_tokens_second': settings.max_tokens_second,
|
||||
'sampler_priority': settings.type === OOBA ? settings.sampler_priority : undefined,
|
||||
'samplers': settings.type === LLAMACPP ? settings.samplers : undefined,
|
||||
|
|
Loading…
Reference in New Issue