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

e690a87294168ede09f7515f1c8d96ddbc6ce25a

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

Signed
2 files changed, +30 -0Ignore whitespace
public/index.html+22 -0
@@ -1278,6 +1278,28 @@
1278 </div>1278 </div>
1279 </div>1279 </div>
1280 </div>1280 </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
1281 <!-- Enable for llama.cpp when the PR is merged: https://github.com/ggerganov/llama.cpp/pull/6839 -->1303 <!-- Enable for llama.cpp when the PR is merged: https://github.com/ggerganov/llama.cpp/pull/6839 -->
1282 <div data-newbie-hidden data-tg-type="ooba, koboldcpp" id="dryBlock" class="wide100p">1304 <div data-newbie-hidden data-tg-type="ooba, koboldcpp" id="dryBlock" class="wide100p">
1283 <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">1305 <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 = {
188 custom_model: '',188 custom_model: '',
189 bypass_status_check: false,189 bypass_status_check: false,
190 openrouter_allow_fallbacks: true,190 openrouter_allow_fallbacks: true,
191 xtc_threshold: 0.1,
192 xtc_probability: 0,
191};193};
192194
193export let textgenerationwebui_banned_in_macros = [];195export let textgenerationwebui_banned_in_macros = [];
@@ -263,6 +265,8 @@ export const setting_names = [
263 'custom_model',265 'custom_model',
264 'bypass_status_check',266 'bypass_status_check',
265 'openrouter_allow_fallbacks',267 'openrouter_allow_fallbacks',
268 'xtc_threshold',
269 'xtc_probability',
266];270];
267271
268const DYNATEMP_BLOCK = document.getElementById('dynatemp_block_ooba');272const DYNATEMP_BLOCK = document.getElementById('dynatemp_block_ooba');
@@ -718,6 +722,8 @@ jQuery(function () {
718 'dry_multiplier_textgenerationwebui': 0,722 'dry_multiplier_textgenerationwebui': 0,
719 'dry_base_textgenerationwebui': 1.75,723 'dry_base_textgenerationwebui': 1.75,
720 'dry_penalty_last_n_textgenerationwebui': 0,724 'dry_penalty_last_n_textgenerationwebui': 0,
725 'xtc_threshold_textgenerationwebui': 0.1,
726 'xtc_probability_textgenerationwebui': 0,
721 };727 };
722728
723 for (const [id, value] of Object.entries(inputs)) {729 for (const [id, value] of Object.entries(inputs)) {
@@ -1156,6 +1162,8 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
1156 'api_server': getTextGenServer(),1162 'api_server': getTextGenServer(),
1157 'legacy_api': settings.legacy_api && (settings.type === OOBA || settings.type === APHRODITE),1163 'legacy_api': settings.legacy_api && (settings.type === OOBA || settings.type === APHRODITE),
1158 'sampler_order': settings.type === textgen_types.KOBOLDCPP ? settings.sampler_order : undefined,1164 'sampler_order': settings.type === textgen_types.KOBOLDCPP ? settings.sampler_order : undefined,
1165 'xtc_threshold': settings.xtc_threshold,
1166 'xtc_probability': settings.xtc_probability,
1159 };1167 };
1160 const nonAphroditeParams = {1168 const nonAphroditeParams = {
1161 'rep_pen': settings.rep_pen,1169 'rep_pen': settings.rep_pen,