Apply suggestions from code review

This commit is contained in:
Xuan-Son Nguyen 2025-01-30 16:17:16 +01:00 committed by GitHub
parent 0d3ad163f0
commit 0536d004cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 17 deletions

View file

@ -2376,9 +2376,8 @@ void clip_free(clip_ctx * ctx) {
} }
size_t clip_embd_nbytes(const struct clip_ctx * ctx) { size_t clip_embd_nbytes(const struct clip_ctx * ctx) {
if(ctx->has_glm_projector) int extra_tokens = ctx->has_glm_projector ? 2 : 0;
return (clip_n_patches(ctx)+2) * clip_n_mmproj_embd(ctx) * sizeof(float); return (clip_n_patches(ctx) + extra_tokens) * clip_n_mmproj_embd(ctx) * sizeof(float);
return clip_n_patches(ctx) * clip_n_mmproj_embd(ctx) * sizeof(float);
} }
size_t clip_embd_nbytes_by_img(const struct clip_ctx * ctx, int img_h, int img_w) { size_t clip_embd_nbytes_by_img(const struct clip_ctx * ctx, int img_h, int img_w) {