Skip to content

Commit 489f45a

Browse files
Update examples/llava/clip.cpp
Co-authored-by: Xuan-Son Nguyen <[email protected]>
1 parent d954af4 commit 489f45a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

examples/llava/clip.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -763,11 +763,10 @@ static ggml_cgraph * clip_image_build_graph(clip_ctx * ctx, const clip_image_f32
763763

764764
// If this is an embedding feature layer, save the output.
765765
// NOTE: 0 index here refers to the input to the encoder.
766-
for (size_t vl_idx = 0; vl_idx < hparams.vision_feature_layer.size(); vl_idx++) {
767-
if (il == ctx->vision_model.hparams.vision_feature_layer[vl_idx]) {
768-
embedding_stack.push_back(embeddings);
769-
break;
770-
}
766+
const auto & vision_feature_layer = vision_model.hparams.vision_feature_layer;
767+
if (vision_feature_layer.find(il) != vision_feature_layer.end()) {
768+
embedding_stack.push_back(embeddings);
769+
break;
771770
}
772771

773772
//const size_t nb_q_w = model.layers[il].q_w->nb[0];

0 commit comments

Comments
 (0)