Merge pull request #3961 from DocShotgun/staging

5c027634ff2b69c577fa5397d76e0454e7c2f433

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

Signed
2 files changed, +22 -8Ignore whitespace
public/index.html+14 -5
@@ -1284,7 +1284,7 @@
12841284 <input class="neo-range-slider" type="range" id="min_p_textgenerationwebui" name="volume" min="0" max="1" step="0.001">
12851285 <input class="neo-range-input" type="number" min="0" max="1" step="0.001" data-for="min_p_textgenerationwebui" id="min_p_counter_textgenerationwebui">
12861286 </div>
12871287 <div data-tg-type-mode="except" data-tg-type="generic,llamacpp" class="alignitemscenter flex-container flexFlowColumn flexBasis30p flexGrow flexShrink gap0">
12881288 <small>
12891289 <span data-i18n="Top A">Top A</span>
12901290 <div class="fa-solid fa-circle-info opacity50p" title="Top A sets a threshold for token selection based on the square of the highest token probability.&#13;E.g if the Top-A value is 0.2 and the top token's probability is 50%, tokens with probabilities below 5% (0.2 * 0.5^2) are excluded.&#13;Set to 0 to disable." data-i18n="[title]Top_A_desc"></div>
@@ -1292,7 +1292,7 @@
12921292 <input class="neo-range-slider" type="range" id="top_a_textgenerationwebui" name="volume" min="0" max="1" step="0.01">
12931293 <input class="neo-range-input" type="number" min="0" max="1" step="0.01" data-for="top_a_textgenerationwebui" id="top_a_counter_textgenerationwebui">
12941294 </div>
12951295 <div data-tg-type-mode="except" data-tg-type="generic,llamacpp" class="alignitemscenter flex-container flexFlowColumn flexBasis30p flexGrow flexShrink gap0">
12961296 <small>
12971297 <span data-i18n="TFS">TFS</span>
12981298 <div class="fa-solid fa-circle-info opacity50p" data-i18n="[title]Tail_Free_Sampling_desc" title="Tail-Free Sampling (TFS) searches for a tail of low-probability tokens in the distribution,&#13;by analyzing the rate of change in token probabilities using derivatives. It retains tokens up to a threshold (e.g., 0.3) based on the normalized second derivative.&#13;The closer to 0, the more discarded tokens. Set to 1.0 to disable."></div>
@@ -1308,7 +1308,7 @@
13081308 <input class="neo-range-slider" type="range" id="epsilon_cutoff_textgenerationwebui" name="volume" min="0" max="9" step="0.01">
13091309 <input class="neo-range-input" type="number" min="0" max="9" step="0.01" data-for="epsilon_cutoff_textgenerationwebui" id="epsilon_cutoff_counter_textgenerationwebui">
13101310 </div>
13111311 <div data-tg-type="aphrodite,koboldcpp,llamacpp" class="alignitemscenter flex-container flexFlowColumn flexBasis30p flexGrow flexShrink gap0">
13121312 <small>
13131313 <span data-i18n="Top nsigma">Top nsigma</span>
13141314 <div class="fa-solid fa-circle-info opacity50p" title="A sampling method that filters logits based on their statistical properties. It keeps tokens within n standard deviations of the maximum logit value, providing a simpler alternative to top-p/top-k sampling while maintaining sampling stability across different temperatures."></div>
@@ -1316,6 +1316,14 @@
13161316 <input class="neo-range-slider" type="range" id="nsigma_textgenerationwebui" name="volume" min="0" max="5" step="0.01">
13171317 <input class="neo-range-input" type="number" min="0" max="5" step="0.01" data-for="nsigma_textgenerationwebui" id="nsigma_counter_textgenerationwebui">
13181318 </div>
1319+ <div data-tg-type="llamacpp" class="alignitemscenter flex-container flexFlowColumn flexBasis30p flexGrow flexShrink gap0">
1320+ <small>
1321+ <span data-i18n="Min Keep">Min Keep</span>
1322+ <div class="fa-solid fa-circle-info opacity50p" title="A sampling modifier that ensures that truncation samplers such as top-p, min-p, typical-p, and xtc return at least this many tokens. Set to 0 to disable."></div>
1323+ </small>
1324+ <input class="neo-range-slider" type="range" id="min_keep_textgenerationwebui" name="volume" min="0" max="50" step="1">
1325+ <input class="neo-range-input" type="number" min="0" max="50" step="1" data-for="min_keep_textgenerationwebui" id="min_keep_counter_textgenerationwebui">
1326+ </div>
13191327 <div data-tg-type="ooba,mancer,aphrodite" class="alignitemscenter flex-container flexFlowColumn flexBasis30p flexGrow flexShrink gap0">
13201328 <small>
13211329 <span data-i18n="Eta Cutoff">Eta Cutoff</span>
@@ -1769,11 +1777,12 @@
17691777 <div data-name="temperature" draggable="true"><span>Temperature</span><small></small></div>
17701778 <div data-name="top_k" draggable="true"><span>Top K</span><small></small></div>
17711779 <div data-name="top_p" draggable="true"><span>Top P</span><small></small></div>
17721780 <div data-name="typical_ptyp_p" draggable="true"><span>Typical P</span><small></small></div>
1773- <div data-name="tfs_z" draggable="true"><span>Tail Free Sampling</span><small></small></div>
17741781 <div data-name="min_p" draggable="true"><span>Min P</span><small></small></div>
17751782 <div data-name="xtc" draggable="true"><span>Exclude Top Choices</span><small></small></div>
17761783 <div data-name="dry" draggable="true"><span>DRY</span><small></small></div>
1784+ <div data-name="penalties" draggable="true"><span>Rep/Freq/Pres Penalties</span><small></small></div>
1785+ <div data-name="top_n_sigma" draggable="true"><span>Top N-Sigma</span><small></small></div>
17771786 </div>
17781787 <div id="llamacpp_samplers_default_order" class="menu_button menu_button_icon">
17791788 <span data-i18n="Load default order">Load default order</span>
public/scripts/textgen-settings.js+8 -3
@@ -56,10 +56,11 @@ const {
5656} = textgen_types;
5757
5858const LLAMACPP_DEFAULT_ORDER = [
59+ 'penalties',
5960 'dry',
61+ 'top_n_sigma',
6062 'top_k',
6163 'tfs_ztyp_p',
62- 'typical_p',
6364 'top_p',
6465 'min_p',
6566 'xtc',
@@ -212,6 +213,7 @@ const settings = {
212213 xtc_threshold: 0.1,
213214 xtc_probability: 0,
214215 nsigma: 0.0,
216+ min_keep: 0,
215217 featherless_model: '',
216218 generic_model: '',
217219};
@@ -294,6 +296,7 @@ export const setting_names = [
294296 'xtc_threshold',
295297 'xtc_probability',
296298 'nsigma',
299+ 'min_keep',
297300 'generic_model',
298301];
299302
@@ -804,6 +807,7 @@ jQuery(function () {
804807 'xtc_threshold_textgenerationwebui': 0.1,
805808 'xtc_probability_textgenerationwebui': 0,
806809 'nsigma_textgenerationwebui': 0,
810+ 'min_keep_textgenerationwebui': 0,
807811 };
808812
809813 for (const [id, value] of Object.entries(inputs)) {
@@ -1332,6 +1336,8 @@ export async function getTextGenGenerationData(finalPrompt, maxTokens, isImperso
13321336 'xtc_threshold': settings.xtc_threshold,
13331337 'xtc_probability': settings.xtc_probability,
13341338 'nsigma': settings.nsigma,
1339+ 'top_n_sigma': settings.nsigma,
1340+ 'min_keep': settings.min_keep,
13351341 };
13361342 const nonAphroditeParams = {
13371343 'rep_pen': settings.rep_pen,
@@ -1351,7 +1357,6 @@ export async function getTextGenGenerationData(finalPrompt, maxTokens, isImperso
13511357 'json_schema': [TABBY, LLAMACPP].includes(settings.type) ? settings.json_schema : undefined,
13521358 // llama.cpp aliases. In case someone wants to use LM Studio as Text Completion API
13531359 'repeat_penalty': settings.rep_pen,
1354- 'tfs_z': settings.tfs,
13551360 'repeat_last_n': settings.rep_pen_range,
13561361 'n_predict': maxTokens,
13571362 'num_predict': maxTokens,