llava: add more helper functions to check projector types in clip context (#12824)
Signed-off-by: dm4 <sunrisedm4@gmail.com>
This commit is contained in:
parent
1d343b4069
commit
2dabf759e7
2 changed files with 11 additions and 0 deletions
|
@ -2840,10 +2840,19 @@ int clip_is_minicpmv(const struct clip_ctx * ctx) {
|
||||||
bool clip_is_glm(const struct clip_ctx * ctx) {
|
bool clip_is_glm(const struct clip_ctx * ctx) {
|
||||||
return ctx->has_glm_projector;
|
return ctx->has_glm_projector;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool clip_is_qwen2vl(const struct clip_ctx * ctx) {
|
bool clip_is_qwen2vl(const struct clip_ctx * ctx) {
|
||||||
return ctx->has_qwen2vl_merger;
|
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
|
// Determine the number of encoder layers to iterate over
|
||||||
int get_deepest_feature_layer(const struct clip_ctx * ctx) {
|
int get_deepest_feature_layer(const struct clip_ctx * ctx) {
|
||||||
// Get the index of the second to last layer; this is the
|
// Get the index of the second to last layer; this is the
|
||||||
|
|
|
@ -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 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_glm(const struct clip_ctx * ctx);
|
||||||
CLIP_API bool clip_is_qwen2vl(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);
|
CLIP_API int get_deepest_feature_layer(const struct clip_ctx * ctx);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue