Add advanced settings sliders

This commit is contained in:
SillyLossy
2023-03-18 17:31:42 +02:00
parent 1317889dc4
commit 92637fd1f9
5 changed files with 135 additions and 19 deletions

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M256 0a256 256 0 1 0 0 512A256 256 0 1 0 256 0zM135 241c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l87 87 87-87c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9L273 345c-9.4 9.4-24.6 9.4-33.9 0L135 241z"/></svg>

After

Width:  |  Height:  |  Size: 438 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM377 271c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-87-87-87 87c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9L239 167c9.4-9.4 24.6-9.4 33.9 0L377 271z"/></svg>

After

Width:  |  Height:  |  Size: 442 B

View File

@@ -46,6 +46,7 @@
<script type="module" src="scripts/world-info.js"></script>
<script type="module" src="scripts/group-chats.js"></script>
<script type="module" src="scripts/power-user.js"></script>
<script type="module" src="scripts/kai-settings.js"></script>
<title>Tavern.AI</title>
</head>
@@ -542,6 +543,80 @@
min="0" max="2048" step="1"></div>
</div>
</div>
<div class="drawer">
<div class="drawer-toggle drawer-header">
<h3>Advanced Settings</h3>
<div class="drawer-icon down"></div>
</div>
<div class="drawer-content">
<div class="range-block">
<div class="range-block-title">
<h4>Top P Sampling</h4>
</div>
<div class="range-block-counter">
<h5 id="top_p_counter">select</h5>
</div>
<div class="range-block-range">
<input type="range" id="top_p" name="volume" min="0" max="1" step="0.01">
</div>
</div>
<div class="range-block">
<div class="range-block-title">
<h4>Top A Sampling</h4>
</div>
<div class="range-block-counter">
<h5 id="top_a_counter">select</h5>
</div>
<div class="range-block-range">
<input type="range" id="top_a" name="volume" min="0" max="1" step="0.01">
</div>
</div>
<div class="range-block">
<div class="range-block-title">
<h4>Top K Sampling</h4>
</div>
<div class="range-block-counter">
<h5 id="top_k_counter">select</h5>
</div>
<div class="range-block-range">
<input type="range" id="top_k" name="volume" min="0" max="100" step="1">
</div>
</div>
<div class="range-block">
<div class="range-block-title">
<h4>Typical Sampling</h4>
</div>
<div class="range-block-counter">
<h5 id="typical_counter">select</h5>
</div>
<div class="range-block-range">
<input type="range" id="typical" name="volume" min="0" max="1" step="0.01">
</div>
</div>
<div class="range-block">
<div class="range-block-title">
<h4>Tail Free Sampling</h4>
</div>
<div class="range-block-counter">
<h5 id="tfs_counter">select</h5>
</div>
<div class="range-block-range">
<input type="range" id="tfs" name="volume" min="0" max="1" step="0.05">
</div>
</div>
<div class="range-block">
<div class="range-block-title">
<h4>Repetition Penalty Slope</h4>
</div>
<div class="range-block-counter">
<h5 id="rep_pen_slope_counter">select</h5>
</div>
<div class="range-block-range">
<input type="range" id="rep_pen_slope" name="volume" min="0" max="10" step="0.1">
</div>
</div>
</div>
</div>
<div id="softprompt_block">
<h4>Soft Prompt</h4>

View File

