pixtral is working only on cpu, however the images are distorted

This commit is contained in:
Concedo 2025-04-24 17:59:47 +08:00
parent f1eb6c4e36
commit 2f645bb1b4
3 changed files with 15 additions and 0 deletions

View file

@ -340,6 +340,16 @@ static bool encode_image_with_clip(clip_ctx * ctx_clip, int n_threads, const cli
return false;
}
}
else if (clip_is_pixtral(ctx_clip)){
clip_image_f32 * img_res = clip_image_f32_get_img(img_res_v.get(), 0);
*n_img_pos = clip_n_patches_by_img(ctx_clip, img_res);
bool encoded = clip_image_encode(ctx_clip, n_threads, img_res, image_embd); // image_embd shape is 576 x 4096
if (!encoded) {
LOG_ERR("Unable to encode image\n");
return false;
}
}
else if (strcmp(mm_patch_merge_type, "spatial_unpad") != 0) {
// flat / default llava-1.5 type embedding
*n_img_pos = clip_n_patches(ctx_clip);