Skip to content

Commit 0ccc121

Browse files
awkrailTaichi Nishimura
andauthored
mtmd : fix the calculation of n_tokens for smolvlm (#13381)
Co-authored-by: Taichi Nishimura <[email protected]>
1 parent 6562e5a commit 0ccc121

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/mtmd/clip.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3010,7 +3010,7 @@ int clip_n_output_tokens(const struct clip_ctx * ctx, struct clip_image_f32 * im
30103010
int n_per_side_2d_pool = n_per_side / params.proj_scale_factor;
30113011
n_patches = n_per_side_2d_pool * n_per_side_2d_pool;
30123012
} else if (ctx->proj_type == PROJECTOR_TYPE_IDEFICS3) {
3013-
n_patches /= params.proj_scale_factor;
3013+
n_patches /= (params.proj_scale_factor * params.proj_scale_factor);
30143014
} else if (ctx->proj_type == PROJECTOR_TYPE_PIXTRAL) {
30153015
int n_merge = params.spatial_merge_size;
30163016
int n_patches_x = img->nx / params.patch_size / (n_merge > 0 ? n_merge : 1);

0 commit comments

Comments
 (0)