mirror of
https://github.com/turboderp-org/exui.git
synced 2026-04-20 06:19:11 +00:00
Add new samplers
This commit is contained in:
@@ -104,6 +104,11 @@ def get_default_session_settings():
|
||||
"temperature": 0.8,
|
||||
"top_k": 50,
|
||||
"top_p": 0.8,
|
||||
"min_p": 0.0,
|
||||
"tfs": 0.0,
|
||||
"mirostat": False,
|
||||
"mirostat_tau": 1.25,
|
||||
"mirostat_eta": 0.1,
|
||||
"typical": 0.0,
|
||||
"repp": 1.15,
|
||||
"repr": 1024,
|
||||
@@ -149,7 +154,9 @@ class Session:
|
||||
self.session_uuid = j["session_uuid"]
|
||||
self.history = j["history"]
|
||||
# self.mode = j["mode"]
|
||||
self.settings = j.get("settings", get_default_session_settings())
|
||||
settings = get_default_session_settings()
|
||||
if "settings" in j: settings.update(j["settings"])
|
||||
self.settings = settings
|
||||
|
||||
|
||||
def load(self):
|
||||
@@ -281,7 +288,12 @@ class Session:
|
||||
gen_settings.temperature = self.settings["temperature"]
|
||||
gen_settings.top_k = self.settings["top_k"]
|
||||
gen_settings.top_p = self.settings["top_p"]
|
||||
gen_settings.min_p = self.settings["min_p"]
|
||||
gen_settings.tfs = self.settings["tfs"]
|
||||
gen_settings.typical = self.settings["typical"]
|
||||
gen_settings.mirostat = self.settings["mirostat"]
|
||||
gen_settings.mirostat_tau = self.settings["mirostat_tau"]
|
||||
gen_settings.mirostat_eta = self.settings["mirostat_eta"]
|
||||
gen_settings.token_repetition_penalty = self.settings["repp"]
|
||||
gen_settings.token_repetition_range = self.settings["repr"]
|
||||
gen_settings.token_repetition_decay = self.settings["repr"]
|
||||
|
||||
@@ -427,6 +427,8 @@
|
||||
.sss-item-right.clickable {
|
||||
color: var(--textcolor-head);
|
||||
padding-left: 5px;
|
||||
user-drag: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.sss-item-right.clickable:hover {
|
||||
|
||||
@@ -62,19 +62,32 @@ export class SessionSettings {
|
||||
|
||||
// Sampling
|
||||
|
||||
this.sss_i_temperature = new controls.SettingsSlider("sss-item-left", "Temperature", "sss-item-mid", "sss-item-right sss-item-textbox-r", 2, 0, 3, null, this.settings, "temperature", () => { this.updateView(true); });
|
||||
this.sss_i_topK = new controls.SettingsSlider("sss-item-left", "Top K", "sss-item-mid", "sss-item-right sss-item-textbox-r", 0, 0, 1000, { "0": "off" }, this.settings, "top_k", () => { this.updateView(true); });
|
||||
this.sss_i_topP = new controls.SettingsSlider("sss-item-left", "Top P", "sss-item-mid", "sss-item-right sss-item-textbox-r", 2, 0, 1, { "0.00": "off", "1.00": "off" }, this.settings, "top_p", () => { this.updateView(true); });
|
||||
this.sss_i_typical = new controls.SettingsSlider("sss-item-left", "Typical", "sss-item-mid", "sss-item-right sss-item-textbox-r", 2, 0, 1, { "0.00": "off", "1.00": "off" }, this.settings, "typical", () => { this.updateView(true); });
|
||||
this.sss_i_repPenalty = new controls.SettingsSlider("sss-item-left", "Rep. penalty", "sss-item-mid", "sss-item-right sss-item-textbox-r", 2, 1, 3, { "1.00": "off" }, this.settings, "repp", () => { this.updateView(true); });
|
||||
this.sss_i_repRange = new controls.SettingsSlider("sss-item-left", "Rep. range", "sss-item-mid", "sss-item-right sss-item-textbox-r", 0, 0, 4096, { "0": "off" }, this.settings, "repr", () => { this.updateView(true); });
|
||||
this.sss_i_temperature = new controls.SettingsSlider("sss-item-left", "Temperature", "sss-item-mid", "sss-item-right sss-item-textbox-r", 2, 0, 3, null, this.settings, "temperature", () => { this.updateView(true); });
|
||||
this.sss_i_topK = new controls.SettingsSlider("sss-item-left", "Top K", "sss-item-mid", "sss-item-right sss-item-textbox-r", 0, 0, 1000, { "0": "off" }, this.settings, "top_k", () => { this.updateView(true); });
|
||||
this.sss_i_topP = new controls.SettingsSlider("sss-item-left", "Top P", "sss-item-mid", "sss-item-right sss-item-textbox-r", 2, 0, 1, { "0.00": "off", "1.00": "off" }, this.settings, "top_p", () => { this.updateView(true); });
|
||||
this.sss_i_minP = new controls.SettingsSlider("sss-item-left", "Min P", "sss-item-mid", "sss-item-right sss-item-textbox-r", 2, 0, 1, { "0.00": "off", "1.00": "off" }, this.settings, "min_p", () => { this.updateView(true); });
|
||||
this.sss_i_tfs = new controls.SettingsSlider("sss-item-left", "TFS", "sss-item-mid", "sss-item-right sss-item-textbox-r", 2, 0, 1, { "0.00": "off", "1.00": "off" }, this.settings, "tfs", () => { this.updateView(true); });
|
||||
this.sss_i_typical = new controls.SettingsSlider("sss-item-left", "Typical", "sss-item-mid", "sss-item-right sss-item-textbox-r", 2, 0, 1, { "0.00": "off", "1.00": "off" }, this.settings, "typical", () => { this.updateView(true); });
|
||||
this.sss_i_repPenalty = new controls.SettingsSlider("sss-item-left", "Rep. penalty", "sss-item-mid", "sss-item-right sss-item-textbox-r", 2, 1, 3, { "1.00": "off" }, this.settings, "repp", () => { this.updateView(true); });
|
||||
this.sss_i_repRange = new controls.SettingsSlider("sss-item-left", "Rep. range", "sss-item-mid", "sss-item-right sss-item-textbox-r", 0, 0, 4096, { "0": "off" }, this.settings, "repr", () => { this.updateView(true); });
|
||||
|
||||
this.sss_i_mirostat = new controls.CheckboxLabel("sss-item-right clickable", "Mirostat", this.settings, "mirostat", () => { this.updateView(true); });
|
||||
this.sss_i_mirostat_tau = new controls.SettingsSlider("sss-item-left", "Mirostat Tau", "sss-item-mid", "sss-item-right sss-item-textbox-r", 2, 0.01, 10, null, this.settings, "mirostat_tau", () => { this.updateView(true); });
|
||||
this.sss_i_mirostat_eta = new controls.SettingsSlider("sss-item-left", "Mirostat Eta", "sss-item-mid", "sss-item-right sss-item-textbox-r", 2, 0.01, 5, null, this.settings, "mirostat_eta", () => { this.updateView(true); });
|
||||
|
||||
this.sss_sampling.inner.appendChild(this.sss_i_temperature.element);
|
||||
this.sss_sampling.inner.appendChild(this.sss_i_topK.element);
|
||||
this.sss_sampling.inner.appendChild(this.sss_i_topP.element);
|
||||
this.sss_sampling.inner.appendChild(this.sss_i_minP.element);
|
||||
this.sss_sampling.inner.appendChild(this.sss_i_tfs.element);
|
||||
this.sss_sampling.inner.appendChild(this.sss_i_typical.element);
|
||||
this.sss_sampling.inner.appendChild(this.sss_i_repPenalty.element);
|
||||
this.sss_sampling.inner.appendChild(this.sss_i_repRange.element);
|
||||
|
||||
this.sss_sampling.inner.appendChild(this.sss_i_mirostat.element);
|
||||
this.sss_sampling.inner.appendChild(this.sss_i_mirostat_tau.element);
|
||||
this.sss_sampling.inner.appendChild(this.sss_i_mirostat_eta.element);
|
||||
|
||||
// Stop conditions
|
||||
|
||||
this.sss_i_stopNewline = new controls.CheckboxLabel("sss-item-right clickable", "Stop on newline", this.settings, "stop_newline", () => { this.updateView(true); });
|
||||
@@ -127,6 +140,10 @@ export class SessionSettings {
|
||||
this.sss_roles.setVisible(hasRoles);
|
||||
this.sss_stopConditions.setVisible(hasRoles);
|
||||
|
||||
let mirostat = this.settings.mirostat;
|
||||
this.sss_i_mirostat_tau.setVisible(mirostat);
|
||||
this.sss_i_mirostat_eta.setVisible(mirostat);
|
||||
|
||||
// Send
|
||||
|
||||
if (send) this.send();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
.vflex_line {
|
||||
padding-top: 5px;
|
||||
height-min: 24px;
|
||||
height-min: 32px;
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
|
||||
14
static/controls.js
vendored
14
static/controls.js
vendored
@@ -245,6 +245,13 @@ export class LabelCheckbox {
|
||||
refresh() {
|
||||
this.chkb.checked = this.data[this.data_id];
|
||||
}
|
||||
|
||||
setVisible(visible) {
|
||||
if (visible)
|
||||
this.element.classList.remove("hidden");
|
||||
else
|
||||
this.element.classList.add("hidden");
|
||||
}
|
||||
}
|
||||
|
||||
export class Button {
|
||||
@@ -501,6 +508,13 @@ export class SettingsSlider {
|
||||
this.slider.value = "" + v;
|
||||
this.sliderInput();
|
||||
}
|
||||
|
||||
setVisible(visible) {
|
||||
if (visible)
|
||||
this.element.classList.remove("hidden");
|
||||
else
|
||||
this.element.classList.add("hidden");
|
||||
}
|
||||
}
|
||||
|
||||
export class CheckboxLabel extends LabelCheckbox {
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
border-color: transparent var(--background-color-view); transparent transparent;
|
||||
}
|
||||
|
||||
.settings-float .vflex_line {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.checkbox-sc {
|
||||
color: var(--textcolor-head);
|
||||
align-items: center;
|
||||
@@ -32,6 +36,8 @@
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
padding-left: 5px;
|
||||
user-drag: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.checkbox-sc:hover {
|
||||
|
||||
@@ -33,7 +33,7 @@ body {
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.no-select {
|
||||
|
||||
Reference in New Issue
Block a user