Merge pull request #1766 from AAbushady/quad-sample

Quad sample and DynaTemp Exponent
This commit is contained in:
Cohee 2024-02-02 20:08:12 +02:00 committed by GitHub
commit 0ff46baaa2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 24 additions and 5 deletions

View File

@ -1266,6 +1266,11 @@
<input class="neo-range-slider" type="range" id="min_length_textgenerationwebui" name="volume" min="0" max="2000" step="1" />
<input class="neo-range-input" type="number" min="0" max="2000" step="1" data-for="min_length_textgenerationwebui" id="min_length_counter_textgenerationwebui">
</div>
<div data-newbie-hidden data-tg-type="ooba, koboldcpp, aphrodite, tabby" class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0">
<small data-i18n="Smoothing Factor">Smoothing Factor</small>
<input class="neo-range-slider" type="range" id="smoothing_factor_textgenerationwebui" name="volume" min="0" max="10" step="0.01" />
<input class="neo-range-input" type="number" min="0" max="5" step="0.01" data-for="smoothing_factor_textgenerationwebui" id="smoothing_factor_counter_textgenerationwebui">
</div>
<!--
<div data-tg-type="aphrodite" class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0" data-i18n="Responses">
<small>Responses</small>
@ -1288,7 +1293,7 @@
<input class="neo-range-input" type="number" min="0" max="5" step="1" data-for="prompt_log_probs_aphrodite" id="prompt_log_probs_aphrodite_counter_textgenerationwebui">
</div>
-->
<div data-newbie-hidden data-tg-type="ooba, koboldcpp, tabby" name="dynaTempBlock" class="wide100p">
<div data-newbie-hidden data-tg-type="ooba, koboldcpp, tabby, llamacpp, aphrodite" name="dynaTempBlock" class="wide100p">
<h4 class="wide100p textAlignCenter" data-i18n="DynaTemp">
<div class="flex-container alignitemscenter" style="justify-content: center;">
<div class="checkbox_label" for="dynatemp_textgenerationwebui">
@ -1310,6 +1315,11 @@
<input class="neo-range-slider" type="range" id="max_temp_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="max_temp_textgenerationwebui" id="max_temp_counter_textgenerationwebui">
</div>
<div class="alignitemscenter flex-container marginBot5 flexFlowColumn flexGrow flexShrink gap0">
<small data-i18n="Exponent">Exponent</small>
<input class="neo-range-slider" type="range" id="dynatemp_exponent_textgenerationwebui" name="volume" min="0.01" max="10" step="0.01" />
<input class="neo-range-input" type="number" min="0.01" max="10" step="0.01" data-for="dynatemp_exponent_textgenerationwebui" id="dynatemp_exponent_counter_textgenerationwebui">
</div>
</div>
</div>
<div data-newbie-hidden name="miroStatBlock" class="wide100p">
@ -1470,7 +1480,7 @@
</div>
</div>
</div>
<div data-newbie-hidden data-forAphro="False" id="grammar_block_ooba" class="wide100p">
<div data-newbie-hidden id="grammar_block_ooba" class="wide100p">
<hr class="wide100p">
<h4 class="wide100p textAlignCenter" data-i18n="GBNF Grammar">GBNF Grammar
<a href="https://github.com/ggerganov/llama.cpp/blob/master/grammars/README.md" target="_blank">

View File

@ -621,7 +621,9 @@ async function CreateZenSliders(elmnt) {
decimals = 0;
}
if (sliderID == 'min_temp_textgenerationwebui' ||
sliderID == 'max_temp_textgenerationwebui') {
sliderID == 'max_temp_textgenerationwebui' ||
sliderID == 'dynatemp_exponent_textgenerationwebui' ||
sliderID == 'smoothing_factor_textgenerationwebui') {
decimals = 2;
}
if (sliderID == 'eta_cutoff_textgenerationwebui' ||

View File

@ -79,6 +79,8 @@ const settings = {
dynatemp: false,
min_temp: 0,
max_temp: 2.0,
dynatemp_exponent: 1.0,
smoothing_factor: 0.0,
seed: -1,
preset: 'Default',
add_bos_token: true,
@ -140,6 +142,8 @@ const setting_names = [
'dynatemp',
'min_temp',
'max_temp',
'dynatemp_exponent',
'smoothing_factor',
'encoder_rep_pen',
'freq_pen',
'presence_pen',
@ -714,7 +718,7 @@ function parseTextgenLogprobs(token, logprobs) {
switch (settings.type) {
case APHRODITE:
case OOBA: {
/** @type {Record<string, number>[]} */
/** @type {Record<string, number>[]} */
const topLogprobs = logprobs.top_logprobs;
if (!topLogprobs?.length) {
return null;
@ -799,7 +803,7 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
'model': getModel(),
'max_new_tokens': maxTokens,
'max_tokens': maxTokens,
'logprobs': power_user.request_token_probabilities ? 10: undefined,
'logprobs': power_user.request_token_probabilities ? 10 : undefined,
'temperature': settings.dynatemp ? (settings.min_temp + settings.max_temp) / 2 : settings.temp,
'top_p': settings.top_p,
'typical_p': settings.typical_p,
@ -818,6 +822,8 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
'dynatemp_low': settings.min_temp,
'dynatemp_high': settings.max_temp,
'dynatemp_range': settings.dynatemp ? (settings.max_temp - settings.min_temp) / 2 : 0,
'dynatemp_exponent': settings.dynatemp_exponent,
'smoothing_factor': settings.smoothing_factor,
'stopping_strings': getStoppingStrings(isImpersonate, isContinue),
'stop': getStoppingStrings(isImpersonate, isContinue),
'truncation_length': max_context,
@ -864,6 +870,7 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
'best_of': canMultiSwipe ? settings.n : 1,
'ignore_eos': settings.ignore_eos_token_aphrodite,
'spaces_between_special_tokens': settings.spaces_between_special_tokens_aphrodite,
'grammar': settings.grammar_string,
//'logits_processors': settings.logits_processors_aphrodite,
//'logprobs': settings.log_probs_aphrodite,
//'prompt_logprobs': settings.prompt_log_probs_aphrodite,