Skip to content

Commit ae25cd2

Browse files
committed
fix regression
1 parent 2bfa7a4 commit ae25cd2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tools/mtmd/clip.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -952,10 +952,6 @@ struct clip_graph {
952952

953953
ggml_tensor * inp = build_inp();
954954

955-
if (model.patch_bias) {
956-
inp = ggml_add(ctx0, inp, model.patch_bias);
957-
}
958-
959955
// concat class_embeddings and patch_embeddings
960956
if (model.class_embedding) {
961957
inp = ggml_concat(ctx0, inp, model.class_embedding, 1);
@@ -3077,9 +3073,13 @@ int clip_n_output_tokens(const struct clip_ctx * ctx, struct clip_image_f32 * im
30773073

30783074
int n_patches = (params.image_size / params.patch_size) * (params.image_size / params.patch_size);
30793075

3080-
if (ctx->proj_type == PROJECTOR_TYPE_LDP || ctx->proj_type == PROJECTOR_TYPE_LDPV2 || ctx->proj_type == PROJECTOR_TYPE_GLM_EDGE) {
3076+
if (ctx->proj_type == PROJECTOR_TYPE_LDP
3077+
|| ctx->proj_type == PROJECTOR_TYPE_LDPV2
3078+
|| ctx->proj_type == PROJECTOR_TYPE_GLM_EDGE) {
30813079
n_patches /= 4;
3082-
n_patches += 2; // for BOI and EOI token embeddings
3080+
if (ctx->vision_model.mm_glm_tok_boi) {
3081+
n_patches += 2; // for BOI and EOI token embeddings
3082+
}
30833083
} else if (ctx->proj_type == PROJECTOR_TYPE_MINICPMV) {
30843084
if (ctx->minicpmv_version == 2) {
30853085
n_patches = 96;

0 commit comments

Comments
 (0)