@@ -229,7 +229,9 @@ extern "C" {
229229 bool sorted;
230230 } llama_token_data_array;
231231
232- struct llama_vision_patches ;
232+ // Structure represents the basic input unit of vision model
233+ // This can be a processed image or slices of images under the hood
234+ struct llama_vision_tokens ;
233235
234236 // represent an RGB image
235237 // size of data must be equal to 3*nx*ny
@@ -1286,12 +1288,15 @@ extern "C" {
12861288 LLAMA_API struct llama_vision_bitmap * llama_vision_bitmap_init (uint32_t nx, uint32_t ny);
12871289 LLAMA_API void llama_vision_bitmap_free (struct llama_vision_bitmap * bmp);
12881290
1289- // Create patches from the RGB bitmap
1290- LLAMA_API struct llama_vision_patches * llama_vision_patches_init (struct llama_context * ctx, llama_vision_bitmap * bmp);
1291- LLAMA_API void llama_vision_patches_free (struct llama_vision_patches * p);
1291+ // Create image tokens from the RGB bitmap
1292+ LLAMA_API struct llama_vision_tokens * llama_vision_tokenize (struct llama_context * ctx, llama_vision_bitmap * bmp);
1293+ LLAMA_API void llama_vision_tokens_free (struct llama_vision_tokens * img_tokens);
1294+
1295+ // User must reserve N number of tokens in tokenized text prompt for each image
1296+ // LLAMA_API int32_t llama_vision_get_n_tokens(const llama_vision_img_tokens * img_tokens);
12921297
12931298 // Encode patches into embeddings
1294- LLAMA_API int32_t llama_vision_encode (struct llama_context * ctx, struct llama_vision_patches * p );
1299+ LLAMA_API int32_t llama_vision_encode (struct llama_context * ctx, struct llama_vision_tokens * img_tokens );
12951300 LLAMA_API struct ggml_tensor * llama_vision_get_output_tensor (struct llama_context * ctx);
12961301
12971302 //
0 commit comments