Skip to content

Commit 2461682

Browse files
committed
fix dynamic size
1 parent cb4480a commit 2461682

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

examples/llava/clip.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2809,10 +2809,15 @@ bool clip_image_batch_encode(clip_ctx * ctx, const int n_threads, const clip_ima
28092809
const auto & model = ctx->vision_model;
28102810
const auto & hparams = model.hparams;
28112811

2812+
// TODO @ngxson : this is ugly, need to refactor later
2813+
bool support_dynamic_size = ctx->has_minicpmv_projector
2814+
|| ctx->has_qwen2vl_merger
2815+
|| ctx->proj_type == PROJECTOR_TYPE_PIXTRAL;
2816+
28122817
const int image_size = hparams.image_size;
28132818
int image_size_width = image_size;
28142819
int image_size_height = image_size;
2815-
if (ctx->has_minicpmv_projector | ctx->has_qwen2vl_merger) {
2820+
if (support_dynamic_size) {
28162821
image_size_width = imgs.entries[0]->nx;
28172822
image_size_height = imgs.entries[0]->ny;
28182823
}

0 commit comments

Comments
 (0)