Skip to content

Commit 1d594c2

Browse files
hNSBQZngxson
andauthored
clip: (minicpmv) fix resampler kq_scale (ggml-org#17516)
* debug:"solve minicpmv precision problem" * “debug minicpmv” * Apply suggestion from @ngxson --------- Co-authored-by: Xuan-Son Nguyen <[email protected]>
1 parent eec1e33 commit 1d594c2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/mtmd/clip.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1175,10 +1175,11 @@ struct clip_graph {
11751175
cb(K, "resampler_K", -1);
11761176
cb(V, "resampler_V", -1);
11771177

1178+
float resampler_kq_scale = 1.0f/ sqrtf(float(d_head));
11781179
embeddings = build_attn(
11791180
model.mm_model_attn_o_w,
11801181
model.mm_model_attn_o_b,
1181-
Q, K, V, nullptr, kq_scale, -1);
1182+
Q, K, V, nullptr, resampler_kq_scale, -1);
11821183
cb(embeddings, "resampler_attn_out", -1);
11831184
}
11841185
// layernorm

0 commit comments

Comments
 (0)