Merge pull request #33 from NexaAI/weili/dev
fix clip allocation size error for 81-series vlm models
This commit is contained in:
commit
b2958b33dd
1 changed files with 13 additions and 9 deletions
|
@ -1927,16 +1927,20 @@ int clip_n_patches(const struct clip_ctx * ctx) {
|
||||||
|
|
||||||
int n_patches = (params.image_size / params.patch_size) * (params.image_size / params.patch_size);
|
int n_patches = (params.image_size / params.patch_size) * (params.image_size / params.patch_size);
|
||||||
|
|
||||||
if (ctx->proj_type == PROJECTOR_TYPE_LDP || ctx->proj_type == PROJECTOR_TYPE_LDPV2) {
|
if(ctx->omni_vlm_ver_type == omni_vlm_version_type::VLM_81_OCR
|
||||||
n_patches /= 4;
|
|| ctx->omni_vlm_ver_type == omni_vlm_version_type::VLM_81_INSTRUCT) {
|
||||||
} else if (ctx->proj_type == PROJECTOR_TYPE_RESAMPLER) {
|
n_patches /= 9;
|
||||||
if (ctx->minicpmv_version == 2) {
|
|
||||||
n_patches = 96;
|
|
||||||
}
|
|
||||||
else if (ctx->minicpmv_version == 3) {
|
|
||||||
n_patches = 64;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// if (ctx->proj_type == PROJECTOR_TYPE_LDP || ctx->proj_type == PROJECTOR_TYPE_LDPV2) {
|
||||||
|
// n_patches /= 4;
|
||||||
|
// } else if (ctx->proj_type == PROJECTOR_TYPE_RESAMPLER) {
|
||||||
|
// if (ctx->minicpmv_version == 2) {
|
||||||
|
// n_patches = 96;
|
||||||
|
// }
|
||||||
|
// else if (ctx->minicpmv_version == 3) {
|
||||||
|
// n_patches = 64;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
return n_patches;
|
return n_patches;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue