@@ -142,28 +142,6 @@ def llava_eval_image_embed(
142142################################################
143143
144144
145- # struct clip_image_u8_batch {
146- # struct clip_image_u8 * data;
147- # size_t size;
148- # };
149- class clip_image_u8_batch (Structure ):
150- _fields_ = [
151- ("data" , c_void_p ),
152- ("size" , c_size_t ),
153- ]
154-
155-
156- # struct clip_image_f32_batch {
157- # struct clip_image_f32 * data;
158- # size_t size;
159- # };
160- class clip_image_f32_batch (Structure ):
161- _fields_ = [
162- ("data" , c_void_p ),
163- ("size" , c_size_t ),
164- ]
165-
166-
167145# /** load mmproj model */
168146# CLIP_API struct clip_ctx * clip_model_load (const char * fname, int verbosity);
169147@ctypes_function ("clip_model_load" , [c_char_p , c_int ], clip_ctx_p_ctypes )
@@ -192,21 +170,15 @@ def clip_image_u8_free(img: c_void_p, /):
192170 ...
193171
194172
195- # CLIP_API void clip_image_f32_free(struct clip_image_f32 * img);
196- @ctypes_function ("clip_image_f32_free" , [c_void_p ], None )
197- def clip_image_f32_free (img : c_void_p , / ):
198- ...
199-
200-
201- # CLIP_API void clip_image_u8_batch_free (struct clip_image_u8_batch * batch);
202- @ctypes_function ("clip_image_u8_batch_free" , [POINTER (clip_image_u8_batch )], None )
203- def clip_image_u8_batch_free (batch : "_Pointer[clip_image_u8_batch]" , / ):
173+ # CLIP_API struct clip_image_f32_batch * clip_image_f32_batch_init();
174+ @ctypes_function ("clip_image_f32_batch_init" , [], c_void_p )
175+ def clip_image_f32_batch_init () -> Optional [c_void_p ]:
204176 ...
205177
206178
207179# CLIP_API void clip_image_f32_batch_free(struct clip_image_f32_batch * batch);
208- @ctypes_function ("clip_image_f32_batch_free" , [POINTER ( clip_image_f32_batch ) ], None )
209- def clip_image_f32_batch_free (batch : "_Pointer[clip_image_f32_batch]" , / ):
180+ @ctypes_function ("clip_image_f32_batch_free" , [c_void_p ], None )
181+ def clip_image_f32_batch_free (batch : c_void_p , / ):
210182 ...
211183
212184
@@ -217,14 +189,14 @@ def clip_image_f32_batch_free(batch: "_Pointer[clip_image_f32_batch]", /):
217189 [
218190 clip_ctx_p_ctypes ,
219191 c_void_p ,
220- POINTER ( clip_image_f32_batch ) ,
192+ c_void_p ,
221193 ],
222194 c_bool ,
223195)
224196def clip_image_preprocess (
225197 ctx : clip_ctx_p ,
226198 img : c_void_p ,
227- res_imgs : "_Pointer[clip_image_f32_batch]" ,
199+ res_imgs : c_void_p ,
228200 / ,
229201) -> bool :
230202 ...
@@ -236,15 +208,15 @@ def clip_image_preprocess(
236208 [
237209 clip_ctx_p_ctypes ,
238210 c_int ,
239- POINTER ( clip_image_f32_batch ) ,
211+ c_void_p ,
240212 POINTER (c_float ),
241213 ],
242214 c_bool ,
243215)
244216def clip_image_batch_encode (
245217 ctx : clip_ctx_p ,
246218 n_threads : c_int ,
247- imgs : "_Pointer[clip_image_f32_batch]" ,
219+ imgs : c_void_p ,
248220 vec : c_void_p ,
249221 / ,
250222) -> bool :
0 commit comments