Skip to content

Commit c8686a6

Browse files
committed
don't mandate mistral common for other model usage
1 parent dd0bf70 commit c8686a6

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

convert_hf_to_gguf.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,15 @@
2929
sys.path.insert(1, str(Path(__file__).parent / 'gguf-py'))
3030
import gguf
3131
from gguf.vocab import MistralTokenizerType, MistralVocab
32-
from mistral_common.tokens.tokenizers.base import TokenizerVersion
33-
from mistral_common.tokens.tokenizers.multimodal import DATASET_MEAN, DATASET_STD
34-
from mistral_common.tokens.tokenizers.tekken import Tekkenizer
35-
from mistral_common.tokens.tokenizers.sentencepiece import (
36-
SentencePieceTokenizer,
37-
)
32+
try:
33+
from mistral_common.tokens.tokenizers.base import TokenizerVersion
34+
from mistral_common.tokens.tokenizers.multimodal import DATASET_MEAN, DATASET_STD
35+
from mistral_common.tokens.tokenizers.tekken import Tekkenizer
36+
from mistral_common.tokens.tokenizers.sentencepiece import (
37+
SentencePieceTokenizer,
38+
)
39+
except Exception:
40+
print("Warning: No Mistral Common Installed. You cannot convert Mistral models.")
3841

3942

4043
logger = logging.getLogger("hf-to-gguf")

klite.embd

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Current version indicated by LITEVER below.
1212
-->
1313

1414
<script id="init-config">
15-
const LITEVER = 284;
15+
const LITEVER = 285;
1616
const urlParams = new URLSearchParams(window.location.search);
1717
var localflag = urlParams.get('local'); //this will be replaced automatically in embedded kcpp
1818
const STORAGE_PREFIX = (localflag?"e_":"")+"kaihordewebui_";
@@ -4142,12 +4142,11 @@ Current version indicated by LITEVER below.
41424142
{
41434143
return !isNaN(parseFloat(n)) && isFinite(n);
41444144
}
4145+
function escapeRegExp(string) {
4146+
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
4147+
}
41454148
function replaceAll(str, find, replace, caseInsensitive=false) //replace all occurances in string with string
41464149
{
4147-
function escapeRegExp(string) {
4148-
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
4149-
}
4150-
41514150
return str.replace(new RegExp(escapeRegExp(find), (caseInsensitive?'gi':'g')), replace);
41524151
}
41534152
function rgb_to_hex(rgbColor) { //convert rgb color to hex
@@ -4939,7 +4938,9 @@ Current version indicated by LITEVER below.
49394938
{
49404939
return "";
49414940
}
4942-
return `${localsettings.start_thinking_tag}([\\s\\S]*?)${localsettings.stop_thinking_tag}`;
4941+
const safeStart = escapeRegExp(localsettings.start_thinking_tag);
4942+
const safeStop = escapeRegExp(localsettings.stop_thinking_tag);
4943+
return `${safeStart}([\\s\\S]*?)${safeStop}`;
49434944
}
49444945

49454946
function remove_all_instruct_tags(text)
@@ -15135,7 +15136,7 @@ Current version indicated by LITEVER below.
1513515136
let matchiter = 0;
1513615137
inputtxt = inputtxt.replace(/%ExpandBtn%(?:\n{0,2})?/g, function (m) {
1513715138
let curr = matches[matchiter];
15138-
let expandedhtml = `<span><button type="button" title="Show Thoughts" class="btn btn-primary" style="font-size:12px;padding:2px 2px;" onclick="toggle_hide_thinking(this)">Show Thoughts (${curr.length} characters)</button><span class="color_lightgreen hidden"><br>${escape_html(curr)}</span><br></span>`;
15139+
let expandedhtml = `<span><button type="button" title="Show Thoughts" class="btn btn-primary" style="font-size:12px;padding:2px 2px;" onclick="toggle_hide_thinking(this)">Show Thoughts (${curr.length} characters)</button><span class="color_lightgreen hidden"><br>${escape_html(curr)}\n</span><br></span>`;
1513915140
if(!curr || curr.trim()=="" || curr.trim()=="/nothink" || curr.trim()==`${localsettings.start_thinking_tag}${localsettings.stop_thinking_tag}`)
1514015141
{
1514115142
expandedhtml = `<span><button type="button" title="No Thoughts" class="btn btn-primary" style="font-size:12px;padding:2px 2px;" onclick="">No Thoughts</button><br></span>`;

koboldcpp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
extra_images_max = 4
6565

6666
# global vars
67-
KcppVersion = "1.99"
67+
KcppVersion = "1.99.1"
6868
showdebug = True
6969
kcpp_instance = None #global running instance
7070
global_memory = {"tunnel_url": "", "restart_target":"", "input_to_exit":False, "load_complete":False, "restart_override_config_target":""}

0 commit comments

Comments
 (0)