Skip to content

Commit 4d8a7a6

Browse files
committed
fix occasional clip segfault, fix glm4 (+1 squashed commits)
Squashed commits: [bd71cd688] GLM4 fix wip
1 parent e659cad commit 4d8a7a6

File tree

5 files changed

+28
-12
lines changed

5 files changed

+28
-12
lines changed

examples/llava/clip.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,7 +1663,7 @@ struct clip_model_loader {
16631663
}
16641664
}
16651665

1666-
bool handle_older_qwen25vl(projector_type & proj_type)
1666+
bool should_upgrade_older_qwen25vl(projector_type proj_type)
16671667
{
16681668
bool check1 = false;
16691669
bool check2 = false;
@@ -1672,7 +1672,6 @@ struct clip_model_loader {
16721672
if(proj_type==PROJECTOR_TYPE_QWEN2VL && check1 && check2)
16731673
{
16741674
printf("\nWARNING: OLD QWEN2.5VL PROJECTOR DETECTED! Trying to patch in support, but please obtain a new Qwen2.5VL Projector!\n\n");
1675-
proj_type = PROJECTOR_TYPE_QWEN25VL;
16761675
return true;
16771676
}
16781677
return false;
@@ -1717,7 +1716,11 @@ struct clip_model_loader {
17171716
|| ctx_clip.proj_type == PROJECTOR_TYPE_LDP
17181717
|| ctx_clip.proj_type == PROJECTOR_TYPE_LDPV2;
17191718

1720-
q25vl_migrated = handle_older_qwen25vl(ctx_clip.proj_type);
1719+
q25vl_migrated = should_upgrade_older_qwen25vl(ctx_clip.proj_type);
1720+
if(q25vl_migrated)
1721+
{
1722+
ctx_clip.proj_type = PROJECTOR_TYPE_QWEN25VL;
1723+
}
17211724

17221725
{
17231726
std::string mm_patch_merge_type;

gpttype_adapter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1917,7 +1917,7 @@ ModelLoadResult gpttype_load_model(const load_model_inputs inputs, FileFormat in
19171917
add_bos_token = !inputs.no_bos_token;
19181918
if(!add_bos_token)
19191919
{
1920-
printf("\n======\nBOS token prefix was disabled! Your output may be degraded!\n======\n");
1920+
printf("\n======\nBOS token prefix was disabled! Your output may be degraded unless model was designed for it!\n======\n");
19211921
}
19221922

19231923
neox_ctx_v2.hparams.n_ctx = neox_ctx_v3.hparams.n_ctx

kcpp_adapters/AutoGuess.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
"search": ["[gMASK]<sop>"],
116116
"name": "GLM-4",
117117
"adapter": {
118-
"chat_start": "[gMASK]<sop>",
118+
"chat_start": "<sop>",
119119
"system_start": "<|system|>\n",
120120
"system_end": "",
121121
"user_start": "<|user|>\n",

kcpp_adapters/GLM-4.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"system_start": "[gMASK]<sop><|system|>\n",
2+
"system_start": "<|system|>\n",
33
"system_end": "",
44
"user_start": "<|user|>\n",
55
"user_end": "",

klite.embd

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3450,6 +3450,16 @@ Current version indicated by LITEVER below.
34503450
},
34513451
{
34523452
"id":15,
3453+
"name":"GLM-4",
3454+
"user":"<|user|>\\n",
3455+
"user_end":"",
3456+
"assistant":"<|assistant|>",
3457+
"assistant_end":"",
3458+
"system":"<|system|>\\n",
3459+
"system_end":"",
3460+
},
3461+
{
3462+
"id":100,
34533463
"name":"KoboldCppAutomatic",
34543464
"user":"{{[INPUT]}}",
34553465
"user_end":"",
@@ -13736,13 +13746,16 @@ Current version indicated by LITEVER below.
1373613746
newgen = ist + newgen + (addendtag?iet:"");
1373713747
}
1373813748

13739-
if(localsettings.inject_jailbreak_instruct)
13740-
{
13741-
newgen = newgen + localsettings.custom_jailbreak_text.replaceAll("\\n", "\n");
13742-
}
13743-
if(localsettings.force_thinking_tag && localsettings.start_thinking_tag!="")
13749+
if(addendtag)
1374413750
{
13745-
newgen = newgen + localsettings.start_thinking_tag.replaceAll("\\n", "\n");
13751+
if(localsettings.inject_jailbreak_instruct)
13752+
{
13753+
newgen = newgen + localsettings.custom_jailbreak_text.replaceAll("\\n", "\n");
13754+
}
13755+
if(localsettings.force_thinking_tag && localsettings.start_thinking_tag!="")
13756+
{
13757+
newgen = newgen + localsettings.start_thinking_tag.replaceAll("\\n", "\n");
13758+
}
1374613759
}
1374713760
}
1374813761
else //may be continuting existing instruction OR starting a brand new session. check if first action

0 commit comments

Comments
 (0)