Merge pull request #3094 from AlpinDale/top-nsigma

feat: add top nsigma sampler support
This commit is contained in:
Cohee 2024-11-25 00:33:44 +02:00 committed by GitHub
commit 0791f5bbae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 0 deletions

View File

@ -1291,6 +1291,14 @@
<input class="neo-range-slider" type="range" id="epsilon_cutoff_textgenerationwebui" name="volume" min="0" max="9" step="0.01">
<input class="neo-range-input" type="number" min="0" max="9" step="0.01" data-for="epsilon_cutoff_textgenerationwebui" id="epsilon_cutoff_counter_textgenerationwebui">
</div>
<div data-tg-type="aphrodite" class="alignitemscenter flex-container flexFlowColumn flexBasis30p flexGrow flexShrink gap0">
<small>
<span data-i18n="Top nsigma">Top nsigma</span>
<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>
</small>
<input class="neo-range-slider" type="range" id="nsigma_textgenerationwebui" name="volume" min="0" max="5" step="0.01">
<input class="neo-range-input" type="number" min="0" max="5" step="0.01" data-for="nsigma_textgenerationwebui" id="nsigma_counter_textgenerationwebui">
</div>
<div data-tg-type="ooba,mancer,aphrodite" class="alignitemscenter flex-container flexFlowColumn flexBasis30p flexGrow flexShrink gap0">
<small>
<span data-i18n="Eta Cutoff">Eta Cutoff</span>

View File

@ -642,6 +642,10 @@ async function CreateZenSliders(elmnt) {
numSteps = 50;
decimals = 1;
}
if (sliderID == 'nsigma') {
numSteps = 50;
decimals = 1;
}
//customize steps
if (sliderID == 'mirostat_mode_textgenerationwebui' ||
sliderID == 'mirostat_mode_kobold') {
@ -686,6 +690,7 @@ async function CreateZenSliders(elmnt) {
sliderID == 'penalty_alpha_textgenerationwebui' ||
sliderID == 'length_penalty_textgenerationwebui' ||
sliderID == 'epsilon_cutoff_textgenerationwebui' ||
sliderID == 'nsigma' ||
sliderID == 'rep_pen_range' ||
sliderID == 'eta_cutoff_textgenerationwebui' ||
sliderID == 'top_a_textgenerationwebui' ||

View File

@ -193,6 +193,7 @@ const settings = {
openrouter_allow_fallbacks: true,
xtc_threshold: 0.1,
xtc_probability: 0,
nsigma: 0.0,
featherless_model: '',
};
@ -265,6 +266,7 @@ export const setting_names = [
'openrouter_allow_fallbacks',
'xtc_threshold',
'xtc_probability',
'nsigma',
];
const DYNATEMP_BLOCK = document.getElementById('dynatemp_block_ooba');
@ -1186,6 +1188,7 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
'sampler_order': settings.type === textgen_types.KOBOLDCPP ? settings.sampler_order : undefined,
'xtc_threshold': settings.xtc_threshold,
'xtc_probability': settings.xtc_probability,
'nsigma': settings.nsigma,
};
const nonAphroditeParams = {
'rep_pen': settings.rep_pen,
@ -1253,6 +1256,7 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
'dynatemp_exponent': dynatemp ? settings.dynatemp_exponent : undefined,
'xtc_threshold': settings.xtc_threshold,
'xtc_probability': settings.xtc_probability,
'nsigma': settings.nsigma,
'custom_token_bans': toIntArray(banned_tokens),
};