Send sampler priority as array
This commit is contained in:
parent
8ba9b5c38b
commit
0c1cf9ff2e
|
@ -47,7 +47,20 @@
|
||||||
"ban_eos_token": false,
|
"ban_eos_token": false,
|
||||||
"skip_special_tokens": true,
|
"skip_special_tokens": true,
|
||||||
"streaming": false,
|
"streaming": false,
|
||||||
"sampler_priority": "temperature\ndynamic_temperature\nquadratic_sampling\ntop_k\ntop_p\ntypical_p\nepsilon_cutoff\neta_cutoff\ntfs\ntop_a\nmin_p\nmirostat"
|
"sampler_priority": [
|
||||||
|
"temperature",
|
||||||
|
"dynamic_temperature",
|
||||||
|
"quadratic_sampling",
|
||||||
|
"top_k",
|
||||||
|
"top_p",
|
||||||
|
"typical_p",
|
||||||
|
"epsilon_cutoff",
|
||||||
|
"eta_cutoff",
|
||||||
|
"tfs",
|
||||||
|
"top_a",
|
||||||
|
"min_p",
|
||||||
|
"mirostat"
|
||||||
|
],
|
||||||
"mirostat_mode": 0,
|
"mirostat_mode": 0,
|
||||||
"mirostat_tau": 5,
|
"mirostat_tau": 5,
|
||||||
"mirostat_eta": 0.1,
|
"mirostat_eta": 0.1,
|
||||||
|
|
|
@ -1574,8 +1574,6 @@
|
||||||
<div data-name="min_p" draggable="true"><span>Min P</span><small></small></div>
|
<div data-name="min_p" draggable="true"><span>Min P</span><small></small></div>
|
||||||
<div data-name="mirostat" draggable="true"><span>Mirostat</span><small></small></div>
|
<div data-name="mirostat" draggable="true"><span>Mirostat</span><small></small></div>
|
||||||
</div>
|
</div>
|
||||||
<textarea id="sampler_priority_textgenerationwebui" name="sampler_priority_textgenerationwebui"
|
|
||||||
style="display: none;"></textarea>
|
|
||||||
<div id="textgenerationwebui_default_order" class="menu_button menu_button_icon">
|
<div id="textgenerationwebui_default_order" class="menu_button menu_button_icon">
|
||||||
<span data-i18n="Load default order">Load default order</span>
|
<span data-i18n="Load default order">Load default order</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -34,6 +34,20 @@ export const textgen_types = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const { MANCER, APHRODITE, TABBY, TOGETHERAI, OOBA, OLLAMA, LLAMACPP } = textgen_types;
|
const { MANCER, APHRODITE, TABBY, TOGETHERAI, OOBA, OLLAMA, LLAMACPP } = textgen_types;
|
||||||
|
const OOBA_DEFAULT_ORDER = [
|
||||||
|
'temperature',
|
||||||
|
'dynamic_temperature',
|
||||||
|
'quadratic_sampling',
|
||||||
|
'top_k',
|
||||||
|
'top_p',
|
||||||
|
'typical_p',
|
||||||
|
'epsilon_cutoff',
|
||||||
|
'eta_cutoff',
|
||||||
|
'tfs',
|
||||||
|
'top_a',
|
||||||
|
'min_p',
|
||||||
|
'mirostat',
|
||||||
|
];
|
||||||
const BIAS_KEY = '#textgenerationwebui_api-settings';
|
const BIAS_KEY = '#textgenerationwebui_api-settings';
|
||||||
|
|
||||||
// Maybe let it be configurable in the future?
|
// Maybe let it be configurable in the future?
|
||||||
|
@ -96,7 +110,7 @@ const settings = {
|
||||||
negative_prompt: '',
|
negative_prompt: '',
|
||||||
grammar_string: '',
|
grammar_string: '',
|
||||||
banned_tokens: '',
|
banned_tokens: '',
|
||||||
sampler_priority: '',
|
sampler_priority: OOBA_DEFAULT_ORDER,
|
||||||
//n_aphrodite: 1,
|
//n_aphrodite: 1,
|
||||||
//best_of_aphrodite: 1,
|
//best_of_aphrodite: 1,
|
||||||
ignore_eos_token_aphrodite: false,
|
ignore_eos_token_aphrodite: false,
|
||||||
|
@ -424,7 +438,7 @@ function loadTextGenSettings(data, loadedSettings) {
|
||||||
* Sorts the sampler items by the given order.
|
* Sorts the sampler items by the given order.
|
||||||
* @param {any[]} orderArray Sampler order array.
|
* @param {any[]} orderArray Sampler order array.
|
||||||
*/
|
*/
|
||||||
function sortItemsByOrder(orderArray) {
|
function sortKoboldItemsByOrder(orderArray) {
|
||||||
console.debug('Preset samplers order: ' + orderArray);
|
console.debug('Preset samplers order: ' + orderArray);
|
||||||
const $draggableItems = $('#koboldcpp_order');
|
const $draggableItems = $('#koboldcpp_order');
|
||||||
|
|
||||||
|
@ -461,37 +475,29 @@ jQuery(function () {
|
||||||
|
|
||||||
$('#koboldcpp_default_order').on('click', function () {
|
$('#koboldcpp_default_order').on('click', function () {
|
||||||
settings.sampler_order = KOBOLDCPP_ORDER;
|
settings.sampler_order = KOBOLDCPP_ORDER;
|
||||||
sortItemsByOrder(settings.sampler_order);
|
sortKoboldItemsByOrder(settings.sampler_order);
|
||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
});
|
});
|
||||||
|
|
||||||
jQuery(function($) {
|
|
||||||
$('#sampler_priority_container').sortable({
|
$('#sampler_priority_container').sortable({
|
||||||
delay: getSortableDelay(),
|
delay: getSortableDelay(),
|
||||||
stop: function() {
|
stop: function () {
|
||||||
const order = [];
|
const order = [];
|
||||||
$('#sampler_priority_container').children().each(function() {
|
$('#sampler_priority_container').children().each(function () {
|
||||||
order.push($(this).data('name'));
|
order.push($(this).data('name'));
|
||||||
});
|
});
|
||||||
settings.sampler_priority = order.join('\n');
|
settings.sampler_priority = order;
|
||||||
console.log('Samplers reordered:', settings.sampler_priority);
|
console.log('Samplers reordered:', settings.sampler_priority);
|
||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
$('#sampler_priority_textgenerationwebui').val(settings.sampler_priority);
|
},
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#textgenerationwebui_default_order').on('click', function () {
|
$('#textgenerationwebui_default_order').on('click', function () {
|
||||||
const defaultOrder = ['temperature', 'dynamic_temperature', 'quadratic_sampling', 'top_k', 'top_p', 'typical_p', 'epsilon_cutoff', 'eta_cutoff', 'tfs', 'top_a', 'min_p', 'mirostat'];
|
sortOobaItemsByOrder(OOBA_DEFAULT_ORDER);
|
||||||
|
settings.sampler_priority = OOBA_DEFAULT_ORDER;
|
||||||
sortOobaItemsByOrder(defaultOrder);
|
console.log('Default samplers order loaded:', settings.sampler_priority);
|
||||||
settings.sampler_priority = defaultOrder.join('\n');
|
saveSettingsDebounced();
|
||||||
console.log('Default samplers order loaded:', settings.sampler_priority);
|
});
|
||||||
saveSettingsDebounced();
|
|
||||||
$('#sampler_priority_textgenerationwebui').val(settings.sampler_priority);
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$('#textgen_type').on('change', function () {
|
$('#textgen_type').on('change', function () {
|
||||||
const type = String($(this).val());
|
const type = String($(this).val());
|
||||||
|
@ -656,11 +662,18 @@ function setSettingByName(setting, value, trigger) {
|
||||||
|
|
||||||
if ('sampler_order' === setting) {
|
if ('sampler_order' === setting) {
|
||||||
value = Array.isArray(value) ? value : KOBOLDCPP_ORDER;
|
value = Array.isArray(value) ? value : KOBOLDCPP_ORDER;
|
||||||
sortItemsByOrder(value);
|
sortKoboldItemsByOrder(value);
|
||||||
settings.sampler_order = value;
|
settings.sampler_order = value;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ('sampler_priority' === setting) {
|
||||||
|
value = Array.isArray(value) ? value : OOBA_DEFAULT_ORDER;
|
||||||
|
sortOobaItemsByOrder(value);
|
||||||
|
settings.sampler_priority = value;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ('logit_bias' === setting) {
|
if ('logit_bias' === setting) {
|
||||||
settings.logit_bias = Array.isArray(value) ? value : [];
|
settings.logit_bias = Array.isArray(value) ? value : [];
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue