8000 llava: add more helper functions to check projector types by dm4 · Pull Request #12824 · ggml-org/llama.cpp · GitHub
[go: up one dir, main page]

Skip to content

llava: add more helper functions to check projector types #12824

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

8000
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
llava: add more helper functions to check projector types in clip con…
…text

Signed-off-by: dm4 <sunrisedm4@gmail.com>
  • Loading branch information
dm4 committed Apr 8, 2025
commit dc0fad0a73b431b4e089f2357d1fd949b948b310
9 changes: 9 additions & 0 deletions examples/llava/clip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions examples/llava/clip.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Loading
0