minor bugfixes

This commit is contained in:
Concedo 2025-06-21 18:41:28 +08:00
parent 45f589b78d
commit 6039791adf
2 changed files with 24 additions and 1 deletions

View file

@ -61,7 +61,7 @@ logit_bias_max = 512
dry_seq_break_max = 128 dry_seq_break_max = 128
# global vars # global vars
KcppVersion = "1.94" KcppVersion = "1.94.1"
showdebug = True showdebug = True
kcpp_instance = None #global running instance kcpp_instance = None #global running instance
global_memory = {"tunnel_url": "", "restart_target":"", "input_to_exit":False, "load_complete":False, "restart_override_config_target":""} global_memory = {"tunnel_url": "", "restart_target":"", "input_to_exit":False, "load_complete":False, "restart_override_config_target":""}
@ -899,6 +899,26 @@ def dump_gguf_metadata(file_path): #if you're gonna copy this into your own proj
str_val = val_bytes.split(b'\0', 1)[0].decode('utf-8') str_val = val_bytes.split(b'\0', 1)[0].decode('utf-8')
fptr += str_len fptr += str_len
return str_val return str_val
if datatype == "u16":
val_bytes = data[fptr:fptr + 2]
val = struct.unpack('<H', val_bytes)[0]
fptr += 2
return val
if datatype == "i16":
val_bytes = data[fptr:fptr + 2]
val = struct.unpack('<h', val_bytes)[0]
fptr += 2
return val
if datatype == "u8":
val_bytes = data[fptr:fptr + 1]
val = struct.unpack('<B', val_bytes)[0]
fptr += 1
return val
if datatype == "i8":
val_bytes = data[fptr:fptr + 1]
val = struct.unpack('<b', val_bytes)[0]
fptr += 1
return val
if datatype=="arr": if datatype=="arr":
val_bytes = data[fptr:fptr + 4] val_bytes = data[fptr:fptr + 4]
arr_type = struct.unpack('<I', val_bytes)[0] arr_type = struct.unpack('<I', val_bytes)[0]

View file

@ -589,6 +589,9 @@ sd_generation_outputs sdtype_generate(const sd_generation_inputs inputs)
//ensure prompt has img keyword, otherwise append it //ensure prompt has img keyword, otherwise append it
if (sd_params->prompt.find("img") == std::string::npos) { if (sd_params->prompt.find("img") == std::string::npos) {
sd_params->prompt += " img"; sd_params->prompt += " img";
} else if (sd_params->prompt.rfind("img", 0) == 0) {
// "img" found at the start of the string (position 0), which is not allowed. Add some text before it
sd_params->prompt = "person " + sd_params->prompt;
} }
} }