Skip to content

Commit 2ba7803

Browse files
committed
replace_instruct_placeholders is now default
1 parent 9c27ccd commit 2ba7803

File tree

3 files changed

+27
-8
lines changed

3 files changed

+27
-8
lines changed

klite.embd

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3326,7 +3326,7 @@ Current version indicated by LITEVER below.
33263326
img_gen_from_instruct: true,
33273327
img_autogen_type: 0, //0 is off, 1 is on, 2 is smart
33283328
img_allownsfw: true,
3329-
img_cfgscale: 7,
3329+
img_cfgscale: 6,
33303330
img_allowhd: true,
33313331
img_crop: false,
33323332
img_newturn: false,
@@ -9162,6 +9162,11 @@ Current version indicated by LITEVER below.
91629162
final = final.includes("+")?("+"+final.split("+")[1]):final;
91639163
return `https://char-archive.evulid.cc/api/archive/v1/${parts[0]}/image/character/${final}?definition=true`;
91649164
}
9165+
if (parts.length == 2 || parts[0] == 'generic') {
9166+
let final = parts[1];
9167+
final = final.includes("+")?(final.split("+")[1]):final;
9168+
return `https://char-archive.evulid.cc/api/archive/v1/${parts[0]}/image/character/${final}?definition=true`;
9169+
}
91659170
if (parts.length !== 4 || parts[2] !== 'character') {
91669171
//bad format, return original
91679172
return userInput;
@@ -13944,11 +13949,18 @@ Current version indicated by LITEVER below.
1394413949

1394513950
function sanitize_css(input)
1394613951
{
13947-
input = input.replace(/<\s*\/?\s*\w+\s*[^>]*>/gi, "");
13948-
input = input.replace(/</g, "");
13949-
input = input.replace(/(?:javascript|vbscript|file):/gi, "");
13950-
//remove all data elements that aren't jpg, png, gif, webp;base64
13951-
input = input.replace(/data:(?!image\/(jpeg|jpg|png|gif|webp);base64,)[^;\s]*(?:;[^,\s]*)*(?:,[^)\s'"]*)?/gi, "");
13952+
let safeImages = [];
13953+
let counter = 0;
13954+
input = input.replace(/<\s*\/?\s*\w+\s*[^>]*>/gi, ""); //replace html tags
13955+
input = input.replace(/</g, ""); // Remove any remaining `<` characters
13956+
input = input.replace(/data:image\/(jpeg|jpg|png|gif|webp);base64,[A-Za-z0-9+\/=]+/gi, function(match) {
13957+
safeImages.push(match);
13958+
return "__SAFE_IMG_" + (counter++) + "__";
13959+
});
13960+
input = input.replace(/(?:javascript|data|vbscript|file):/gi, "");
13961+
for(let i = 0; i < safeImages.length; i++) {
13962+
input = input.replace("__SAFE_IMG_" + i + "__", safeImages[i]);
13963+
}
1395213964
return input;
1395313965
}
1395413966
function apply_custom_css()

koboldcpp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2408,7 +2408,7 @@ def transform_genparams(genparams, api_format):
24082408
genparams["prompt"] = ollamasysprompt + ollamabodyprompt
24092409

24102410
#final transformations (universal template replace)
2411-
replace_instruct_placeholders = genparams.get('replace_instruct_placeholders', False)
2411+
replace_instruct_placeholders = genparams.get('replace_instruct_placeholders', True)
24122412
stop_sequence = (genparams.get('stop_sequence', []) if genparams.get('stop_sequence', []) is not None else [])
24132413
stop_sequence = stop_sequence[:stop_token_max]
24142414
if replace_instruct_placeholders:

otherarch/sdcpp/stable-diffusion.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class StableDiffusionGGML {
151151
const std::string& vae_path,
152152
const std::string control_net_path,
153153
const std::string embeddings_path,
154-
const std::string id_embeddings_path,
154+
const std::string id_embeddings_path_original,
155155
const std::string& taesd_path,
156156
bool vae_tiling_,
157157
ggml_type wtype,
@@ -163,6 +163,7 @@ class StableDiffusionGGML {
163163
use_tiny_autoencoder = taesd_path.size() > 0;
164164
std::string taesd_path_fixed = taesd_path;
165165
is_loaded_chroma = false;
166+
std::string id_embeddings_path = id_embeddings_path_original;
166167
#ifdef SD_USE_CUDA
167168
LOG_DEBUG("Using CUDA backend");
168169
backend = ggml_backend_cuda_init(0);
@@ -257,6 +258,12 @@ class StableDiffusionGGML {
257258

258259
LOG_INFO("Version: %s ", model_version_to_str[version]);
259260

261+
if(id_embeddings_path!="" && version!=VERSION_SDXL)
262+
{
263+
printf("\n!!!!\nWARNING: PhotoMaker is only compatible with SDXL models. PhotoMaker will be disabled!\n!!!!\n");
264+
id_embeddings_path = "";
265+
}
266+
260267
if(use_tiny_autoencoder)
261268
{
262269
std::string to_search = "taesd.embd";

0 commit comments

Comments
 (0)