Send sampler priority as array
This commit is contained in:
parent
8ba9b5c38b
commit
0c1cf9ff2e
|
@ -47,7 +47,20 @@
|
|||
"ban_eos_token": false,
|
||||
"skip_special_tokens": true,
|
||||
"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_tau": 5,
|
||||
"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="mirostat" draggable="true"><span>Mirostat</span><small></small></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">
|
||||
<span data-i18n="Load default order">Load default order</span>
|
||||
</div>
|
||||
|
|
|
@ -34,6 +34,20 @@ export const 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';
|
||||
|
||||
// Maybe let it be configurable in the future?
|
||||
|
@ -96,7 +110,7 @@ const settings = {
|
|||
negative_prompt: '',
|
||||
grammar_string: '',
|
||||
banned_tokens: '',
|
||||
sampler_priority: '',
|
||||
sampler_priority: OOBA_DEFAULT_ORDER,
|
||||
//n_aphrodite: 1,
|
||||
//best_of_aphrodite: 1,
|
||||
ignore_eos_token_aphrodite: false,
|
||||
|
@ -424,7 +438,7 @@ function loadTextGenSettings(data, loadedSettings) {
|
|||
* Sorts the sampler items by the given order.
|
||||
* @param {any[]} orderArray Sampler order array.
|
||||
*/
|
||||
function sortItemsByOrder(orderArray) {
|
||||
function sortKoboldItemsByOrder(orderArray) {
|
||||
console.debug('Preset samplers order: ' + orderArray);
|
||||
const $draggableItems = $('#koboldcpp_order');
|
||||
|
||||
|
@ -461,37 +475,29 @@ jQuery(function () {
|
|||
|
||||
$('#koboldcpp_default_order').on('click', function () {
|
||||
settings.sampler_order = KOBOLDCPP_ORDER;
|
||||
sortItemsByOrder(settings.sampler_order);
|
||||
sortKoboldItemsByOrder(settings.sampler_order);
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
jQuery(function($) {
|
||||
|
||||
$('#sampler_priority_container').sortable({
|
||||
delay: getSortableDelay(),
|
||||
stop: function() {
|
||||
stop: function () {
|
||||
const order = [];
|
||||
$('#sampler_priority_container').children().each(function() {
|
||||
$('#sampler_priority_container').children().each(function () {
|
||||
order.push($(this).data('name'));
|
||||
});
|
||||
settings.sampler_priority = order.join('\n');
|
||||
settings.sampler_priority = order;
|
||||
console.log('Samplers reordered:', settings.sampler_priority);
|
||||
saveSettingsDebounced();
|
||||
$('#sampler_priority_textgenerationwebui').val(settings.sampler_priority);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
$('#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(defaultOrder);
|
||||
settings.sampler_priority = defaultOrder.join('\n');
|
||||
console.log('Default samplers order loaded:', settings.sampler_priority);
|
||||
saveSettingsDebounced();
|
||||
$('#sampler_priority_textgenerationwebui').val(settings.sampler_priority);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('#textgenerationwebui_default_order').on('click', function () {
|
||||
sortOobaItemsByOrder(OOBA_DEFAULT_ORDER);
|
||||
settings.sampler_priority = OOBA_DEFAULT_ORDER;
|
||||
console.log('Default samplers order loaded:', settings.sampler_priority);
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#textgen_type').on('change', function () {
|
||||
const type = String($(this).val());
|
||||
|
@ -656,11 +662,18 @@ function setSettingByName(setting, value, trigger) {
|
|||
|
||||
if ('sampler_order' === setting) {
|
||||
value = Array.isArray(value) ? value : KOBOLDCPP_ORDER;
|
||||
sortItemsByOrder(value);
|
||||
sortKoboldItemsByOrder(value);
|
||||
settings.sampler_order = value;
|
||||
return;
|
||||
}
|
||||
|
||||
if ('sampler_priority' === setting) {
|
||||
value = Array.isArray(value) ? value : OOBA_DEFAULT_ORDER;
|
||||
sortOobaItemsByOrder(value);
|
||||
settings.sampler_priority = value;
|
||||
return;
|
||||
}
|
||||
|
||||
if ('logit_bias' === setting) {
|
||||
settings.logit_bias = Array.isArray(value) ? value : [];
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue