added xtc parameter for ooba

This commit is contained in:
Vitor 2024-08-19 01:32:45 -03:00
parent e707def7dd
commit e28257096a
3 changed files with 45 additions and 0 deletions

View File

@ -1291,6 +1291,26 @@
</div>
</div>
</div>
<div data-newbie-hidden data-tg-type="ooba" id="xtc_block" class="wide100p">
<h4 class="wide100p textAlignCenter">
<label data-i18n="XTC Parameters">XTC Parameters</label>
<div class="fa-solid fa-circle-info opacity50p" data-i18n="[title]XTC_Parameters_desc" title="XTC (eXtreme Tail Cutting) parameters for controlling token sampling"></div>
</h4>
<div class="flex-container flexFlowRow gap10px flexShrink">
<div class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0">
<small data-i18n="XTC Threshold">XTC Threshold</small>
<input class="neo-range-slider" type="range" id="xtc_threshold_textgenerationwebui" name="volume" min="0" max="1" step="0.01" />
<input class="neo-range-input" type="number" min="0" max="1" step="0.01" data-for="xtc_threshold_textgenerationwebui" id="xtc_threshold_counter_textgenerationwebui">
</div>
<div class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0">
<small data-i18n="XTC Probability">XTC Probability</small>
<input class="neo-range-slider" type="range" id="xtc_probability_textgenerationwebui" name="volume" min="0" max="1" step="0.01" />
<input class="neo-range-input" type="number" min="0" max="1" step="0.01" data-for="xtc_probability_textgenerationwebui" id="xtc_probability_counter_textgenerationwebui">
</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, koboldcpp" 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." data-i18n="[title]DRY_Repetition_Penalty_desc">
@ -1640,6 +1660,7 @@
<div data-name="top_a" draggable="true"><span>Top A</span><small></small></div>
<div data-name="min_p" draggable="true"><span>Min P</span><small></small></div>
<div data-name="mirostat" draggable="true"><span>Mirostat</span><small></small></div>
<div data-name="xtc" draggable="true"><span>XTC</span><small></small></div>
</div>
<div id="textgenerationwebui_default_order" class="menu_button menu_button_icon">
<span data-i18n="Load default order">Load default order</span>

View File

@ -704,6 +704,21 @@ async function CreateZenSliders(elmnt) {
sliderID == 'dry_base_textgenerationwebui') {
decimals = 2;
}
if (sliderID == 'xtc_threshold_textgenerationwebui') {
numSteps = 100;
decimals = 2;
sliderMin = 0;
sliderMax = 1;
stepScale = 0.01;
}
if (sliderID == 'xtc_probability_textgenerationwebui') {
numSteps = 100;
decimals = 2;
sliderMin = 0;
sliderMax = 1;
stepScale = 0.01;
}
if (sliderID == 'eta_cutoff_textgenerationwebui' ||
sliderID == 'epsilon_cutoff_textgenerationwebui') {
numSteps = 50;

View File

@ -80,6 +80,7 @@ const OOBA_DEFAULT_ORDER = [
'top_a',
'min_p',
'mirostat',
"xtc"
];
const BIAS_KEY = '#textgenerationwebui_api-settings';
@ -188,6 +189,8 @@ const settings = {
custom_model: '',
bypass_status_check: false,
openrouter_allow_fallbacks: true,
xtc_threshold: 0.1,
xtc_probability: 0,
};
export let textgenerationwebui_banned_in_macros = [];
@ -263,6 +266,8 @@ export const setting_names = [
'custom_model',
'bypass_status_check',
'openrouter_allow_fallbacks',
'xtc_threshold',
'xtc_probability',
];
const DYNATEMP_BLOCK = document.getElementById('dynatemp_block_ooba');
@ -718,6 +723,8 @@ jQuery(function () {
'dry_multiplier_textgenerationwebui': 0,
'dry_base_textgenerationwebui': 1.75,
'dry_penalty_last_n_textgenerationwebui': 0,
'xtc_threshold_textgenerationwebui': 0.1,
'xtc_probability_textgenerationwebui': 0
};
for (const [id, value] of Object.entries(inputs)) {
@ -1128,6 +1135,8 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
'api_server': getTextGenServer(),
'legacy_api': settings.legacy_api && (settings.type === OOBA || settings.type === APHRODITE),
'sampler_order': settings.type === textgen_types.KOBOLDCPP ? settings.sampler_order : undefined,
'xtc_threshold': settings.type === OOBA ? settings.xtc_threshold : undefined,
'xtc_probability': settings.type === OOBA ? settings.xtc_probability : undefined,
};
const nonAphroditeParams = {
'rep_pen': settings.rep_pen,