From eb42c73953042e4083adb2593e118fadb956716f Mon Sep 17 00:00:00 2001
From: Concedo <39025047+LostRuins@users.noreply.github.com>
Date: Fri, 24 Nov 2023 14:20:36 +0800
Subject: [PATCH] revert auto rope scaling for already-ropetuned models - just
use their values
---
gpttype_adapter.cpp | 24 ++++++------
klite.embd | 90 ++++++++++++++++++++++++++++-----------------
koboldcpp.py | 2 +-
3 files changed, 70 insertions(+), 46 deletions(-)
diff --git a/gpttype_adapter.cpp b/gpttype_adapter.cpp
index b461ecfde..d3d6d1e6c 100644
--- a/gpttype_adapter.cpp
+++ b/gpttype_adapter.cpp
@@ -941,19 +941,19 @@ ModelLoadResult gpttype_load_model(const load_model_inputs inputs, FileFormat in
llamamodel->hparams.rope_freq_scale_train!=1.0f ||
llamamodel->hparams.rope_scaling_type_train==2)
{
- float ropemultiplier = 1.0f;
- if(llamamodel->hparams.rope_scaling_type_train!=2 &&
- llamamodel->hparams.n_ctx_train > 2048 && clamped_max_context_length > llamamodel->hparams.n_ctx_train)
- {
- ropemultiplier = (float)llamamodel->hparams.n_ctx_train / (float)clamped_max_context_length;
- llama_ctx_params.rope_freq_base = rope_freq_base = llamamodel->hparams.rope_freq_base_train;
- llama_ctx_params.rope_freq_scale = rope_freq_scale = ropemultiplier * llamamodel->hparams.rope_freq_scale_train;
- printf("Automatic RoPE Scaling: Using (scale:%.3f, base:%.1f).\n", rope_freq_scale, rope_freq_base);
- }
- else
- {
+ // float ropemultiplier = 1.0f;
+ // if(llamamodel->hparams.rope_scaling_type_train!=2 &&
+ // llamamodel->hparams.n_ctx_train > 2048 && clamped_max_context_length > llamamodel->hparams.n_ctx_train)
+ // {
+ // ropemultiplier = (float)llamamodel->hparams.n_ctx_train / (float)clamped_max_context_length;
+ // llama_ctx_params.rope_freq_base = rope_freq_base = llamamodel->hparams.rope_freq_base_train;
+ // llama_ctx_params.rope_freq_scale = rope_freq_scale = ropemultiplier * llamamodel->hparams.rope_freq_scale_train;
+ // printf("Automatic RoPE Scaling: Using (scale:%.3f, base:%.1f).\n", rope_freq_scale, rope_freq_base);
+ // }
+ // else
+ // {
printf("Automatic RoPE Scaling: Using model internal value.\n");
- }
+ //}
}
else
{
diff --git a/klite.embd b/klite.embd
index 2909ec920..1878f4980 100644
--- a/klite.embd
+++ b/klite.embd
@@ -6,7 +6,7 @@ It requires no dependencies, installation or setup.
Just copy this single static HTML file anywhere and open it in a browser, or from a webserver.
Please go to https://github.com/LostRuins/lite.koboldai.net for updates on Kobold Lite.
Kobold Lite is under the AGPL v3.0 License unless otherwise exempted. Please do not remove this line.
-Current version: 96
+Current version: 97
-Concedo
-->
@@ -1654,18 +1654,9 @@ Current version: 96
margin: 8px 0 8px;
}
- .cht_inp_hold input {
-
- border: medium none;
- color: #bebebe;
- font-size: 15px;
- min-height: 36px;
- /* width: 100%; */
- outline:none;
- }
-
- .cht_inp
+ .cht_inp_bg
{
+ display: inline-block;
width: calc(100% - 84px);
background: #86868638 none repeat scroll 0 0;
margin-top: 8px;
@@ -1673,8 +1664,23 @@ Current version: 96
border-radius: 16px;
padding-left: 10px;
padding-right: 10px;
+ padding-top: 7px;
}
- .cht_inp.shorter
+ .cht_inp_bg_inner
+ {
+ width: 100%;
+ resize: none;
+ overflow-y:scroll;
+ overflow-x:hidden;
+ background: #00000000 none repeat scroll 0 0;
+ border: medium none;
+ color: #bebebe;
+ font-size: 15px;
+ /* min-height: 36px; */
+ /* width: 100%; */
+ outline:none;
+ }
+ .cht_inp_bg.shorter
{
width: calc(100% - 114px);
}
@@ -3238,7 +3244,7 @@ Current version: 96
var image_db = {}; //stores a dictionary of pending images
var completed_imgs_meta = {}; //stores temp info on completed images like alt text
//key is ID, body is {done:false,queue:10,result:""}
- var stablemodels = []; //stored as {name,count}
+ var stablemodels = [{"name": "stable_diffusion","count": 1}]; //stored as {name,count}
var custom_kobold_endpoint = ""; //if set, does not use horde. Instead, attempts to use this sync endpoint
var custom_oai_endpoint = "";
var custom_oai_key = ""; //if set, uses the OpenAI API to generate
@@ -3599,11 +3605,18 @@ Current version: 96
.setAttribute("content","width=device-width, initial-scale=1, maximum-scale=1");
}
- //fix for copy paste text in firefox
+ //fix for copy paste text in firefox, and also to prevent pasting rich text
{
document.getElementById("gametext").addEventListener("paste", function(e) {
e.preventDefault();
- var text = (e.originalEvent || e).clipboardData.getData('text/plain');
+
+ let text = e.clipboardData
+ ? (e.originalEvent || e).clipboardData.getData('text/plain')
+ : // For IE
+ window.clipboardData
+ ? window.clipboardData.getData('Text')
+ : '';
+ text = escapeHtml(text);
text = text.replace(/\r?\n/g, '
');
document.execCommand("insertHTML", false, text);
});
@@ -7081,9 +7094,9 @@ Current version: 96
{
let sdmodelshtml = "";
for (var i = 0; i < stablemodels.length; ++i) {
- sdmodelshtml += "";
}
- document.getElementById("sdmodels").innerHTML = sdmodelshtml;
+ document.getElementById("generate_images_model").innerHTML = sdmodelshtml;
}
function toggle_preset() {
@@ -7118,13 +7131,10 @@ Current version: 96
break;
}
}
- if (!matched && inputmodel != "*") {
+ if (!matched) {
document.getElementById("generate_images_model").value = defaultsettings.generate_images_model;
}
}
- function clear_sd_model() {
- document.getElementById("generate_images_model").value = "";
- }
function validate_samplers(savesetting = false) {
let samplerstr = document.getElementById("sampler_order").value;
@@ -7665,6 +7675,7 @@ Current version: 96
current_anotetemplate = "[Author's note: <|>]";
document.getElementById("input_text").value = "";
document.getElementById("cht_inp").value = "";
+ chat_resize_input();
image_db = {};
completed_imgs_meta = {};
localsettings.adventure_is_action = false;
@@ -7851,7 +7862,7 @@ Current version: 96
let id_to_cancel = pending_response_id;
//flush any streaming text first
- if(is_using_custom_ep() && pending_response_id!="" && synchro_pending_stream!="")
+ if(is_using_custom_ep() && pending_response_id != "" && (synchro_pending_stream != "" || synchro_polled_response != ""))
{
//apply a short delay of 1s before button reenables
allow_reenable_submitbtn_timestamp = performance.now() + 500;
@@ -7859,7 +7870,10 @@ Current version: 96
update_submit_button(true);
}, 1000);
- synchro_polled_response = synchro_pending_stream;
+ if(synchro_pending_stream!="")
+ {
+ synchro_polled_response = synchro_pending_stream;
+ }
poll_in_progress = false;
horde_poll_nearly_completed = false;
poll_pending_response();
@@ -10219,10 +10233,10 @@ Current version: 96
}
if (localsettings.opmode == 3 && localsettings.chatopponent != "") {
document.getElementById("chat_btnmode_chat").classList.remove("hidden");
- document.getElementById("cht_inp").classList.add("shorter");
+ document.getElementById("cht_inp_bg").classList.add("shorter");
} else {
document.getElementById("chat_btnmode_chat").classList.add("hidden");
- document.getElementById("cht_inp").classList.remove("shorter");
+ document.getElementById("cht_inp_bg").classList.remove("shorter");
}
// Show the 'AI is typing' message if an answer is pending, and prevent the 'send button' from being clicked again.
@@ -10412,12 +10426,21 @@ Current version: 96
}
}
}
+ function chat_resize_input()
+ {
+ //resize chat inp
+ let textarea = document.getElementById("cht_inp");
+ let numberOfLineBreaks = (textarea.value.match(/\n/g) || []).length;
+ numberOfLineBreaks = numberOfLineBreaks>4?4:numberOfLineBreaks;
+ textarea.rows = numberOfLineBreaks+1;
+ }
function chat_submit_generation()
{
//easy solution is to just pump the text into the main box and submit it
document.getElementById("input_text").value = document.getElementById("cht_inp").value;
submit_generation();
document.getElementById("cht_inp").value = "";
+ chat_resize_input();
}
function chat_toggle_actionmenu()
{
@@ -11430,15 +11453,16 @@ Current version: 96