DynaTemp UI v2

With DynaTemp moving into main KCPP now ST can have DynaTemp too!
This commit is contained in:
Alexander Abushady 2024-01-05 02:08:44 -05:00
parent 99dc3fb6fe
commit d66be24518
5 changed files with 66 additions and 2 deletions

View File

@ -1315,6 +1315,29 @@
</div>
</div>
</div>
<div data-newbie-hidden name="dynaTempBlock" class="wide100p">
<h4 class="wide100p textAlignCenter" data-i18n="DynaTemp">DynaTemp
<div class=" fa-solid fa-circle-info opacity50p " title="Helpful tip coming soon."></div>
</h4>
<div class="flex-container flexFlowRow alignitemscenter gap10px flexShrink">
<div class="">
<label class="checkbox_label" for="dynatemp_textgenerationwebui">
<input type="checkbox" id="dynatemp_textgenerationwebui" />
<small data-i18n="dynatemp">Activate</small>
</label>
</div>
<div class="alignitemscenter flex-container marginBot5 flexFlowColumn flexGrow flexShrink gap0">
<small data-i18n="Min Temp">Min Temp</small>
<input class="neo-range-slider" type="range" id="min_temp_textgenerationwebui" name="volume" min="0" max="5" step="0.1" />
<input class="neo-range-input" type="number" min="0" max="5" step="0.1" data-for="min_temp_textgenerationwebui" id="min_temp_counter_textgenerationwebui">
</div>
<div class="alignitemscenter flex-container marginBot5 flexFlowColumn flexGrow flexShrink gap0">
<small data-i18n="Max Temp">Max Temp</small>
<input class="neo-range-slider" type="range" id="max_temp_textgenerationwebui" name="volume" min="0" max="5" step="0.1" />
<input class="neo-range-input" type="number" min="0" max="5" step="0.1" data-for="max_temp_textgenerationwebui" id="max_temp_counter_textgenerationwebui">
</div>
</div>
</div>
<div data-forAphro=False data-newbie-hidden name="contrastiveSearchBlock" class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0">
<h4 class="textAlignCenter" data-i18n="Contrastive search">Contrast Search
<div class=" fa-solid fa-circle-info opacity50p " title="Helpful tip coming soon."></div>

View File

@ -31,6 +31,9 @@ export const kai_settings = {
use_default_badwordsids: false,
grammar: '',
seed: -1,
dynatemp: false,
min_temp: 0.1,
max_temp: 2.0,
};
/**
@ -46,6 +49,7 @@ export const kai_flags = {
can_use_mirostat: false,
can_use_grammar: false,
can_use_min_p: false,
can_use_dynatemp: false,
};
const defaultValues = Object.freeze(structuredClone(kai_settings));
@ -139,7 +143,9 @@ export function getKoboldGenerationData(finalPrompt, settings, maxLength, maxCon
use_default_badwordsids: (kai_flags.can_use_default_badwordsids || isHorde) ? kai_settings.use_default_badwordsids : undefined,
grammar: (kai_flags.can_use_grammar || isHorde) ? substituteParams(kai_settings.grammar) : undefined,
sampler_seed: kai_settings.seed >= 0 ? kai_settings.seed : undefined,
dynatemp: (kai_flags.can_use_dynatemp || isHorde) ? kai_settings.dynatemp : false,
min_temp: (kai_flags.can_use_dynatemp || isHorde) ? kai_settings.min_temp : undefined,
max_temp: (kai_flags.can_use_dynatemp || isHorde) ? kai_settings.max_temp : undefined,
api_server,
};
return generate_data;
@ -306,6 +312,20 @@ const sliders = [
format: (val) => val,
setValue: (val) => { kai_settings.seed = Number(val); },
},
{
name: 'min_temp',
sliderId: '#min_temp_kobold',
counterId: '#min_temp_counter_kobold',
format: (val) => val,
setValue: (val) => { kai_settings.min_temp = Number(val); },
},
{
name: 'max_temp',
sliderId: '#max_temp_kobold',
counterId: '#max_temp_counter_kobold',
format: (val) => val,
setValue: (val) => { kai_settings.max_temp = Number(val); },
},
];
export function setKoboldFlags(koboldUnitedVersion, koboldCppVersion) {

View File

@ -604,6 +604,10 @@ async function CreateZenSliders(elmnt) {
sliderID == 'rep_pen_range') {
decimals = 0;
}
if (sliderID == 'min_temp_textgenerationwebui' ||
sliderID == 'max_temp_textgenerationwebui') {
decimals = 2;
}
if (sliderID == 'eta_cutoff_textgenerationwebui' ||
sliderID == 'epsilon_cutoff_textgenerationwebui') {
numSteps = 50;
@ -633,7 +637,9 @@ async function CreateZenSliders(elmnt) {
}
if (sliderID == 'mirostat_eta_textgenerationwebui' ||
sliderID == 'penalty_alpha_textgenerationwebui' ||
sliderID == 'length_penalty_textgenerationwebui') {
sliderID == 'length_penalty_textgenerationwebui' ||
sliderID == 'min_temp_textgenerationwebui' ||
sliderID == 'max_temp_textgenerationwebui') {
numSteps = 50;
}
//customize off values

View File

@ -79,6 +79,9 @@ const settings = {
presence_pen: 0,
do_sample: true,
early_stopping: false,
dynatemp: false,
min_temp: 0,
max_temp: 2.0,
seed: -1,
preset: 'Default',
add_bos_token: true,
@ -135,6 +138,9 @@ const setting_names = [
'num_beams',
'length_penalty',
'min_length',
'dynatemp',
'min_temp',
'max_temp',
'encoder_rep_pen',
'freq_pen',
'presence_pen',
@ -698,6 +704,9 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
'length_penalty': settings.length_penalty,
'early_stopping': settings.early_stopping,
'add_bos_token': settings.add_bos_token,
'dynatemp': settings.dynatemp,
'min_temp': settings.min_temp,
'max_temp': settings.max_temp,
'stopping_strings': getStoppingStrings(isImpersonate, isContinue),
'stop': getStoppingStrings(isImpersonate, isContinue),
'truncation_length': max_context,

View File

@ -901,6 +901,12 @@ export interface ModelGenerationInputKobold {
min_p?: number;
/** Typical sampling value. */
typical?: number;
/** DynaTemp sampling activataion. */
dynatemp?: boolean;
/** DynaTemp minimum temperature value. */
min_temp?: number;
/** DynaTemp maximum temperature value. */
max_temp?: number;
/** Array of integers representing the sampler order to be used */
sample_order?: number[];
}