]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
llava: add more helper functions to check projector types in clip context (#12824)
authordm4 <redacted>
Tue, 8 Apr 2025 13:49:13 +0000 (21:49 +0800)
committerGitHub <redacted>
Tue, 8 Apr 2025 13:49:13 +0000 (15:49 +0200)
Signed-off-by: dm4 <redacted>
examples/llava/clip.cpp
examples/llava/clip.h

index 1145c816c83d4007c97f0ac7c9f153429c032e0a..e9520f3d1a3784e95d61cbaf1439a82d76781ef6 100644 (file)
@@ -2840,10 +2840,19 @@ int clip_is_minicpmv(const struct clip_ctx * ctx) {
 bool clip_is_glm(const struct clip_ctx * ctx) {
     return ctx->has_glm_projector;
 }
+
 bool clip_is_qwen2vl(const struct clip_ctx * ctx) {
     return ctx->has_qwen2vl_merger;
 }
 
+bool clip_is_llava(const struct clip_ctx * ctx) {
+    return ctx->has_llava_projector;
+}
+
+bool clip_is_gemma3(const struct clip_ctx * ctx) {
+    return ctx->proj_type == PROJECTOR_TYPE_GEMMA3;
+}
+
 // Determine the number of encoder layers to iterate over
 int get_deepest_feature_layer(const struct clip_ctx * ctx) {
     // Get the index of the second to last layer; this is the
index 783bdca3e09f21ce1f539c267841274b63fa716f..d806465bf68bb66af4e9036f959fd0c28e9901fe 100644 (file)
@@ -106,6 +106,8 @@ CLIP_API bool clip_model_quantize(const char * fname_inp, const char * fname_out
 CLIP_API int clip_is_minicpmv(const struct clip_ctx * ctx);
 CLIP_API bool clip_is_glm(const struct clip_ctx * ctx);
 CLIP_API bool clip_is_qwen2vl(const struct clip_ctx * ctx);
+CLIP_API bool clip_is_llava(const struct clip_ctx * ctx);
+CLIP_API bool clip_is_gemma3(const struct clip_ctx * ctx);
 
 CLIP_API int get_deepest_feature_layer(const struct clip_ctx * ctx);