fix occasional clip segfault, fix glm4 (+1 squashed commits)

Squashed commits:

[bd71cd688] GLM4 fix wip
This commit is contained in:
Concedo 2025-04-29 00:43:47 +08:00
parent e659cadf48
commit 4d8a7a6594
5 changed files with 28 additions and 12 deletions

View file

@ -1663,7 +1663,7 @@ struct clip_model_loader {
} }
} }
bool handle_older_qwen25vl(projector_type & proj_type) bool should_upgrade_older_qwen25vl(projector_type proj_type)
{ {
bool check1 = false; bool check1 = false;
bool check2 = false; bool check2 = false;
@ -1672,7 +1672,6 @@ struct clip_model_loader {
if(proj_type==PROJECTOR_TYPE_QWEN2VL && check1 && check2) if(proj_type==PROJECTOR_TYPE_QWEN2VL && check1 && check2)
{ {
printf("\nWARNING: OLD QWEN2.5VL PROJECTOR DETECTED! Trying to patch in support, but please obtain a new Qwen2.5VL Projector!\n\n"); printf("\nWARNING: OLD QWEN2.5VL PROJECTOR DETECTED! Trying to patch in support, but please obtain a new Qwen2.5VL Projector!\n\n");
proj_type = PROJECTOR_TYPE_QWEN25VL;
return true; return true;
} }
return false; return false;
@ -1717,7 +1716,11 @@ struct clip_model_loader {
|| ctx_clip.proj_type == PROJECTOR_TYPE_LDP || ctx_clip.proj_type == PROJECTOR_TYPE_LDP
|| ctx_clip.proj_type == PROJECTOR_TYPE_LDPV2; || ctx_clip.proj_type == PROJECTOR_TYPE_LDPV2;
q25vl_migrated = handle_older_qwen25vl(ctx_clip.proj_type); q25vl_migrated = should_upgrade_older_qwen25vl(ctx_clip.proj_type);
if(q25vl_migrated)
{
ctx_clip.proj_type = PROJECTOR_TYPE_QWEN25VL;
}
{ {
std::string mm_patch_merge_type; std::string mm_patch_merge_type;

View file

@ -1917,7 +1917,7 @@ ModelLoadResult gpttype_load_model(const load_model_inputs inputs, FileFormat in
add_bos_token = !inputs.no_bos_token; add_bos_token = !inputs.no_bos_token;
if(!add_bos_token) if(!add_bos_token)
{ {
printf("\n======\nBOS token prefix was disabled! Your output may be degraded!\n======\n"); printf("\n======\nBOS token prefix was disabled! Your output may be degraded unless model was designed for it!\n======\n");
} }
neox_ctx_v2.hparams.n_ctx = neox_ctx_v3.hparams.n_ctx neox_ctx_v2.hparams.n_ctx = neox_ctx_v3.hparams.n_ctx

View file

@ -115,7 +115,7 @@
"search": ["[gMASK]<sop>"], "search": ["[gMASK]<sop>"],
"name": "GLM-4", "name": "GLM-4",
"adapter": { "adapter": {
"chat_start": "[gMASK]<sop>", "chat_start": "<sop>",
"system_start": "<|system|>\n", "system_start": "<|system|>\n",
"system_end": "", "system_end": "",
"user_start": "<|user|>\n", "user_start": "<|user|>\n",

View file

@ -1,5 +1,5 @@
{ {
"system_start": "[gMASK]<sop><|system|>\n", "system_start": "<|system|>\n",
"system_end": "", "system_end": "",
"user_start": "<|user|>\n", "user_start": "<|user|>\n",
"user_end": "", "user_end": "",

View file

@ -3450,6 +3450,16 @@ Current version indicated by LITEVER below.
}, },
{ {
"id":15, "id":15,
"name":"GLM-4",
"user":"<|user|>\\n",
"user_end":"",
"assistant":"<|assistant|>",
"assistant_end":"",
"system":"<|system|>\\n",
"system_end":"",
},
{
"id":100,
"name":"KoboldCppAutomatic", "name":"KoboldCppAutomatic",
"user":"{{[INPUT]}}", "user":"{{[INPUT]}}",
"user_end":"", "user_end":"",
@ -13736,13 +13746,16 @@ Current version indicated by LITEVER below.
newgen = ist + newgen + (addendtag?iet:""); newgen = ist + newgen + (addendtag?iet:"");
} }
if(localsettings.inject_jailbreak_instruct) if(addendtag)
{ {
newgen = newgen + localsettings.custom_jailbreak_text.replaceAll("\\n", "\n"); if(localsettings.inject_jailbreak_instruct)
} {
if(localsettings.force_thinking_tag && localsettings.start_thinking_tag!="") newgen = newgen + localsettings.custom_jailbreak_text.replaceAll("\\n", "\n");
{ }
newgen = newgen + localsettings.start_thinking_tag.replaceAll("\\n", "\n"); if(localsettings.force_thinking_tag && localsettings.start_thinking_tag!="")
{
newgen = newgen + localsettings.start_thinking_tag.replaceAll("\\n", "\n");
}
} }
} }
else //may be continuting existing instruction OR starting a brand new session. check if first action else //may be continuting existing instruction OR starting a brand new session. check if first action