@@ -1,6 +1,11 @@
import { humanizedDateTime } from "./scripts/RossAscends-mods.js";
import { encode, decode } from "../scripts/gpt-2-3-tokenizer/mod.js";
import {
kai_settings,
loadKoboldSettings,
} from "./scripts/kai-settings.js";
import {
world_info_budget,
world_info_data,
@@ -37,6 +42,7 @@ export {
Generate,
getSettings,
saveSettings,
saveSettingsDebounced,
printMessages,
clearChat,
getChat,
@@ -1370,13 +1376,13 @@ async function Generate(type, automatic_trigger) {//encode("dsfs").length
max_length: this_amount_gen,//parseInt(amount_gen),
rep_pen: parseFloat(rep_pen),
rep_pen_range: parseInt(rep_pen_size),
rep_pen_slope: this_settings.rep_pen_slope,
rep_pen_slope: kai_settings.rep_pen_slope,
temperature: parseFloat(temp),
tfs: this_settings.tfs,
top_a: this_settings.top_a,
top_k: this_settings.top_k,
top_p: this_settings.top_p,
typical: this_settings.typical,
tfs: kai_settings.tfs,
top_a: kai_settings.top_a,
top_k: kai_settings.top_k,
top_p: kai_settings.top_p,
typical: kai_settings.typical,
s1: this_settings.sampler_order[0],
s2: this_settings.sampler_order[1],
s3: this_settings.sampler_order[2],
@@ -2045,6 +2051,8 @@ async function getSettings(type) {
//console.log('getsettings calling showswipebtns');
showSwipeButtons();
loadKoboldSettings(settings);
//Novel
temp_novel = settings.temp_novel;
rep_pen_novel = settings.rep_pen_novel;
@@ -2193,6 +2201,7 @@ async function saveSettings(type) {
active_character: active_character,
textgenerationwebui_settings: textgenerationwebui_settings,
swipes: swipes,
...kai_settings,
}),
beforeSend: function () {
//console.log('saveSettings() -- active_character -- '+active_character);
@@ -3720,31 +3729,29 @@ $(document).ready(function () {
$("#settings_perset").change(function () {
if ($("#settings_perset").find(":selected").val() != "gui") {
preset_settings = $("#settings_perset").find(":selected").text();
temp = koboldai_settings[koboldai_setting_names[preset_settings]].temp;
amount_gen =
koboldai_settings[koboldai_setting_names[preset_settings]].genamt;
rep_pen =
koboldai_settings[koboldai_setting_names[preset_settings]].rep_pen;
rep_pen_size =
koboldai_settings[koboldai_setting_names[preset_settings]]
.rep_pen_range;
max_context =
koboldai_settings[koboldai_setting_names[preset_settings]].max_length;
const preset = koboldai_settings[koboldai_setting_names[preset_settings]];
loadKoboldSettings(preset);
temp = preset.temp;
$("#temp").val(temp);
$("#temp_counter").html(temp);
amount_gen = preset.genamt;
$("#amount_gen").val(amount_gen);
$("#amount_gen_counter").html(amount_gen);
$("#max_context").val(max_context);
$("#max_context_counter").html(max_context + " Tokens");
rep_pen = preset.rep_pen;
$("#rep_pen").val(rep_pen);
$("#rep_pen_counter").html(rep_pen);
rep_pen_size = preset.rep_pen_range;
$("#rep_pen_size").val(rep_pen_size);
$("#rep_pen_size_counter").html(rep_pen_size + " Tokens");
max_context = preset.max_length;
$("#max_context").val(max_context);
$("#max_context_counter").html(max_context + " Tokens");
$("#range_block").children().prop("disabled", false);
$("#range_block").css("opacity", 1.0);
$("#amount_gen_block").children().prop("disabled", false);

View File

@@ -2782,4 +2782,36 @@ label[for="extensions_autoconnect"] {
.expander {
flex-grow: 1;
}
.drawer {
padding-bottom: 10px;
}
.drawer-icon {
display: block;
cursor: pointer;
width: 26px;
height: 26px;
background-size: cover;
background-repeat: no-repeat;
filter: invert(1) brightness(75%);
}
.drawer-icon.up {
background-image: url('img/circle-chevron-up-solid.svg');
}
.drawer-icon.down {
background-image: url('img/circle-chevron-down-solid.svg');
}
.drawer-header {
display: flex;
justify-content: space-between;
align-items: center;
}
.drawer-content {
display: none;
}