mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
More settings for oobabooga's
This commit is contained in:
@ -8,32 +8,55 @@ export {
|
||||
}
|
||||
|
||||
let textgenerationwebui_settings = {
|
||||
temp: 0.5,
|
||||
top_p: 0.9,
|
||||
top_k: 0,
|
||||
temp: 0.7,
|
||||
top_p: 0.5,
|
||||
top_k: 40,
|
||||
typical_p: 1,
|
||||
rep_pen: 1.1,
|
||||
rep_pen_size: 0,
|
||||
rep_pen: 1.2,
|
||||
no_repeat_ngram_size: 0,
|
||||
penalty_alpha: 0,
|
||||
num_beams: 1,
|
||||
length_penalty: 1,
|
||||
min_length: 0,
|
||||
encoder_rep_pen: 1,
|
||||
do_sample: true,
|
||||
early_stopping: false,
|
||||
seed: -1,
|
||||
};
|
||||
|
||||
const setting_names = [
|
||||
"temp",
|
||||
"rep_pen",
|
||||
"rep_pen_size",
|
||||
"no_repeat_ngram_size",
|
||||
"top_k",
|
||||
"top_p",
|
||||
"typical_p",
|
||||
"penalty_alpha",
|
||||
"num_beams",
|
||||
"length_penalty",
|
||||
"min_length",
|
||||
"encoder_rep_pen",
|
||||
"do_sample",
|
||||
"early_stopping",
|
||||
"seed",
|
||||
];
|
||||
|
||||
function loadTextGenSettings(settings) {
|
||||
textgenerationwebui_settings = settings ? settings : textgenerationwebui_settings;
|
||||
if (settings) {
|
||||
Object.assign(textgenerationwebui_settings, settings);
|
||||
}
|
||||
|
||||
for (const i of setting_names) {
|
||||
const val = parseFloat(textgenerationwebui_settings[i]);
|
||||
$(`#${i}_textgenerationwebui`).val(val);
|
||||
$(`#${i}_counter_textgenerationwebui`).text(val.toFixed(2));
|
||||
const isCheckbox = $(`#${i}_textgenerationwebui`).attr('type') == 'checkbox';
|
||||
if (isCheckbox) {
|
||||
const val = Boolean(textgenerationwebui_settings[i]);
|
||||
$(`#${i}_textgenerationwebui`).prop('checked', val);
|
||||
}
|
||||
else {
|
||||
const val = parseFloat(textgenerationwebui_settings[i]);
|
||||
$(`#${i}_textgenerationwebui`).val(val);
|
||||
$(`#${i}_counter_textgenerationwebui`).text(val.toFixed(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,10 +64,19 @@ $(document).ready(function() {
|
||||
for (const i of setting_names) {
|
||||
$(`#${i}_textgenerationwebui`).attr("x-setting-id", i);
|
||||
$(document).on("input", `#${i}_textgenerationwebui`, function () {
|
||||
const isCheckbox = $(this).attr('type') == 'checkbox';
|
||||
const id = $(this).attr("x-setting-id");
|
||||
const val = parseFloat($(this).val());
|
||||
$(`#${id}_counter_textgenerationwebui`).text(val.toFixed(2));
|
||||
textgenerationwebui_settings[id] = parseFloat(val);
|
||||
|
||||
if (isCheckbox) {
|
||||
const value = $(this).prop('checked');
|
||||
textgenerationwebui_settings[id] = value;
|
||||
}
|
||||
else {
|
||||
const value = parseFloat($(this).val());
|
||||
$(`#${id}_counter_textgenerationwebui`).text(value.toFixed(2));
|
||||
textgenerationwebui_settings[id] = parseFloat(value);
|
||||
}
|
||||
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user