added xtc parameter for ooba

e28257096a8bc80a6d3bfb52c7b803c3d5c9e868

Vitor <vitor@ferreiradelima.com>

3 files changed, +45 -0Ignore whitespace
public/index.html+21 -0
@@ -1291,6 +1291,26 @@
12911291 </div>
12921292 </div>
12931293 </div>
1294+
1295+ <div data-newbie-hidden data-tg-type="ooba" id="xtc_block" class="wide100p">
1296+ <h4 class="wide100p textAlignCenter">
1297+ <label data-i18n="XTC Parameters">XTC Parameters</label>
1298+ <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>
1299+ </h4>
1300+ <div class="flex-container flexFlowRow gap10px flexShrink">
1301+ <div class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0">
1302+ <small data-i18n="XTC Threshold">XTC Threshold</small>
1303+ <input class="neo-range-slider" type="range" id="xtc_threshold_textgenerationwebui" name="volume" min="0" max="1" step="0.01" />
1304+ <input class="neo-range-input" type="number" min="0" max="1" step="0.01" data-for="xtc_threshold_textgenerationwebui" id="xtc_threshold_counter_textgenerationwebui">
1305+ </div>
1306+ <div class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0">
1307+ <small data-i18n="XTC Probability">XTC Probability</small>
1308+ <input class="neo-range-slider" type="range" id="xtc_probability_textgenerationwebui" name="volume" min="0" max="1" step="0.01" />
1309+ <input class="neo-range-input" type="number" min="0" max="1" step="0.01" data-for="xtc_probability_textgenerationwebui" id="xtc_probability_counter_textgenerationwebui">
1310+ </div>
1311+ </div>
1312+ </div>
1313+
12941314 <!-- Enable for llama.cpp when the PR is merged: https://github.com/ggerganov/llama.cpp/pull/6839 -->
12951315 <div data-newbie-hidden data-tg-type="ooba, koboldcpp" id="dryBlock" class="wide100p">
12961316 <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 @@
16401660 <div data-name="top_a" draggable="true"><span>Top A</span><small></small></div>
16411661 <div data-name="min_p" draggable="true"><span>Min P</span><small></small></div>
16421662 <div data-name="mirostat" draggable="true"><span>Mirostat</span><small></small></div>
1663+ <div data-name="xtc" draggable="true"><span>XTC</span><small></small></div>
16431664 </div>
16441665 <div id="textgenerationwebui_default_order" class="menu_button menu_button_icon">
16451666 <span data-i18n="Load default order">Load default order</span>
public/scripts/power-user.js+15 -0
@@ -704,6 +704,21 @@ async function CreateZenSliders(elmnt) {
704704 sliderID == 'dry_base_textgenerationwebui') {
705705 decimals = 2;
706706 }
707+
708+ if (sliderID == 'xtc_threshold_textgenerationwebui') {
709+ numSteps = 100;
710+ decimals = 2;
711+ sliderMin = 0;
712+ sliderMax = 1;
713+ stepScale = 0.01;
714+ }
715+ if (sliderID == 'xtc_probability_textgenerationwebui') {
716+ numSteps = 100;
717+ decimals = 2;
718+ sliderMin = 0;
719+ sliderMax = 1;
720+ stepScale = 0.01;
721+ }
707722 if (sliderID == 'eta_cutoff_textgenerationwebui' ||
708723 sliderID == 'epsilon_cutoff_textgenerationwebui') {
709724 numSteps = 50;
public/scripts/textgen-settings.js+9 -0
@@ -80,6 +80,7 @@ const OOBA_DEFAULT_ORDER = [
8080 'top_a',
8181 'min_p',
8282 'mirostat',
83+ "xtc"
8384];
8485const BIAS_KEY = '#textgenerationwebui_api-settings';
8586
@@ -188,6 +189,8 @@ const settings = {
188189 custom_model: '',
189190 bypass_status_check: false,
190191 openrouter_allow_fallbacks: true,
192+ xtc_threshold: 0.1,
193+ xtc_probability: 0,
191194};
192195
193196export let textgenerationwebui_banned_in_macros = [];
@@ -263,6 +266,8 @@ export const setting_names = [
263266 'custom_model',
264267 'bypass_status_check',
265268 'openrouter_allow_fallbacks',
269+ 'xtc_threshold',
270+ 'xtc_probability',
266271];
267272
268273const DYNATEMP_BLOCK = document.getElementById('dynatemp_block_ooba');
@@ -718,6 +723,8 @@ jQuery(function () {
718723 'dry_multiplier_textgenerationwebui': 0,
719724 'dry_base_textgenerationwebui': 1.75,
720725 'dry_penalty_last_n_textgenerationwebui': 0,
726+ 'xtc_threshold_textgenerationwebui': 0.1,
727+ 'xtc_probability_textgenerationwebui': 0
721728 };
722729
723730 for (const [id, value] of Object.entries(inputs)) {
@@ -1128,6 +1135,8 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
11281135 'api_server': getTextGenServer(),
11291136 'legacy_api': settings.legacy_api && (settings.type === OOBA || settings.type === APHRODITE),
11301137 'sampler_order': settings.type === textgen_types.KOBOLDCPP ? settings.sampler_order : undefined,
1138+ 'xtc_threshold': settings.type === OOBA ? settings.xtc_threshold : undefined,
1139+ 'xtc_probability': settings.type === OOBA ? settings.xtc_probability : undefined,
11311140 };
11321141 const nonAphroditeParams = {
11331142 'rep_pen': settings.rep_pen,