KBaba7/llama.cpp
0
1#ifndef LLAVA_H2#define LLAVA_H3 4#include "ggml.h"5 6#ifdef LLAMA_SHARED7# if defined(_WIN32) && !defined(__MINGW32__)8# ifdef LLAMA_BUILD9# define LLAVA_API __declspec(dllexport)10# else11# define LLAVA_API __declspec(dllimport)12# endif13# else14# define LLAVA_API __attribute__ ((visibility ("default")))15# endif16#else17# define LLAVA_API18#endif19 20#ifdef __cplusplus21extern "C" {22#endif23 24struct clip_ctx;25struct llava_image_embed {26 float * embed;27 int n_image_pos;28};29 30/** sanity check for clip <-> llava embed size match */31LLAVA_API bool llava_validate_embed_size(const struct llama_context * ctx_llama, const struct clip_ctx * ctx_clip);32 33LLAVA_API bool llava_image_embed_make_with_clip_img(struct clip_ctx * ctx_clip, int n_threads, const struct clip_image_u8 * img, float ** image_embd_out, int * n_img_pos_out);34 35/** build an image embed from image file bytes */36LLAVA_API struct llava_image_embed * llava_image_embed_make_with_bytes(struct clip_ctx * ctx_clip, int n_threads, const unsigned char * image_bytes, int image_bytes_length);37/** build an image embed from a path to an image filename */38LLAVA_API struct llava_image_embed * llava_image_embed_make_with_filename(struct clip_ctx * ctx_clip, int n_threads, const char * image_path);39/** free an embedding made with llava_image_embed_make_* */40LLAVA_API void llava_image_embed_free(struct llava_image_embed * embed);41 42/** write the image represented by embed into the llama context with batch size n_batch, starting at context pos n_past. on completion, n_past points to the next position in the context after the image embed. */43LLAVA_API bool llava_eval_image_embed(struct llama_context * ctx_llama, const struct llava_image_embed * embed, int n_batch, int * n_past);44 45#ifdef __cplusplus46}47#endif48 49#endif50 