Merge pull request #2741 from SillyTavern/xtc-koboldcpp XTC for koboldcpp

e690a87294168ede09f7515f1c8d96ddbc6ce25a

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

Signed
2 files changed, +30 -0Showing whitespace changes
public/index.html+22 -0
@@ -1278,6 +1278,28 @@
12781278 </div>
12791279 </div>
12801280 </div>
1281+
1282+ <div data-newbie-hidden data-tg-type="koboldcpp" id="xtc_block" class="wide100p">
1283+ <h4 class="wide100p textAlignCenter">
1284+ <label data-i18n="Exclude Top Choices (XTC)">Exclude Top Choices (XTC)</label>
1285+ <a href="https://github.com/oobabooga/text-generation-webui/pull/6335" target="_blank">
1286+ <div class=" fa-solid fa-circle-info opacity50p"></div>
1287+ </a>
1288+ </h4>
1289+ <div class="flex-container flexFlowRow gap10px flexShrink">
1290+ <div class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0">
1291+ <small data-i18n="Threshold">Threshold</small>
1292+ <input class="neo-range-slider" type="range" id="xtc_threshold_textgenerationwebui" name="volume" min="0" max="0.5" step="0.01" />
1293+ <input class="neo-range-input" type="number" min="0" max="0.5" step="0.01" data-for="xtc_threshold_textgenerationwebui" id="xtc_threshold_counter_textgenerationwebui">
1294+ </div>
1295+ <div class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0">
1296+ <small data-i18n="Probability">Probability</small>
1297+ <input class="neo-range-slider" type="range" id="xtc_probability_textgenerationwebui" name="volume" min="0" max="1" step="0.01" />
1298+ <input class="neo-range-input" type="number" min="0" max="1" step="0.01" data-for="xtc_probability_textgenerationwebui" id="xtc_probability_counter_textgenerationwebui">
1299+ </div>
1300+ </div>
1301+ </div>
1302+
12811303 <!-- Enable for llama.cpp when the PR is merged: https://github.com/ggerganov/llama.cpp/pull/6839 -->
12821304 <div data-newbie-hidden data-tg-type="ooba, koboldcpp" id="dryBlock" class="wide100p">
12831305 <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">
public/scripts/textgen-settings.js+8 -0
@@ -188,6 +188,8 @@ const settings = {
188188 custom_model: '',
189189 bypass_status_check: false,
190190 openrouter_allow_fallbacks: true,
191+ xtc_threshold: 0.1,
192+ xtc_probability: 0,
191193};
192194
193195export let textgenerationwebui_banned_in_macros = [];
@@ -263,6 +265,8 @@ export const setting_names = [
263265 'custom_model',
264266 'bypass_status_check',
265267 'openrouter_allow_fallbacks',
268+ 'xtc_threshold',
269+ 'xtc_probability',
266270];
267271
268272const DYNATEMP_BLOCK = document.getElementById('dynatemp_block_ooba');
@@ -718,6 +722,8 @@ jQuery(function () {
718722 'dry_multiplier_textgenerationwebui': 0,
719723 'dry_base_textgenerationwebui': 1.75,
720724 'dry_penalty_last_n_textgenerationwebui': 0,
725+ 'xtc_threshold_textgenerationwebui': 0.1,
726+ 'xtc_probability_textgenerationwebui': 0,
721727 };
722728
723729 for (const [id, value] of Object.entries(inputs)) {
@@ -1156,6 +1162,8 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
11561162 'api_server': getTextGenServer(),
11571163 'legacy_api': settings.legacy_api && (settings.type === OOBA || settings.type === APHRODITE),
11581164 'sampler_order': settings.type === textgen_types.KOBOLDCPP ? settings.sampler_order : undefined,
1165+ 'xtc_threshold': settings.xtc_threshold,
1166+ 'xtc_probability': settings.xtc_probability,
11591167 };
11601168 const nonAphroditeParams = {
11611169 'rep_pen': settings.rep_pen,