#[repr(C)]
pub struct FILE {
_private: [u8; 0],
}
pub const LLAMA_DEFAULT_SEED: u32 = 4294967295;
pub const LLAMA_TOKEN_NULL: i32 = -1;
pub const LLAMA_FILE_MAGIC_GGLA: u32 = 1734831201;
pub const LLAMA_FILE_MAGIC_GGSN: u32 = 1734833006;
pub const LLAMA_FILE_MAGIC_GGSQ: u32 = 1734833009;
pub const LLAMA_SESSION_MAGIC: u32 = 1734833006;
pub const LLAMA_SESSION_VERSION: u32 = 11;
pub const LLAMA_STATE_SEQ_MAGIC: u32 = 1734833009;
pub const LLAMA_STATE_SEQ_VERSION: u32 = 4;
pub const LLAMA_STATE_SEQ_FLAGS_NONE: u32 = 0;
pub const LLAMA_STATE_SEQ_FLAGS_SWA_ONLY: u32 = 1;
pub const LLAMA_STATE_SEQ_FLAGS_PARTIAL_ONLY: u32 = 1;
pub const LLAMA_STATE_SEQ_FLAGS_ON_DEVICE: u32 = 2;
pub type ggml_abort_callback_t = ::std::option::Option<
unsafe extern "C" fn(error_message: *const ::std::os::raw::c_char),
>;
pub const ggml_status_GGML_STATUS_ALLOC_FAILED: ggml_status = -2;
pub const ggml_status_GGML_STATUS_FAILED: ggml_status = -1;
pub const ggml_status_GGML_STATUS_SUCCESS: ggml_status = 0;
pub const ggml_status_GGML_STATUS_ABORTED: ggml_status = 1;
pub type ggml_status = ::std::os::raw::c_int;
pub type ggml_fp16_t = u16;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ggml_bf16_t {
pub bits: u16,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of ggml_bf16_t"][::std::mem::size_of::<ggml_bf16_t>() - 2usize];
["Alignment of ggml_bf16_t"][::std::mem::align_of::<ggml_bf16_t>() - 2usize];
[
"Offset of field: ggml_bf16_t::bits",
][::std::mem::offset_of!(ggml_bf16_t, bits) - 0usize];
};
#[repr(C)]
#[derive(Debug)]
pub struct ggml_object {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug)]
pub struct ggml_context {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug)]
pub struct ggml_cgraph {
_unused: [u8; 0],
}
pub const ggml_type_GGML_TYPE_F32: ggml_type = 0;
pub const ggml_type_GGML_TYPE_F16: ggml_type = 1;
pub const ggml_type_GGML_TYPE_Q4_0: ggml_type = 2;
pub const ggml_type_GGML_TYPE_Q4_1: ggml_type = 3;
pub const ggml_type_GGML_TYPE_Q5_0: ggml_type = 6;
pub const ggml_type_GGML_TYPE_Q5_1: ggml_type = 7;
pub const ggml_type_GGML_TYPE_Q8_0: ggml_type = 8;
pub const ggml_type_GGML_TYPE_Q8_1: ggml_type = 9;
pub const ggml_type_GGML_TYPE_Q2_K: ggml_type = 10;
pub const ggml_type_GGML_TYPE_Q3_K: ggml_type = 11;
pub const ggml_type_GGML_TYPE_Q4_K: ggml_type = 12;
pub const ggml_type_GGML_TYPE_Q5_K: ggml_type = 13;
pub const ggml_type_GGML_TYPE_Q6_K: ggml_type = 14;
pub const ggml_type_GGML_TYPE_Q8_K: ggml_type = 15;
pub const ggml_type_GGML_TYPE_IQ2_XXS: ggml_type = 16;
pub const ggml_type_GGML_TYPE_IQ2_XS: ggml_type = 17;
pub const ggml_type_GGML_TYPE_IQ3_XXS: ggml_type = 18;
pub const ggml_type_GGML_TYPE_IQ1_S: ggml_type = 19;
pub const ggml_type_GGML_TYPE_IQ4_NL: ggml_type = 20;
pub const ggml_type_GGML_TYPE_IQ3_S: ggml_type = 21;
pub const ggml_type_GGML_TYPE_IQ2_S: ggml_type = 22;
pub const ggml_type_GGML_TYPE_IQ4_XS: ggml_type = 23;
pub const ggml_type_GGML_TYPE_I8: ggml_type = 24;
pub const ggml_type_GGML_TYPE_I16: ggml_type = 25;
pub const ggml_type_GGML_TYPE_I32: ggml_type = 26;
pub const ggml_type_GGML_TYPE_I64: ggml_type = 27;
pub const ggml_type_GGML_TYPE_F64: ggml_type = 28;
pub const ggml_type_GGML_TYPE_IQ1_M: ggml_type = 29;
pub const ggml_type_GGML_TYPE_BF16: ggml_type = 30;
pub const ggml_type_GGML_TYPE_TQ1_0: ggml_type = 34;
pub const ggml_type_GGML_TYPE_TQ2_0: ggml_type = 35;
pub const ggml_type_GGML_TYPE_MXFP4: ggml_type = 39;
pub const ggml_type_GGML_TYPE_NVFP4: ggml_type = 40;
pub const ggml_type_GGML_TYPE_Q1_0: ggml_type = 41;
pub const ggml_type_GGML_TYPE_Q2_0: ggml_type = 42;
pub const ggml_type_GGML_TYPE_COUNT: ggml_type = 43;
pub type ggml_type = ::std::os::raw::c_uint;
pub const ggml_prec_GGML_PREC_UNDEFINED: ggml_prec = 0;
pub const ggml_prec_GGML_PREC_DEFAULT: ggml_prec = 0;
pub const ggml_prec_GGML_PREC_F32: ggml_prec = 10;
pub const ggml_prec_GGML_PREC_BF16: ggml_prec = 15;
pub const ggml_prec_GGML_PREC_F16: ggml_prec = 20;
pub const ggml_prec_GGML_PREC_Q8: ggml_prec = 30;
pub const ggml_prec_GGML_PREC_Q4: ggml_prec = 40;
pub type ggml_prec = ::std::os::raw::c_uint;
pub const ggml_op_hint_GGML_HINT_NONE: ggml_op_hint = 0;
pub const ggml_op_hint_GGML_HINT_SRC0_IS_HADAMARD: ggml_op_hint = 1;
pub type ggml_op_hint = ::std::os::raw::c_uint;
pub const ggml_ftype_GGML_FTYPE_UNKNOWN: ggml_ftype = -1;
pub const ggml_ftype_GGML_FTYPE_ALL_F32: ggml_ftype = 0;
pub const ggml_ftype_GGML_FTYPE_MOSTLY_F16: ggml_ftype = 1;
pub const ggml_ftype_GGML_FTYPE_MOSTLY_Q4_0: ggml_ftype = 2;
pub const ggml_ftype_GGML_FTYPE_MOSTLY_Q4_1: ggml_ftype = 3;
pub const ggml_ftype_GGML_FTYPE_MOSTLY_Q4_1_SOME_F16: ggml_ftype = 4;
pub const ggml_ftype_GGML_FTYPE_MOSTLY_Q8_0: ggml_ftype = 7;
pub const ggml_ftype_GGML_FTYPE_MOSTLY_Q5_0: ggml_ftype = 8;
pub const ggml_ftype_GGML_FTYPE_MOSTLY_Q5_1: ggml_ftype = 9;
pub const ggml_ftype_GGML_FTYPE_MOSTLY_Q2_K: ggml_ftype = 10;
pub const ggml_ftype_GGML_FTYPE_MOSTLY_Q3_K: ggml_ftype = 11;
pub const ggml_ftype_GGML_FTYPE_MOSTLY_Q4_K: ggml_ftype = 12;
pub const ggml_ftype_GGML_FTYPE_MOSTLY_Q5_K: ggml_ftype = 13;
pub const ggml_ftype_GGML_FTYPE_MOSTLY_Q6_K: ggml_ftype = 14;
pub const ggml_ftype_GGML_FTYPE_MOSTLY_IQ2_XXS: ggml_ftype = 15;
pub const ggml_ftype_GGML_FTYPE_MOSTLY_IQ2_XS: ggml_ftype = 16;
pub const ggml_ftype_GGML_FTYPE_MOSTLY_IQ3_XXS: ggml_ftype = 17;
pub const ggml_ftype_GGML_FTYPE_MOSTLY_IQ1_S: ggml_ftype = 18;
pub const ggml_ftype_GGML_FTYPE_MOSTLY_IQ4_NL: ggml_ftype = 19;
pub const ggml_ftype_GGML_FTYPE_MOSTLY_IQ3_S: ggml_ftype = 20;
pub const ggml_ftype_GGML_FTYPE_MOSTLY_IQ2_S: ggml_ftype = 21;
pub const ggml_ftype_GGML_FTYPE_MOSTLY_IQ4_XS: ggml_ftype = 22;
pub const ggml_ftype_GGML_FTYPE_MOSTLY_IQ1_M: ggml_ftype = 23;
pub const ggml_ftype_GGML_FTYPE_MOSTLY_BF16: ggml_ftype = 24;
pub const ggml_ftype_GGML_FTYPE_MOSTLY_MXFP4: ggml_ftype = 25;
pub const ggml_ftype_GGML_FTYPE_MOSTLY_NVFP4: ggml_ftype = 26;
pub const ggml_ftype_GGML_FTYPE_MOSTLY_Q1_0: ggml_ftype = 27;
pub const ggml_ftype_GGML_FTYPE_MOSTLY_Q2_0: ggml_ftype = 28;
pub type ggml_ftype = ::std::os::raw::c_int;
pub const ggml_op_GGML_OP_NONE: ggml_op = 0;
pub const ggml_op_GGML_OP_DUP: ggml_op = 1;
pub const ggml_op_GGML_OP_ADD: ggml_op = 2;
pub const ggml_op_GGML_OP_ADD_ID: ggml_op = 3;
pub const ggml_op_GGML_OP_ADD1: ggml_op = 4;
pub const ggml_op_GGML_OP_ACC: ggml_op = 5;
pub const ggml_op_GGML_OP_SUB: ggml_op = 6;
pub const ggml_op_GGML_OP_MUL: ggml_op = 7;
pub const ggml_op_GGML_OP_DIV: ggml_op = 8;
pub const ggml_op_GGML_OP_SQR: ggml_op = 9;
pub const ggml_op_GGML_OP_SQRT: ggml_op = 10;
pub const ggml_op_GGML_OP_LOG: ggml_op = 11;
pub const ggml_op_GGML_OP_SIN: ggml_op = 12;
pub const ggml_op_GGML_OP_COS: ggml_op = 13;
pub const ggml_op_GGML_OP_SUM: ggml_op = 14;
pub const ggml_op_GGML_OP_SUM_ROWS: ggml_op = 15;
pub const ggml_op_GGML_OP_CUMSUM: ggml_op = 16;
pub const ggml_op_GGML_OP_MEAN: ggml_op = 17;
pub const ggml_op_GGML_OP_ARGMAX: ggml_op = 18;
pub const ggml_op_GGML_OP_COUNT_EQUAL: ggml_op = 19;
pub const ggml_op_GGML_OP_REPEAT: ggml_op = 20;
pub const ggml_op_GGML_OP_REPEAT_BACK: ggml_op = 21;
pub const ggml_op_GGML_OP_CONCAT: ggml_op = 22;
pub const ggml_op_GGML_OP_SILU_BACK: ggml_op = 23;
pub const ggml_op_GGML_OP_NORM: ggml_op = 24;
pub const ggml_op_GGML_OP_RMS_NORM: ggml_op = 25;
pub const ggml_op_GGML_OP_RMS_NORM_BACK: ggml_op = 26;
pub const ggml_op_GGML_OP_GROUP_NORM: ggml_op = 27;
pub const ggml_op_GGML_OP_L2_NORM: ggml_op = 28;
pub const ggml_op_GGML_OP_MUL_MAT: ggml_op = 29;
pub const ggml_op_GGML_OP_MUL_MAT_ID: ggml_op = 30;
pub const ggml_op_GGML_OP_OUT_PROD: ggml_op = 31;
pub const ggml_op_GGML_OP_SCALE: ggml_op = 32;
pub const ggml_op_GGML_OP_SET: ggml_op = 33;
pub const ggml_op_GGML_OP_CPY: ggml_op = 34;
pub const ggml_op_GGML_OP_CONT: ggml_op = 35;
pub const ggml_op_GGML_OP_RESHAPE: ggml_op = 36;
pub const ggml_op_GGML_OP_VIEW: ggml_op = 37;
pub const ggml_op_GGML_OP_PERMUTE: ggml_op = 38;
pub const ggml_op_GGML_OP_TRANSPOSE: ggml_op = 39;
pub const ggml_op_GGML_OP_GET_ROWS: ggml_op = 40;
pub const ggml_op_GGML_OP_GET_ROWS_BACK: ggml_op = 41;
pub const ggml_op_GGML_OP_SET_ROWS: ggml_op = 42;
pub const ggml_op_GGML_OP_DIAG: ggml_op = 43;
pub const ggml_op_GGML_OP_DIAG_MASK_INF: ggml_op = 44;
pub const ggml_op_GGML_OP_DIAG_MASK_ZERO: ggml_op = 45;
pub const ggml_op_GGML_OP_SOFT_MAX: ggml_op = 46;
pub const ggml_op_GGML_OP_SOFT_MAX_BACK: ggml_op = 47;
pub const ggml_op_GGML_OP_ROPE: ggml_op = 48;
pub const ggml_op_GGML_OP_ROPE_BACK: ggml_op = 49;
pub const ggml_op_GGML_OP_CLAMP: ggml_op = 50;
pub const ggml_op_GGML_OP_CONV_TRANSPOSE_1D: ggml_op = 51;
pub const ggml_op_GGML_OP_IM2COL: ggml_op = 52;
pub const ggml_op_GGML_OP_IM2COL_BACK: ggml_op = 53;
pub const ggml_op_GGML_OP_IM2COL_3D: ggml_op = 54;
pub const ggml_op_GGML_OP_COL2IM_1D: ggml_op = 55;
pub const ggml_op_GGML_OP_CONV_2D: ggml_op = 56;
pub const ggml_op_GGML_OP_CONV_3D: ggml_op = 57;
pub const ggml_op_GGML_OP_CONV_2D_DW: ggml_op = 58;
pub const ggml_op_GGML_OP_CONV_TRANSPOSE_2D: ggml_op = 59;
pub const ggml_op_GGML_OP_POOL_1D: ggml_op = 60;
pub const ggml_op_GGML_OP_POOL_2D: ggml_op = 61;
pub const ggml_op_GGML_OP_POOL_2D_BACK: ggml_op = 62;
pub const ggml_op_GGML_OP_UPSCALE: ggml_op = 63;
pub const ggml_op_GGML_OP_PAD: ggml_op = 64;
pub const ggml_op_GGML_OP_PAD_REFLECT_1D: ggml_op = 65;
pub const ggml_op_GGML_OP_ROLL: ggml_op = 66;
pub const ggml_op_GGML_OP_ARANGE: ggml_op = 67;
pub const ggml_op_GGML_OP_TIMESTEP_EMBEDDING: ggml_op = 68;
pub const ggml_op_GGML_OP_ARGSORT: ggml_op = 69;
pub const ggml_op_GGML_OP_TOP_K: ggml_op = 70;
pub const ggml_op_GGML_OP_LEAKY_RELU: ggml_op = 71;
pub const ggml_op_GGML_OP_TRI: ggml_op = 72;
pub const ggml_op_GGML_OP_FILL: ggml_op = 73;
pub const ggml_op_GGML_OP_FLASH_ATTN_EXT: ggml_op = 74;
pub const ggml_op_GGML_OP_FLASH_ATTN_BACK: ggml_op = 75;
pub const ggml_op_GGML_OP_SSM_CONV: ggml_op = 76;
pub const ggml_op_GGML_OP_SSM_SCAN: ggml_op = 77;
pub const ggml_op_GGML_OP_WIN_PART: ggml_op = 78;
pub const ggml_op_GGML_OP_WIN_UNPART: ggml_op = 79;
pub const ggml_op_GGML_OP_GET_REL_POS: ggml_op = 80;
pub const ggml_op_GGML_OP_ADD_REL_POS: ggml_op = 81;
pub const ggml_op_GGML_OP_RWKV_WKV6: ggml_op = 82;
pub const ggml_op_GGML_OP_GATED_LINEAR_ATTN: ggml_op = 83;
pub const ggml_op_GGML_OP_RWKV_WKV7: ggml_op = 84;
pub const ggml_op_GGML_OP_SOLVE_TRI: ggml_op = 85;
pub const ggml_op_GGML_OP_GATED_DELTA_NET: ggml_op = 86;
pub const ggml_op_GGML_OP_LIGHTNING_INDEXER: ggml_op = 87;
pub const ggml_op_GGML_OP_DSV4_HC_COMB: ggml_op = 88;
pub const ggml_op_GGML_OP_DSV4_HC_PRE: ggml_op = 89;
pub const ggml_op_GGML_OP_DSV4_HC_POST: ggml_op = 90;
pub const ggml_op_GGML_OP_UNARY: ggml_op = 91;
pub const ggml_op_GGML_OP_MAP_CUSTOM1: ggml_op = 92;
pub const ggml_op_GGML_OP_MAP_CUSTOM2: ggml_op = 93;
pub const ggml_op_GGML_OP_MAP_CUSTOM3: ggml_op = 94;
pub const ggml_op_GGML_OP_CUSTOM: ggml_op = 95;
pub const ggml_op_GGML_OP_CROSS_ENTROPY_LOSS: ggml_op = 96;
pub const ggml_op_GGML_OP_CROSS_ENTROPY_LOSS_BACK: ggml_op = 97;
pub const ggml_op_GGML_OP_OPT_STEP_ADAMW: ggml_op = 98;
pub const ggml_op_GGML_OP_OPT_STEP_SGD: ggml_op = 99;
pub const ggml_op_GGML_OP_GLU: ggml_op = 100;
pub const ggml_op_GGML_OP_COUNT: ggml_op = 101;
pub type ggml_op = ::std::os::raw::c_uint;
pub const ggml_unary_op_GGML_UNARY_OP_ABS: ggml_unary_op = 0;
pub const ggml_unary_op_GGML_UNARY_OP_SGN: ggml_unary_op = 1;
pub const ggml_unary_op_GGML_UNARY_OP_NEG: ggml_unary_op = 2;
pub const ggml_unary_op_GGML_UNARY_OP_STEP: ggml_unary_op = 3;
pub const ggml_unary_op_GGML_UNARY_OP_TANH: ggml_unary_op = 4;
pub const ggml_unary_op_GGML_UNARY_OP_ELU: ggml_unary_op = 5;
pub const ggml_unary_op_GGML_UNARY_OP_RELU: ggml_unary_op = 6;
pub const ggml_unary_op_GGML_UNARY_OP_SIGMOID: ggml_unary_op = 7;
pub const ggml_unary_op_GGML_UNARY_OP_GELU: ggml_unary_op = 8;
pub const ggml_unary_op_GGML_UNARY_OP_GELU_QUICK: ggml_unary_op = 9;
pub const ggml_unary_op_GGML_UNARY_OP_SILU: ggml_unary_op = 10;
pub const ggml_unary_op_GGML_UNARY_OP_HARDSWISH: ggml_unary_op = 11;
pub const ggml_unary_op_GGML_UNARY_OP_HARDSIGMOID: ggml_unary_op = 12;
pub const ggml_unary_op_GGML_UNARY_OP_EXP: ggml_unary_op = 13;
pub const ggml_unary_op_GGML_UNARY_OP_EXPM1: ggml_unary_op = 14;
pub const ggml_unary_op_GGML_UNARY_OP_SOFTPLUS: ggml_unary_op = 15;
pub const ggml_unary_op_GGML_UNARY_OP_GELU_ERF: ggml_unary_op = 16;
pub const ggml_unary_op_GGML_UNARY_OP_XIELU: ggml_unary_op = 17;
pub const ggml_unary_op_GGML_UNARY_OP_FLOOR: ggml_unary_op = 18;
pub const ggml_unary_op_GGML_UNARY_OP_CEIL: ggml_unary_op = 19;
pub const ggml_unary_op_GGML_UNARY_OP_ROUND: ggml_unary_op = 20;
pub const ggml_unary_op_GGML_UNARY_OP_TRUNC: ggml_unary_op = 21;
pub const ggml_unary_op_GGML_UNARY_OP_COUNT: ggml_unary_op = 22;
pub type ggml_unary_op = ::std::os::raw::c_uint;
pub const ggml_glu_op_GGML_GLU_OP_REGLU: ggml_glu_op = 0;
pub const ggml_glu_op_GGML_GLU_OP_GEGLU: ggml_glu_op = 1;
pub const ggml_glu_op_GGML_GLU_OP_SWIGLU: ggml_glu_op = 2;
pub const ggml_glu_op_GGML_GLU_OP_SWIGLU_OAI: ggml_glu_op = 3;
pub const ggml_glu_op_GGML_GLU_OP_GEGLU_ERF: ggml_glu_op = 4;
pub const ggml_glu_op_GGML_GLU_OP_GEGLU_QUICK: ggml_glu_op = 5;
pub const ggml_glu_op_GGML_GLU_OP_SWIGLU_CLAMP: ggml_glu_op = 6;
pub const ggml_glu_op_GGML_GLU_OP_COUNT: ggml_glu_op = 7;
pub type ggml_glu_op = ::std::os::raw::c_uint;
pub const ggml_object_type_GGML_OBJECT_TYPE_TENSOR: ggml_object_type = 0;
pub const ggml_object_type_GGML_OBJECT_TYPE_GRAPH: ggml_object_type = 1;
pub const ggml_object_type_GGML_OBJECT_TYPE_WORK_BUFFER: ggml_object_type = 2;
pub type ggml_object_type = ::std::os::raw::c_uint;
pub const ggml_log_level_GGML_LOG_LEVEL_NONE: ggml_log_level = 0;
pub const ggml_log_level_GGML_LOG_LEVEL_DEBUG: ggml_log_level = 1;
pub const ggml_log_level_GGML_LOG_LEVEL_INFO: ggml_log_level = 2;
pub const ggml_log_level_GGML_LOG_LEVEL_WARN: ggml_log_level = 3;
pub const ggml_log_level_GGML_LOG_LEVEL_ERROR: ggml_log_level = 4;
pub const ggml_log_level_GGML_LOG_LEVEL_CONT: ggml_log_level = 5;
pub type ggml_log_level = ::std::os::raw::c_uint;
pub const ggml_tensor_flag_GGML_TENSOR_FLAG_INPUT: ggml_tensor_flag = 1;
pub const ggml_tensor_flag_GGML_TENSOR_FLAG_OUTPUT: ggml_tensor_flag = 2;
pub const ggml_tensor_flag_GGML_TENSOR_FLAG_PARAM: ggml_tensor_flag = 4;
pub const ggml_tensor_flag_GGML_TENSOR_FLAG_LOSS: ggml_tensor_flag = 8;
pub const ggml_tensor_flag_GGML_TENSOR_FLAG_COMPUTE: ggml_tensor_flag = 16;
pub type ggml_tensor_flag = ::std::os::raw::c_uint;
pub const ggml_tri_type_GGML_TRI_TYPE_UPPER_DIAG: ggml_tri_type = 0;
pub const ggml_tri_type_GGML_TRI_TYPE_UPPER: ggml_tri_type = 1;
pub const ggml_tri_type_GGML_TRI_TYPE_LOWER_DIAG: ggml_tri_type = 2;
pub const ggml_tri_type_GGML_TRI_TYPE_LOWER: ggml_tri_type = 3;
pub type ggml_tri_type = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ggml_init_params {
pub mem_size: usize,
pub mem_buffer: *mut ::std::os::raw::c_void,
pub no_alloc: bool,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of ggml_init_params"][::std::mem::size_of::<ggml_init_params>() - 24usize];
[
"Alignment of ggml_init_params",
][::std::mem::align_of::<ggml_init_params>() - 8usize];
[
"Offset of field: ggml_init_params::mem_size",
][::std::mem::offset_of!(ggml_init_params, mem_size) - 0usize];
[
"Offset of field: ggml_init_params::mem_buffer",
][::std::mem::offset_of!(ggml_init_params, mem_buffer) - 8usize];
[
"Offset of field: ggml_init_params::no_alloc",
][::std::mem::offset_of!(ggml_init_params, no_alloc) - 16usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ggml_tensor {
pub type_: ggml_type,
pub buffer: *mut ggml_backend_buffer,
pub ne: [i64; 4usize],
pub nb: [usize; 4usize],
pub op: ggml_op,
pub op_params: [i32; 16usize],
pub flags: i32,
pub src: [*mut ggml_tensor; 10usize],
pub view_src: *mut ggml_tensor,
pub view_offs: usize,
pub data: *mut ::std::os::raw::c_void,
pub name: [::std::os::raw::c_char; 64usize],
pub extra: *mut ::std::os::raw::c_void,
pub padding: [::std::os::raw::c_char; 8usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of ggml_tensor"][::std::mem::size_of::<ggml_tensor>() - 336usize];
["Alignment of ggml_tensor"][::std::mem::align_of::<ggml_tensor>() - 8usize];
[
"Offset of field: ggml_tensor::type_",
][::std::mem::offset_of!(ggml_tensor, type_) - 0usize];
[
"Offset of field: ggml_tensor::buffer",
][::std::mem::offset_of!(ggml_tensor, buffer) - 8usize];
[
"Offset of field: ggml_tensor::ne",
][::std::mem::offset_of!(ggml_tensor, ne) - 16usize];
[
"Offset of field: ggml_tensor::nb",
][::std::mem::offset_of!(ggml_tensor, nb) - 48usize];
[
"Offset of field: ggml_tensor::op",
][::std::mem::offset_of!(ggml_tensor, op) - 80usize];
[
"Offset of field: ggml_tensor::op_params",
][::std::mem::offset_of!(ggml_tensor, op_params) - 84usize];
[
"Offset of field: ggml_tensor::flags",
][::std::mem::offset_of!(ggml_tensor, flags) - 148usize];
[
"Offset of field: ggml_tensor::src",
][::std::mem::offset_of!(ggml_tensor, src) - 152usize];
[
"Offset of field: ggml_tensor::view_src",
][::std::mem::offset_of!(ggml_tensor, view_src) - 232usize];
[
"Offset of field: ggml_tensor::view_offs",
][::std::mem::offset_of!(ggml_tensor, view_offs) - 240usize];
[
"Offset of field: ggml_tensor::data",
][::std::mem::offset_of!(ggml_tensor, data) - 248usize];
[
"Offset of field: ggml_tensor::name",
][::std::mem::offset_of!(ggml_tensor, name) - 256usize];
[
"Offset of field: ggml_tensor::extra",
][::std::mem::offset_of!(ggml_tensor, extra) - 320usize];
[
"Offset of field: ggml_tensor::padding",
][::std::mem::offset_of!(ggml_tensor, padding) - 328usize];
};
pub type ggml_abort_callback = ::std::option::Option<
unsafe extern "C" fn(data: *mut ::std::os::raw::c_void) -> bool,
>;
pub type ggml_guid = [u8; 16usize];
pub type ggml_guid_t = *mut ggml_guid;
unsafe extern "C" {
pub fn ggml_log_inplace(
ctx: *mut ggml_context,
a: *mut ggml_tensor,
) -> *mut ggml_tensor;
}
pub const ggml_op_pool_GGML_OP_POOL_MAX: ggml_op_pool = 0;
pub const ggml_op_pool_GGML_OP_POOL_AVG: ggml_op_pool = 1;
pub const ggml_op_pool_GGML_OP_POOL_COUNT: ggml_op_pool = 2;
pub type ggml_op_pool = ::std::os::raw::c_uint;
pub const ggml_scale_mode_GGML_SCALE_MODE_NEAREST: ggml_scale_mode = 0;
pub const ggml_scale_mode_GGML_SCALE_MODE_BILINEAR: ggml_scale_mode = 1;
pub const ggml_scale_mode_GGML_SCALE_MODE_BICUBIC: ggml_scale_mode = 2;
pub const ggml_scale_mode_GGML_SCALE_MODE_COUNT: ggml_scale_mode = 3;
pub type ggml_scale_mode = ::std::os::raw::c_uint;
pub const ggml_scale_flag_GGML_SCALE_FLAG_ALIGN_CORNERS: ggml_scale_flag = 256;
pub const ggml_scale_flag_GGML_SCALE_FLAG_ANTIALIAS: ggml_scale_flag = 512;
pub type ggml_scale_flag = ::std::os::raw::c_uint;
pub const ggml_sort_order_GGML_SORT_ORDER_ASC: ggml_sort_order = 0;
pub const ggml_sort_order_GGML_SORT_ORDER_DESC: ggml_sort_order = 1;
pub type ggml_sort_order = ::std::os::raw::c_uint;
pub type ggml_custom1_op_t = ::std::option::Option<
unsafe extern "C" fn(
dst: *mut ggml_tensor,
a: *const ggml_tensor,
ith: ::std::os::raw::c_int,
nth: ::std::os::raw::c_int,
userdata: *mut ::std::os::raw::c_void,
),
>;
pub type ggml_custom2_op_t = ::std::option::Option<
unsafe extern "C" fn(
dst: *mut ggml_tensor,
a: *const ggml_tensor,
b: *const ggml_tensor,
ith: ::std::os::raw::c_int,
nth: ::std::os::raw::c_int,
userdata: *mut ::std::os::raw::c_void,
),
>;
pub type ggml_custom3_op_t = ::std::option::Option<
unsafe extern "C" fn(
dst: *mut ggml_tensor,
a: *const ggml_tensor,
b: *const ggml_tensor,
c: *const ggml_tensor,
ith: ::std::os::raw::c_int,
nth: ::std::os::raw::c_int,
userdata: *mut ::std::os::raw::c_void,
),
>;
pub type ggml_custom_op_t = ::std::option::Option<
unsafe extern "C" fn(
dst: *mut ggml_tensor,
ith: ::std::os::raw::c_int,
nth: ::std::os::raw::c_int,
userdata: *mut ::std::os::raw::c_void,
),
>;
pub type ggml_log_callback = ::std::option::Option<
unsafe extern "C" fn(
level: ggml_log_level,
text: *const ::std::os::raw::c_char,
user_data: *mut ::std::os::raw::c_void,
),
>;
unsafe extern "C" {
pub fn ggml_log_get(
log_callback: *mut ggml_log_callback,
user_data: *mut *mut ::std::os::raw::c_void,
);
}
unsafe extern "C" {
pub fn ggml_log_set(
log_callback: ggml_log_callback,
user_data: *mut ::std::os::raw::c_void,
);
}
pub type ggml_to_float_t = ::std::option::Option<
unsafe extern "C" fn(x: *const ::std::os::raw::c_void, y: *mut f32, k: i64),
>;
pub type ggml_from_float_t = ::std::option::Option<
unsafe extern "C" fn(x: *const f32, y: *mut ::std::os::raw::c_void, k: i64),
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ggml_type_traits {
pub type_name: *const ::std::os::raw::c_char,
pub blck_size: i64,
pub blck_size_interleave: i64,
pub type_size: usize,
pub is_quantized: bool,
pub to_float: ggml_to_float_t,
pub from_float_ref: ggml_from_float_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of ggml_type_traits"][::std::mem::size_of::<ggml_type_traits>() - 56usize];
[
"Alignment of ggml_type_traits",
][::std::mem::align_of::<ggml_type_traits>() - 8usize];
[
"Offset of field: ggml_type_traits::type_name",
][::std::mem::offset_of!(ggml_type_traits, type_name) - 0usize];
[
"Offset of field: ggml_type_traits::blck_size",
][::std::mem::offset_of!(ggml_type_traits, blck_size) - 8usize];
[
"Offset of field: ggml_type_traits::blck_size_interleave",
][::std::mem::offset_of!(ggml_type_traits, blck_size_interleave) - 16usize];
[
"Offset of field: ggml_type_traits::type_size",
][::std::mem::offset_of!(ggml_type_traits, type_size) - 24usize];
[
"Offset of field: ggml_type_traits::is_quantized",
][::std::mem::offset_of!(ggml_type_traits, is_quantized) - 32usize];
[
"Offset of field: ggml_type_traits::to_float",
][::std::mem::offset_of!(ggml_type_traits, to_float) - 40usize];
[
"Offset of field: ggml_type_traits::from_float_ref",
][::std::mem::offset_of!(ggml_type_traits, from_float_ref) - 48usize];
};
pub const ggml_sched_priority_GGML_SCHED_PRIO_LOW: ggml_sched_priority = -1;
pub const ggml_sched_priority_GGML_SCHED_PRIO_NORMAL: ggml_sched_priority = 0;
pub const ggml_sched_priority_GGML_SCHED_PRIO_MEDIUM: ggml_sched_priority = 1;
pub const ggml_sched_priority_GGML_SCHED_PRIO_HIGH: ggml_sched_priority = 2;
pub const ggml_sched_priority_GGML_SCHED_PRIO_REALTIME: ggml_sched_priority = 3;
pub type ggml_sched_priority = ::std::os::raw::c_int;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ggml_threadpool_params {
pub cpumask: [bool; 512usize],
pub n_threads: ::std::os::raw::c_int,
pub prio: ggml_sched_priority,
pub poll: u32,
pub strict_cpu: bool,
pub paused: bool,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of ggml_threadpool_params",
][::std::mem::size_of::<ggml_threadpool_params>() - 528usize];
[
"Alignment of ggml_threadpool_params",
][::std::mem::align_of::<ggml_threadpool_params>() - 4usize];
[
"Offset of field: ggml_threadpool_params::cpumask",
][::std::mem::offset_of!(ggml_threadpool_params, cpumask) - 0usize];
[
"Offset of field: ggml_threadpool_params::n_threads",
][::std::mem::offset_of!(ggml_threadpool_params, n_threads) - 512usize];
[
"Offset of field: ggml_threadpool_params::prio",
][::std::mem::offset_of!(ggml_threadpool_params, prio) - 516usize];
[
"Offset of field: ggml_threadpool_params::poll",
][::std::mem::offset_of!(ggml_threadpool_params, poll) - 520usize];
[
"Offset of field: ggml_threadpool_params::strict_cpu",
][::std::mem::offset_of!(ggml_threadpool_params, strict_cpu) - 524usize];
[
"Offset of field: ggml_threadpool_params::paused",
][::std::mem::offset_of!(ggml_threadpool_params, paused) - 525usize];
};
#[repr(C)]
#[derive(Debug)]
pub struct ggml_threadpool {
_unused: [u8; 0],
}
pub type ggml_threadpool_t = *mut ggml_threadpool;
#[repr(C)]
#[derive(Debug)]
pub struct ggml_backend_buffer_type {
_unused: [u8; 0],
}
pub type ggml_backend_buffer_type_t = *mut ggml_backend_buffer_type;
pub type ggml_backend_buffer_t = *mut ggml_backend_buffer;
#[repr(C)]
#[derive(Debug)]
pub struct ggml_backend {
_unused: [u8; 0],
}
pub type ggml_backend_t = *mut ggml_backend;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ggml_tallocr {
pub buffer: ggml_backend_buffer_t,
pub base: *mut ::std::os::raw::c_void,
pub alignment: usize,
pub offset: usize,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of ggml_tallocr"][::std::mem::size_of::<ggml_tallocr>() - 32usize];
["Alignment of ggml_tallocr"][::std::mem::align_of::<ggml_tallocr>() - 8usize];
[
"Offset of field: ggml_tallocr::buffer",
][::std::mem::offset_of!(ggml_tallocr, buffer) - 0usize];
[
"Offset of field: ggml_tallocr::base",
][::std::mem::offset_of!(ggml_tallocr, base) - 8usize];
[
"Offset of field: ggml_tallocr::alignment",
][::std::mem::offset_of!(ggml_tallocr, alignment) - 16usize];
[
"Offset of field: ggml_tallocr::offset",
][::std::mem::offset_of!(ggml_tallocr, offset) - 24usize];
};
#[repr(C)]
#[derive(Debug)]
pub struct ggml_gallocr {
_unused: [u8; 0],
}
pub type ggml_gallocr_t = *mut ggml_gallocr;
unsafe extern "C" {
pub fn ggml_backend_alloc_ctx_tensors_from_buft_size(
ctx: *mut ggml_context,
buft: ggml_backend_buffer_type_t,
) -> usize;
}
unsafe extern "C" {
pub fn ggml_backend_alloc_ctx_tensors_from_buft(
ctx: *mut ggml_context,
buft: ggml_backend_buffer_type_t,
) -> *mut ggml_backend_buffer;
}
unsafe extern "C" {
pub fn ggml_backend_alloc_ctx_tensors(
ctx: *mut ggml_context,
backend: ggml_backend_t,
) -> *mut ggml_backend_buffer;
}
#[repr(C)]
#[derive(Debug)]
pub struct ggml_backend_event {
_unused: [u8; 0],
}
pub type ggml_backend_event_t = *mut ggml_backend_event;
pub type ggml_backend_graph_plan_t = *mut ::std::os::raw::c_void;
#[repr(C)]
#[derive(Debug)]
pub struct ggml_backend_reg {
_unused: [u8; 0],
}
pub type ggml_backend_reg_t = *mut ggml_backend_reg;
#[repr(C)]
#[derive(Debug)]
pub struct ggml_backend_device {
_unused: [u8; 0],
}
pub type ggml_backend_dev_t = *mut ggml_backend_device;
unsafe extern "C" {
pub fn ggml_backend_buft_name(
buft: ggml_backend_buffer_type_t,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn ggml_backend_buft_alloc_buffer(
buft: ggml_backend_buffer_type_t,
size: usize,
) -> ggml_backend_buffer_t;
}
unsafe extern "C" {
pub fn ggml_backend_buft_alloc_buffer_n(
buft: ggml_backend_buffer_type_t,
tensors: *mut *mut ggml_tensor,
n_tensors: ::std::os::raw::c_int,
) -> ggml_backend_buffer_t;
}
unsafe extern "C" {
pub fn ggml_backend_buft_get_alignment(buft: ggml_backend_buffer_type_t) -> usize;
}
unsafe extern "C" {
pub fn ggml_backend_buft_get_max_size(buft: ggml_backend_buffer_type_t) -> usize;
}
unsafe extern "C" {
pub fn ggml_backend_buft_get_alloc_size(
buft: ggml_backend_buffer_type_t,
tensor: *const ggml_tensor,
) -> usize;
}
unsafe extern "C" {
pub fn ggml_backend_buft_get_alloc_size_n(
buft: ggml_backend_buffer_type_t,
tensors: *mut *mut ggml_tensor,
n_tensors: ::std::os::raw::c_int,
) -> usize;
}
unsafe extern "C" {
pub fn ggml_backend_buft_is_host(buft: ggml_backend_buffer_type_t) -> bool;
}
unsafe extern "C" {
pub fn ggml_backend_buft_get_device(
buft: ggml_backend_buffer_type_t,
) -> ggml_backend_dev_t;
}
pub const ggml_backend_buffer_usage_GGML_BACKEND_BUFFER_USAGE_ANY: ggml_backend_buffer_usage = 0;
pub const ggml_backend_buffer_usage_GGML_BACKEND_BUFFER_USAGE_WEIGHTS: ggml_backend_buffer_usage = 1;
pub const ggml_backend_buffer_usage_GGML_BACKEND_BUFFER_USAGE_COMPUTE: ggml_backend_buffer_usage = 2;
pub type ggml_backend_buffer_usage = ::std::os::raw::c_uint;
unsafe extern "C" {
pub fn ggml_backend_buffer_name(
buffer: ggml_backend_buffer_t,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn ggml_backend_buffer_free(buffer: ggml_backend_buffer_t);
}
unsafe extern "C" {
pub fn ggml_backend_buffer_get_base(
buffer: ggml_backend_buffer_t,
) -> *mut ::std::os::raw::c_void;
}
unsafe extern "C" {
pub fn ggml_backend_buffer_get_size(buffer: ggml_backend_buffer_t) -> usize;
}
unsafe extern "C" {
pub fn ggml_backend_buffer_init_tensor(
buffer: ggml_backend_buffer_t,
tensor: *mut ggml_tensor,
) -> ggml_status;
}
unsafe extern "C" {
pub fn ggml_backend_buffer_get_alignment(buffer: ggml_backend_buffer_t) -> usize;
}
unsafe extern "C" {
pub fn ggml_backend_buffer_get_max_size(buffer: ggml_backend_buffer_t) -> usize;
}
unsafe extern "C" {
pub fn ggml_backend_buffer_get_alloc_size(
buffer: ggml_backend_buffer_t,
tensor: *const ggml_tensor,
) -> usize;
}
unsafe extern "C" {
pub fn ggml_backend_buffer_clear(buffer: ggml_backend_buffer_t, value: u8);
}
unsafe extern "C" {
pub fn ggml_backend_buffer_is_host(buffer: ggml_backend_buffer_t) -> bool;
}
unsafe extern "C" {
pub fn ggml_backend_buffer_set_usage(
buffer: ggml_backend_buffer_t,
usage: ggml_backend_buffer_usage,
);
}
unsafe extern "C" {
pub fn ggml_backend_buffer_get_usage(
buffer: ggml_backend_buffer_t,
) -> ggml_backend_buffer_usage;
}
unsafe extern "C" {
pub fn ggml_backend_buffer_get_type(
buffer: ggml_backend_buffer_t,
) -> ggml_backend_buffer_type_t;
}
unsafe extern "C" {
pub fn ggml_backend_buffer_reset(buffer: ggml_backend_buffer_t);
}
unsafe extern "C" {
pub fn ggml_backend_tensor_copy(src: *const ggml_tensor, dst: *mut ggml_tensor);
}
unsafe extern "C" {
pub fn ggml_backend_guid(backend: ggml_backend_t) -> ggml_guid_t;
}
unsafe extern "C" {
pub fn ggml_backend_name(backend: ggml_backend_t) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn ggml_backend_free(backend: ggml_backend_t);
}
unsafe extern "C" {
pub fn ggml_backend_get_default_buffer_type(
backend: ggml_backend_t,
) -> ggml_backend_buffer_type_t;
}
unsafe extern "C" {
pub fn ggml_backend_alloc_buffer(
backend: ggml_backend_t,
size: usize,
) -> ggml_backend_buffer_t;
}
unsafe extern "C" {
pub fn ggml_backend_get_alignment(backend: ggml_backend_t) -> usize;
}
unsafe extern "C" {
pub fn ggml_backend_get_max_size(backend: ggml_backend_t) -> usize;
}
unsafe extern "C" {
pub fn ggml_backend_tensor_set_async(
backend: ggml_backend_t,
tensor: *mut ggml_tensor,
data: *const ::std::os::raw::c_void,
offset: usize,
size: usize,
);
}
unsafe extern "C" {
pub fn ggml_backend_tensor_get_async(
backend: ggml_backend_t,
tensor: *const ggml_tensor,
data: *mut ::std::os::raw::c_void,
offset: usize,
size: usize,
);
}
unsafe extern "C" {
pub fn ggml_backend_tensor_set_2d_async(
backend: ggml_backend_t,
tensor: *mut ggml_tensor,
data: *const ::std::os::raw::c_void,
offset: usize,
size: usize,
n_copies: usize,
stride_tensor: usize,
stride_data: usize,
);
}
unsafe extern "C" {
pub fn ggml_backend_tensor_get_2d_async(
backend: ggml_backend_t,
tensor: *const ggml_tensor,
data: *mut ::std::os::raw::c_void,
offset: usize,
size: usize,
n_copies: usize,
stride_tensor: usize,
stride_data: usize,
);
}
unsafe extern "C" {
pub fn ggml_backend_tensor_set(
tensor: *mut ggml_tensor,
data: *const ::std::os::raw::c_void,
offset: usize,
size: usize,
);
}
unsafe extern "C" {
pub fn ggml_backend_tensor_get(
tensor: *const ggml_tensor,
data: *mut ::std::os::raw::c_void,
offset: usize,
size: usize,
);
}
unsafe extern "C" {
pub fn ggml_backend_tensor_set_2d(
tensor: *mut ggml_tensor,
data: *const ::std::os::raw::c_void,
offset: usize,
size: usize,
n_copies: usize,
stride_tensor: usize,
stride_data: usize,
);
}
unsafe extern "C" {
pub fn ggml_backend_tensor_get_2d(
tensor: *const ggml_tensor,
data: *mut ::std::os::raw::c_void,
offset: usize,
size: usize,
n_copies: usize,
stride_tensor: usize,
stride_data: usize,
);
}
unsafe extern "C" {
pub fn ggml_backend_tensor_memset(
tensor: *mut ggml_tensor,
value: u8,
offset: usize,
size: usize,
);
}
unsafe extern "C" {
pub fn ggml_backend_synchronize(backend: ggml_backend_t);
}
unsafe extern "C" {
pub fn ggml_backend_graph_plan_create(
backend: ggml_backend_t,
cgraph: *mut ggml_cgraph,
) -> ggml_backend_graph_plan_t;
}
unsafe extern "C" {
pub fn ggml_backend_graph_plan_free(
backend: ggml_backend_t,
plan: ggml_backend_graph_plan_t,
);
}
unsafe extern "C" {
pub fn ggml_backend_graph_plan_compute(
backend: ggml_backend_t,
plan: ggml_backend_graph_plan_t,
) -> ggml_status;
}
unsafe extern "C" {
pub fn ggml_backend_graph_compute(
backend: ggml_backend_t,
cgraph: *mut ggml_cgraph,
) -> ggml_status;
}
unsafe extern "C" {
pub fn ggml_backend_graph_compute_async(
backend: ggml_backend_t,
cgraph: *mut ggml_cgraph,
) -> ggml_status;
}
unsafe extern "C" {
pub fn ggml_backend_supports_op(
backend: ggml_backend_t,
op: *const ggml_tensor,
) -> bool;
}
unsafe extern "C" {
pub fn ggml_backend_supports_buft(
backend: ggml_backend_t,
buft: ggml_backend_buffer_type_t,
) -> bool;
}
unsafe extern "C" {
pub fn ggml_backend_offload_op(
backend: ggml_backend_t,
op: *const ggml_tensor,
) -> bool;
}
unsafe extern "C" {
pub fn ggml_backend_tensor_copy_async(
backend_src: ggml_backend_t,
backend_dst: ggml_backend_t,
src: *const ggml_tensor,
dst: *mut ggml_tensor,
);
}
unsafe extern "C" {
pub fn ggml_backend_get_device(backend: ggml_backend_t) -> ggml_backend_dev_t;
}
unsafe extern "C" {
pub fn ggml_backend_event_new(device: ggml_backend_dev_t) -> ggml_backend_event_t;
}
unsafe extern "C" {
pub fn ggml_backend_event_free(event: ggml_backend_event_t);
}
unsafe extern "C" {
pub fn ggml_backend_event_record(
event: ggml_backend_event_t,
backend: ggml_backend_t,
);
}
unsafe extern "C" {
pub fn ggml_backend_event_synchronize(event: ggml_backend_event_t);
}
unsafe extern "C" {
pub fn ggml_backend_event_wait(backend: ggml_backend_t, event: ggml_backend_event_t);
}
pub const ggml_backend_dev_type_GGML_BACKEND_DEVICE_TYPE_CPU: ggml_backend_dev_type = 0;
pub const ggml_backend_dev_type_GGML_BACKEND_DEVICE_TYPE_GPU: ggml_backend_dev_type = 1;
pub const ggml_backend_dev_type_GGML_BACKEND_DEVICE_TYPE_IGPU: ggml_backend_dev_type = 2;
pub const ggml_backend_dev_type_GGML_BACKEND_DEVICE_TYPE_ACCEL: ggml_backend_dev_type = 3;
pub const ggml_backend_dev_type_GGML_BACKEND_DEVICE_TYPE_META: ggml_backend_dev_type = 4;
pub type ggml_backend_dev_type = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ggml_backend_dev_caps {
pub async_: bool,
pub host_buffer: bool,
pub buffer_from_host_ptr: bool,
pub events: bool,
pub mmap_support: bool,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of ggml_backend_dev_caps",
][::std::mem::size_of::<ggml_backend_dev_caps>() - 5usize];
[
"Alignment of ggml_backend_dev_caps",
][::std::mem::align_of::<ggml_backend_dev_caps>() - 1usize];
[
"Offset of field: ggml_backend_dev_caps::async_",
][::std::mem::offset_of!(ggml_backend_dev_caps, async_) - 0usize];
[
"Offset of field: ggml_backend_dev_caps::host_buffer",
][::std::mem::offset_of!(ggml_backend_dev_caps, host_buffer) - 1usize];
[
"Offset of field: ggml_backend_dev_caps::buffer_from_host_ptr",
][::std::mem::offset_of!(ggml_backend_dev_caps, buffer_from_host_ptr) - 2usize];
[
"Offset of field: ggml_backend_dev_caps::events",
][::std::mem::offset_of!(ggml_backend_dev_caps, events) - 3usize];
[
"Offset of field: ggml_backend_dev_caps::mmap_support",
][::std::mem::offset_of!(ggml_backend_dev_caps, mmap_support) - 4usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ggml_backend_dev_props {
pub name: *const ::std::os::raw::c_char,
pub description: *const ::std::os::raw::c_char,
pub memory_free: usize,
pub memory_total: usize,
pub type_: ggml_backend_dev_type,
pub device_id: *const ::std::os::raw::c_char,
pub caps: ggml_backend_dev_caps,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of ggml_backend_dev_props",
][::std::mem::size_of::<ggml_backend_dev_props>() - 56usize];
[
"Alignment of ggml_backend_dev_props",
][::std::mem::align_of::<ggml_backend_dev_props>() - 8usize];
[
"Offset of field: ggml_backend_dev_props::name",
][::std::mem::offset_of!(ggml_backend_dev_props, name) - 0usize];
[
"Offset of field: ggml_backend_dev_props::description",
][::std::mem::offset_of!(ggml_backend_dev_props, description) - 8usize];
[
"Offset of field: ggml_backend_dev_props::memory_free",
][::std::mem::offset_of!(ggml_backend_dev_props, memory_free) - 16usize];
[
"Offset of field: ggml_backend_dev_props::memory_total",
][::std::mem::offset_of!(ggml_backend_dev_props, memory_total) - 24usize];
[
"Offset of field: ggml_backend_dev_props::type_",
][::std::mem::offset_of!(ggml_backend_dev_props, type_) - 32usize];
[
"Offset of field: ggml_backend_dev_props::device_id",
][::std::mem::offset_of!(ggml_backend_dev_props, device_id) - 40usize];
[
"Offset of field: ggml_backend_dev_props::caps",
][::std::mem::offset_of!(ggml_backend_dev_props, caps) - 48usize];
};
unsafe extern "C" {
pub fn ggml_backend_dev_name(
device: ggml_backend_dev_t,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn ggml_backend_dev_description(
device: ggml_backend_dev_t,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn ggml_backend_dev_memory(
device: ggml_backend_dev_t,
free: *mut usize,
total: *mut usize,
);
}
unsafe extern "C" {
pub fn ggml_backend_dev_type(device: ggml_backend_dev_t) -> ggml_backend_dev_type;
}
unsafe extern "C" {
pub fn ggml_backend_dev_get_props(
device: ggml_backend_dev_t,
props: *mut ggml_backend_dev_props,
);
}
unsafe extern "C" {
pub fn ggml_backend_dev_backend_reg(
device: ggml_backend_dev_t,
) -> ggml_backend_reg_t;
}
unsafe extern "C" {
pub fn ggml_backend_dev_init(
device: ggml_backend_dev_t,
params: *const ::std::os::raw::c_char,
) -> ggml_backend_t;
}
unsafe extern "C" {
pub fn ggml_backend_dev_buffer_type(
device: ggml_backend_dev_t,
) -> ggml_backend_buffer_type_t;
}
unsafe extern "C" {
pub fn ggml_backend_dev_host_buffer_type(
device: ggml_backend_dev_t,
) -> ggml_backend_buffer_type_t;
}
unsafe extern "C" {
pub fn ggml_backend_dev_buffer_from_host_ptr(
device: ggml_backend_dev_t,
ptr: *mut ::std::os::raw::c_void,
size: usize,
max_tensor_size: usize,
) -> ggml_backend_buffer_t;
}
unsafe extern "C" {
pub fn ggml_backend_dev_supports_op(
device: ggml_backend_dev_t,
op: *const ggml_tensor,
) -> bool;
}
unsafe extern "C" {
pub fn ggml_backend_dev_supports_buft(
device: ggml_backend_dev_t,
buft: ggml_backend_buffer_type_t,
) -> bool;
}
unsafe extern "C" {
pub fn ggml_backend_dev_offload_op(
device: ggml_backend_dev_t,
op: *const ggml_tensor,
) -> bool;
}
unsafe extern "C" {
pub fn ggml_backend_reg_name(
reg: ggml_backend_reg_t,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn ggml_backend_reg_dev_count(reg: ggml_backend_reg_t) -> usize;
}
unsafe extern "C" {
pub fn ggml_backend_reg_dev_get(
reg: ggml_backend_reg_t,
index: usize,
) -> ggml_backend_dev_t;
}
unsafe extern "C" {
pub fn ggml_backend_reg_get_proc_address(
reg: ggml_backend_reg_t,
name: *const ::std::os::raw::c_char,
) -> *mut ::std::os::raw::c_void;
}
pub type ggml_backend_comm_init_t = ::std::option::Option<
unsafe extern "C" fn(
backends: *mut ggml_backend_t,
n_backends: usize,
) -> *mut ::std::os::raw::c_void,
>;
pub type ggml_backend_comm_free_t = ::std::option::Option<
unsafe extern "C" fn(comm_ctx: *mut ::std::os::raw::c_void),
>;
pub type ggml_backend_comm_allreduce_tensor_t = ::std::option::Option<
unsafe extern "C" fn(
comm_ctx: *mut ::std::os::raw::c_void,
tensors: *mut *mut ggml_tensor,
) -> bool,
>;
pub type ggml_backend_split_buffer_type_t = ::std::option::Option<
unsafe extern "C" fn(
main_device: ::std::os::raw::c_int,
tensor_split: *const f32,
) -> ggml_backend_buffer_type_t,
>;
pub type ggml_backend_set_n_threads_t = ::std::option::Option<
unsafe extern "C" fn(backend: ggml_backend_t, n_threads: ::std::os::raw::c_int),
>;
pub type ggml_backend_dev_get_extra_bufts_t = ::std::option::Option<
unsafe extern "C" fn(device: ggml_backend_dev_t) -> *mut ggml_backend_buffer_type_t,
>;
pub type ggml_backend_set_abort_callback_t = ::std::option::Option<
unsafe extern "C" fn(
backend: ggml_backend_t,
abort_callback: ggml_abort_callback,
abort_callback_data: *mut ::std::os::raw::c_void,
),
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ggml_backend_feature {
pub name: *const ::std::os::raw::c_char,
pub value: *const ::std::os::raw::c_char,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of ggml_backend_feature",
][::std::mem::size_of::<ggml_backend_feature>() - 16usize];
[
"Alignment of ggml_backend_feature",
][::std::mem::align_of::<ggml_backend_feature>() - 8usize];
[
"Offset of field: ggml_backend_feature::name",
][::std::mem::offset_of!(ggml_backend_feature, name) - 0usize];
[
"Offset of field: ggml_backend_feature::value",
][::std::mem::offset_of!(ggml_backend_feature, value) - 8usize];
};
pub type ggml_backend_get_features_t = ::std::option::Option<
unsafe extern "C" fn(reg: ggml_backend_reg_t) -> *mut ggml_backend_feature,
>;
unsafe extern "C" {
pub fn ggml_backend_register(reg: ggml_backend_reg_t);
}
unsafe extern "C" {
pub fn ggml_backend_device_register(device: ggml_backend_dev_t);
}
unsafe extern "C" {
pub fn ggml_backend_reg_count() -> usize;
}
unsafe extern "C" {
pub fn ggml_backend_reg_get(index: usize) -> ggml_backend_reg_t;
}
unsafe extern "C" {
pub fn ggml_backend_reg_by_name(
name: *const ::std::os::raw::c_char,
) -> ggml_backend_reg_t;
}
unsafe extern "C" {
pub fn ggml_backend_dev_count() -> usize;
}
unsafe extern "C" {
pub fn ggml_backend_dev_get(index: usize) -> ggml_backend_dev_t;
}
unsafe extern "C" {
pub fn ggml_backend_dev_by_name(
name: *const ::std::os::raw::c_char,
) -> ggml_backend_dev_t;
}
unsafe extern "C" {
pub fn ggml_backend_dev_by_type(type_: ggml_backend_dev_type) -> ggml_backend_dev_t;
}
unsafe extern "C" {
pub fn ggml_backend_init_by_name(
name: *const ::std::os::raw::c_char,
params: *const ::std::os::raw::c_char,
) -> ggml_backend_t;
}
unsafe extern "C" {
pub fn ggml_backend_init_by_type(
type_: ggml_backend_dev_type,
params: *const ::std::os::raw::c_char,
) -> ggml_backend_t;
}
unsafe extern "C" {
pub fn ggml_backend_init_best() -> ggml_backend_t;
}
unsafe extern "C" {
pub fn ggml_backend_load(path: *const ::std::os::raw::c_char) -> ggml_backend_reg_t;
}
unsafe extern "C" {
pub fn ggml_backend_unload(reg: ggml_backend_reg_t);
}
unsafe extern "C" {
pub fn ggml_backend_load_all();
}
unsafe extern "C" {
pub fn ggml_backend_load_all_from_path(dir_path: *const ::std::os::raw::c_char);
}
#[repr(C)]
#[derive(Debug)]
pub struct ggml_backend_sched {
_unused: [u8; 0],
}
pub type ggml_backend_sched_t = *mut ggml_backend_sched;
pub type ggml_backend_sched_eval_callback = ::std::option::Option<
unsafe extern "C" fn(
t: *mut ggml_tensor,
ask: bool,
user_data: *mut ::std::os::raw::c_void,
) -> bool,
>;
pub type ggml_backend_sched_copy_callback = ::std::option::Option<
unsafe extern "C" fn(
backend: ggml_backend_t,
src: *const ggml_tensor,
dst: *mut ggml_tensor,
graph: *mut ggml_cgraph,
user_data: *mut ::std::os::raw::c_void,
) -> bool,
>;
unsafe extern "C" {
pub fn ggml_backend_sched_new(
backends: *mut ggml_backend_t,
bufts: *mut ggml_backend_buffer_type_t,
n_backends: ::std::os::raw::c_int,
graph_size: usize,
parallel: bool,
op_offload: bool,
) -> ggml_backend_sched_t;
}
unsafe extern "C" {
pub fn ggml_backend_sched_free(sched: ggml_backend_sched_t);
}
unsafe extern "C" {
pub fn ggml_backend_sched_reserve_size(
sched: ggml_backend_sched_t,
measure_graph: *mut ggml_cgraph,
sizes: *mut usize,
);
}
unsafe extern "C" {
pub fn ggml_backend_sched_reserve(
sched: ggml_backend_sched_t,
measure_graph: *mut ggml_cgraph,
) -> bool;
}
unsafe extern "C" {
pub fn ggml_backend_sched_get_n_backends(
sched: ggml_backend_sched_t,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn ggml_backend_sched_get_backend(
sched: ggml_backend_sched_t,
i: ::std::os::raw::c_int,
) -> ggml_backend_t;
}
unsafe extern "C" {
pub fn ggml_backend_sched_get_n_splits(
sched: ggml_backend_sched_t,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn ggml_backend_sched_get_n_copies(
sched: ggml_backend_sched_t,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn ggml_backend_sched_get_buffer_type(
sched: ggml_backend_sched_t,
backend: ggml_backend_t,
) -> ggml_backend_buffer_type_t;
}
unsafe extern "C" {
pub fn ggml_backend_sched_get_buffer_size(
sched: ggml_backend_sched_t,
backend: ggml_backend_t,
) -> usize;
}
unsafe extern "C" {
pub fn ggml_backend_sched_set_tensor_backend(
sched: ggml_backend_sched_t,
node: *mut ggml_tensor,
backend: ggml_backend_t,
);
}
unsafe extern "C" {
pub fn ggml_backend_sched_get_tensor_backend(
sched: ggml_backend_sched_t,
node: *mut ggml_tensor,
) -> ggml_backend_t;
}
unsafe extern "C" {
pub fn ggml_backend_sched_split_graph(
sched: ggml_backend_sched_t,
graph: *mut ggml_cgraph,
);
}
unsafe extern "C" {
pub fn ggml_backend_sched_alloc_graph(
sched: ggml_backend_sched_t,
graph: *mut ggml_cgraph,
) -> bool;
}
unsafe extern "C" {
pub fn ggml_backend_sched_graph_compute(
sched: ggml_backend_sched_t,
graph: *mut ggml_cgraph,
) -> ggml_status;
}
unsafe extern "C" {
pub fn ggml_backend_sched_graph_compute_async(
sched: ggml_backend_sched_t,
graph: *mut ggml_cgraph,
) -> ggml_status;
}
unsafe extern "C" {
pub fn ggml_backend_sched_synchronize(sched: ggml_backend_sched_t);
}
unsafe extern "C" {
pub fn ggml_backend_sched_reset(sched: ggml_backend_sched_t);
}
unsafe extern "C" {
pub fn ggml_backend_sched_set_eval_callback(
sched: ggml_backend_sched_t,
callback: ggml_backend_sched_eval_callback,
user_data: *mut ::std::os::raw::c_void,
);
}
unsafe extern "C" {
pub fn ggml_backend_sched_set_copy_callback(
sched: ggml_backend_sched_t,
callback: ggml_backend_sched_copy_callback,
user_data: *mut ::std::os::raw::c_void,
);
}
pub const ggml_backend_meta_split_axis_GGML_BACKEND_SPLIT_AXIS_0: ggml_backend_meta_split_axis = 0;
pub const ggml_backend_meta_split_axis_GGML_BACKEND_SPLIT_AXIS_1: ggml_backend_meta_split_axis = 1;
pub const ggml_backend_meta_split_axis_GGML_BACKEND_SPLIT_AXIS_2: ggml_backend_meta_split_axis = 2;
pub const ggml_backend_meta_split_axis_GGML_BACKEND_SPLIT_AXIS_3: ggml_backend_meta_split_axis = 3;
pub const ggml_backend_meta_split_axis_GGML_BACKEND_SPLIT_AXIS_MIRRORED: ggml_backend_meta_split_axis = 10;
pub const ggml_backend_meta_split_axis_GGML_BACKEND_SPLIT_AXIS_PARTIAL: ggml_backend_meta_split_axis = 11;
pub const ggml_backend_meta_split_axis_GGML_BACKEND_SPLIT_AXIS_NONE: ggml_backend_meta_split_axis = 98;
pub const ggml_backend_meta_split_axis_GGML_BACKEND_SPLIT_AXIS_UNKNOWN: ggml_backend_meta_split_axis = 99;
pub type ggml_backend_meta_split_axis = ::std::os::raw::c_uint;
unsafe extern "C" {
pub fn ggml_backend_meta_split_axis_name(
split_axis: ggml_backend_meta_split_axis,
) -> *const ::std::os::raw::c_char;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ggml_backend_meta_split_state {
pub axis: ggml_backend_meta_split_axis,
pub ne: [i64; 256usize],
pub nr: [u32; 16usize],
pub n_segments: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of ggml_backend_meta_split_state",
][::std::mem::size_of::<ggml_backend_meta_split_state>() - 2128usize];
[
"Alignment of ggml_backend_meta_split_state",
][::std::mem::align_of::<ggml_backend_meta_split_state>() - 8usize];
[
"Offset of field: ggml_backend_meta_split_state::axis",
][::std::mem::offset_of!(ggml_backend_meta_split_state, axis) - 0usize];
[
"Offset of field: ggml_backend_meta_split_state::ne",
][::std::mem::offset_of!(ggml_backend_meta_split_state, ne) - 8usize];
[
"Offset of field: ggml_backend_meta_split_state::nr",
][::std::mem::offset_of!(ggml_backend_meta_split_state, nr) - 2056usize];
[
"Offset of field: ggml_backend_meta_split_state::n_segments",
][::std::mem::offset_of!(ggml_backend_meta_split_state, n_segments) - 2120usize];
};
pub type ggml_backend_meta_get_split_state_t = ::std::option::Option<
unsafe extern "C" fn(
tensor: *const ggml_tensor,
userdata: *mut ::std::os::raw::c_void,
) -> ggml_backend_meta_split_state,
>;
unsafe extern "C" {
pub fn ggml_backend_meta_device(
devs: *mut ggml_backend_dev_t,
n_devs: usize,
get_split_state: ggml_backend_meta_get_split_state_t,
get_split_state_ud: *mut ::std::os::raw::c_void,
) -> ggml_backend_dev_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ggml_backend_graph_copy {
pub buffer: ggml_backend_buffer_t,
pub ctx_allocated: *mut ggml_context,
pub ctx_unallocated: *mut ggml_context,
pub graph: *mut ggml_cgraph,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of ggml_backend_graph_copy",
][::std::mem::size_of::<ggml_backend_graph_copy>() - 32usize];
[
"Alignment of ggml_backend_graph_copy",
][::std::mem::align_of::<ggml_backend_graph_copy>() - 8usize];
[
"Offset of field: ggml_backend_graph_copy::buffer",
][::std::mem::offset_of!(ggml_backend_graph_copy, buffer) - 0usize];
[
"Offset of field: ggml_backend_graph_copy::ctx_allocated",
][::std::mem::offset_of!(ggml_backend_graph_copy, ctx_allocated) - 8usize];
[
"Offset of field: ggml_backend_graph_copy::ctx_unallocated",
][::std::mem::offset_of!(ggml_backend_graph_copy, ctx_unallocated) - 16usize];
[
"Offset of field: ggml_backend_graph_copy::graph",
][::std::mem::offset_of!(ggml_backend_graph_copy, graph) - 24usize];
};
unsafe extern "C" {
pub fn ggml_backend_graph_copy(
backend: ggml_backend_t,
graph: *mut ggml_cgraph,
) -> ggml_backend_graph_copy;
}
unsafe extern "C" {
pub fn ggml_backend_graph_copy_free(copy: ggml_backend_graph_copy);
}
pub type ggml_backend_eval_callback = ::std::option::Option<
unsafe extern "C" fn(
node_index: ::std::os::raw::c_int,
t1: *mut ggml_tensor,
t2: *mut ggml_tensor,
user_data: *mut ::std::os::raw::c_void,
) -> bool,
>;
unsafe extern "C" {
pub fn ggml_backend_compare_graph_backend(
backend1: ggml_backend_t,
backend2: ggml_backend_t,
graph: *mut ggml_cgraph,
callback: ggml_backend_eval_callback,
user_data: *mut ::std::os::raw::c_void,
test_nodes: *const *const ggml_tensor,
num_test_nodes: usize,
) -> bool;
}
unsafe extern "C" {
pub fn ggml_backend_tensor_alloc(
buffer: ggml_backend_buffer_t,
tensor: *mut ggml_tensor,
addr: *mut ::std::os::raw::c_void,
) -> ggml_status;
}
unsafe extern "C" {
pub fn ggml_backend_view_init(tensor: *mut ggml_tensor) -> ggml_status;
}
unsafe extern "C" {
pub fn ggml_backend_cpu_buffer_from_ptr(
ptr: *mut ::std::os::raw::c_void,
size: usize,
) -> ggml_backend_buffer_t;
}
unsafe extern "C" {
pub fn ggml_backend_cpu_buffer_type() -> ggml_backend_buffer_type_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ggml_cplan {
pub work_size: usize,
pub work_data: *mut u8,
pub n_threads: ::std::os::raw::c_int,
pub threadpool: *mut ggml_threadpool,
pub abort_callback: ggml_abort_callback,
pub abort_callback_data: *mut ::std::os::raw::c_void,
pub use_ref: bool,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of ggml_cplan"][::std::mem::size_of::<ggml_cplan>() - 56usize];
["Alignment of ggml_cplan"][::std::mem::align_of::<ggml_cplan>() - 8usize];
[
"Offset of field: ggml_cplan::work_size",
][::std::mem::offset_of!(ggml_cplan, work_size) - 0usize];
[
"Offset of field: ggml_cplan::work_data",
][::std::mem::offset_of!(ggml_cplan, work_data) - 8usize];
[
"Offset of field: ggml_cplan::n_threads",
][::std::mem::offset_of!(ggml_cplan, n_threads) - 16usize];
[
"Offset of field: ggml_cplan::threadpool",
][::std::mem::offset_of!(ggml_cplan, threadpool) - 24usize];
[
"Offset of field: ggml_cplan::abort_callback",
][::std::mem::offset_of!(ggml_cplan, abort_callback) - 32usize];
[
"Offset of field: ggml_cplan::abort_callback_data",
][::std::mem::offset_of!(ggml_cplan, abort_callback_data) - 40usize];
[
"Offset of field: ggml_cplan::use_ref",
][::std::mem::offset_of!(ggml_cplan, use_ref) - 48usize];
};
pub const ggml_numa_strategy_GGML_NUMA_STRATEGY_DISABLED: ggml_numa_strategy = 0;
pub const ggml_numa_strategy_GGML_NUMA_STRATEGY_DISTRIBUTE: ggml_numa_strategy = 1;
pub const ggml_numa_strategy_GGML_NUMA_STRATEGY_ISOLATE: ggml_numa_strategy = 2;
pub const ggml_numa_strategy_GGML_NUMA_STRATEGY_NUMACTL: ggml_numa_strategy = 3;
pub const ggml_numa_strategy_GGML_NUMA_STRATEGY_MIRROR: ggml_numa_strategy = 4;
pub const ggml_numa_strategy_GGML_NUMA_STRATEGY_COUNT: ggml_numa_strategy = 5;
pub type ggml_numa_strategy = ::std::os::raw::c_uint;
pub type ggml_vec_dot_t = ::std::option::Option<
unsafe extern "C" fn(
n: ::std::os::raw::c_int,
s: *mut f32,
bs: usize,
x: *const ::std::os::raw::c_void,
bx: usize,
y: *const ::std::os::raw::c_void,
by: usize,
nrc: ::std::os::raw::c_int,
),
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ggml_type_traits_cpu {
pub from_float: ggml_from_float_t,
pub vec_dot: ggml_vec_dot_t,
pub vec_dot_type: ggml_type,
pub nrows: i64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of ggml_type_traits_cpu",
][::std::mem::size_of::<ggml_type_traits_cpu>() - 32usize];
[
"Alignment of ggml_type_traits_cpu",
][::std::mem::align_of::<ggml_type_traits_cpu>() - 8usize];
[
"Offset of field: ggml_type_traits_cpu::from_float",
][::std::mem::offset_of!(ggml_type_traits_cpu, from_float) - 0usize];
[
"Offset of field: ggml_type_traits_cpu::vec_dot",
][::std::mem::offset_of!(ggml_type_traits_cpu, vec_dot) - 8usize];
[
"Offset of field: ggml_type_traits_cpu::vec_dot_type",
][::std::mem::offset_of!(ggml_type_traits_cpu, vec_dot_type) - 16usize];
[
"Offset of field: ggml_type_traits_cpu::nrows",
][::std::mem::offset_of!(ggml_type_traits_cpu, nrows) - 24usize];
};
unsafe extern "C" {
pub fn ggml_backend_cpu_init() -> ggml_backend_t;
}
unsafe extern "C" {
pub fn ggml_backend_is_cpu(backend: ggml_backend_t) -> bool;
}
unsafe extern "C" {
pub fn ggml_backend_cpu_set_n_threads(
backend_cpu: ggml_backend_t,
n_threads: ::std::os::raw::c_int,
);
}
unsafe extern "C" {
pub fn ggml_backend_cpu_set_threadpool(
backend_cpu: ggml_backend_t,
threadpool: ggml_threadpool_t,
);
}
unsafe extern "C" {
pub fn ggml_backend_cpu_set_abort_callback(
backend_cpu: ggml_backend_t,
abort_callback: ggml_abort_callback,
abort_callback_data: *mut ::std::os::raw::c_void,
);
}
unsafe extern "C" {
pub fn ggml_backend_cpu_set_use_ref(backend_cpu: ggml_backend_t, use_ref: bool);
}
unsafe extern "C" {
pub fn ggml_backend_cpu_reg() -> ggml_backend_reg_t;
}
#[repr(C)]
#[derive(Debug)]
pub struct ggml_opt_dataset {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug)]
pub struct ggml_opt_context {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug)]
pub struct ggml_opt_result {
_unused: [u8; 0],
}
pub type ggml_opt_dataset_t = *mut ggml_opt_dataset;
pub type ggml_opt_context_t = *mut ggml_opt_context;
pub type ggml_opt_result_t = *mut ggml_opt_result;
pub const ggml_opt_loss_type_GGML_OPT_LOSS_TYPE_MEAN: ggml_opt_loss_type = 0;
pub const ggml_opt_loss_type_GGML_OPT_LOSS_TYPE_SUM: ggml_opt_loss_type = 1;
pub const ggml_opt_loss_type_GGML_OPT_LOSS_TYPE_CROSS_ENTROPY: ggml_opt_loss_type = 2;
pub const ggml_opt_loss_type_GGML_OPT_LOSS_TYPE_MEAN_SQUARED_ERROR: ggml_opt_loss_type = 3;
pub type ggml_opt_loss_type = ::std::os::raw::c_uint;
pub const ggml_opt_build_type_GGML_OPT_BUILD_TYPE_FORWARD: ggml_opt_build_type = 10;
pub const ggml_opt_build_type_GGML_OPT_BUILD_TYPE_GRAD: ggml_opt_build_type = 20;
pub const ggml_opt_build_type_GGML_OPT_BUILD_TYPE_OPT: ggml_opt_build_type = 30;
pub type ggml_opt_build_type = ::std::os::raw::c_uint;
pub const ggml_opt_optimizer_type_GGML_OPT_OPTIMIZER_TYPE_ADAMW: ggml_opt_optimizer_type = 0;
pub const ggml_opt_optimizer_type_GGML_OPT_OPTIMIZER_TYPE_SGD: ggml_opt_optimizer_type = 1;
pub const ggml_opt_optimizer_type_GGML_OPT_OPTIMIZER_TYPE_COUNT: ggml_opt_optimizer_type = 2;
pub type ggml_opt_optimizer_type = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ggml_opt_optimizer_params {
pub adamw: ggml_opt_optimizer_params__bindgen_ty_1,
pub sgd: ggml_opt_optimizer_params__bindgen_ty_2,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ggml_opt_optimizer_params__bindgen_ty_1 {
pub alpha: f32,
pub beta1: f32,
pub beta2: f32,
pub eps: f32,
pub wd: f32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of ggml_opt_optimizer_params__bindgen_ty_1",
][::std::mem::size_of::<ggml_opt_optimizer_params__bindgen_ty_1>() - 20usize];
[
"Alignment of ggml_opt_optimizer_params__bindgen_ty_1",
][::std::mem::align_of::<ggml_opt_optimizer_params__bindgen_ty_1>() - 4usize];
[
"Offset of field: ggml_opt_optimizer_params__bindgen_ty_1::alpha",
][::std::mem::offset_of!(ggml_opt_optimizer_params__bindgen_ty_1, alpha) - 0usize];
[
"Offset of field: ggml_opt_optimizer_params__bindgen_ty_1::beta1",
][::std::mem::offset_of!(ggml_opt_optimizer_params__bindgen_ty_1, beta1) - 4usize];
[
"Offset of field: ggml_opt_optimizer_params__bindgen_ty_1::beta2",
][::std::mem::offset_of!(ggml_opt_optimizer_params__bindgen_ty_1, beta2) - 8usize];
[
"Offset of field: ggml_opt_optimizer_params__bindgen_ty_1::eps",
][::std::mem::offset_of!(ggml_opt_optimizer_params__bindgen_ty_1, eps) - 12usize];
[
"Offset of field: ggml_opt_optimizer_params__bindgen_ty_1::wd",
][::std::mem::offset_of!(ggml_opt_optimizer_params__bindgen_ty_1, wd) - 16usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ggml_opt_optimizer_params__bindgen_ty_2 {
pub alpha: f32,
pub wd: f32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of ggml_opt_optimizer_params__bindgen_ty_2",
][::std::mem::size_of::<ggml_opt_optimizer_params__bindgen_ty_2>() - 8usize];
[
"Alignment of ggml_opt_optimizer_params__bindgen_ty_2",
][::std::mem::align_of::<ggml_opt_optimizer_params__bindgen_ty_2>() - 4usize];
[
"Offset of field: ggml_opt_optimizer_params__bindgen_ty_2::alpha",
][::std::mem::offset_of!(ggml_opt_optimizer_params__bindgen_ty_2, alpha) - 0usize];
[
"Offset of field: ggml_opt_optimizer_params__bindgen_ty_2::wd",
][::std::mem::offset_of!(ggml_opt_optimizer_params__bindgen_ty_2, wd) - 4usize];
};
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of ggml_opt_optimizer_params",
][::std::mem::size_of::<ggml_opt_optimizer_params>() - 28usize];
[
"Alignment of ggml_opt_optimizer_params",
][::std::mem::align_of::<ggml_opt_optimizer_params>() - 4usize];
[
"Offset of field: ggml_opt_optimizer_params::adamw",
][::std::mem::offset_of!(ggml_opt_optimizer_params, adamw) - 0usize];
[
"Offset of field: ggml_opt_optimizer_params::sgd",
][::std::mem::offset_of!(ggml_opt_optimizer_params, sgd) - 20usize];
};
pub type ggml_opt_get_optimizer_params = ::std::option::Option<
unsafe extern "C" fn(
userdata: *mut ::std::os::raw::c_void,
) -> ggml_opt_optimizer_params,
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ggml_opt_params {
pub backend_sched: ggml_backend_sched_t,
pub ctx_compute: *mut ggml_context,
pub inputs: *mut ggml_tensor,
pub outputs: *mut ggml_tensor,
pub loss_type: ggml_opt_loss_type,
pub build_type: ggml_opt_build_type,
pub opt_period: i32,
pub get_opt_pars: ggml_opt_get_optimizer_params,
pub get_opt_pars_ud: *mut ::std::os::raw::c_void,
pub optimizer: ggml_opt_optimizer_type,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of ggml_opt_params"][::std::mem::size_of::<ggml_opt_params>() - 72usize];
["Alignment of ggml_opt_params"][::std::mem::align_of::<ggml_opt_params>() - 8usize];
[
"Offset of field: ggml_opt_params::backend_sched",
][::std::mem::offset_of!(ggml_opt_params, backend_sched) - 0usize];
[
"Offset of field: ggml_opt_params::ctx_compute",
][::std::mem::offset_of!(ggml_opt_params, ctx_compute) - 8usize];
[
"Offset of field: ggml_opt_params::inputs",
][::std::mem::offset_of!(ggml_opt_params, inputs) - 16usize];
[
"Offset of field: ggml_opt_params::outputs",
][::std::mem::offset_of!(ggml_opt_params, outputs) - 24usize];
[
"Offset of field: ggml_opt_params::loss_type",
][::std::mem::offset_of!(ggml_opt_params, loss_type) - 32usize];
[
"Offset of field: ggml_opt_params::build_type",
][::std::mem::offset_of!(ggml_opt_params, build_type) - 36usize];
[
"Offset of field: ggml_opt_params::opt_period",
][::std::mem::offset_of!(ggml_opt_params, opt_period) - 40usize];
[
"Offset of field: ggml_opt_params::get_opt_pars",
][::std::mem::offset_of!(ggml_opt_params, get_opt_pars) - 48usize];
[
"Offset of field: ggml_opt_params::get_opt_pars_ud",
][::std::mem::offset_of!(ggml_opt_params, get_opt_pars_ud) - 56usize];
[
"Offset of field: ggml_opt_params::optimizer",
][::std::mem::offset_of!(ggml_opt_params, optimizer) - 64usize];
};
pub type ggml_opt_epoch_callback = ::std::option::Option<
unsafe extern "C" fn(
train: bool,
opt_ctx: ggml_opt_context_t,
dataset: ggml_opt_dataset_t,
result: ggml_opt_result_t,
ibatch: i64,
ibatch_max: i64,
t_start_us: i64,
),
>;
#[repr(C)]
#[derive(Debug)]
pub struct gguf_context {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug)]
pub struct llama_vocab {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug)]
pub struct llama_model {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug)]
pub struct llama_context {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug)]
pub struct llama_memory_i {
_unused: [u8; 0],
}
pub type llama_memory_t = *mut llama_memory_i;
pub type llama_pos = i32;
pub type llama_token = i32;
pub type llama_seq_id = i32;
pub const llama_vocab_type_LLAMA_VOCAB_TYPE_NONE: llama_vocab_type = 0;
pub const llama_vocab_type_LLAMA_VOCAB_TYPE_SPM: llama_vocab_type = 1;
pub const llama_vocab_type_LLAMA_VOCAB_TYPE_BPE: llama_vocab_type = 2;
pub const llama_vocab_type_LLAMA_VOCAB_TYPE_WPM: llama_vocab_type = 3;
pub const llama_vocab_type_LLAMA_VOCAB_TYPE_UGM: llama_vocab_type = 4;
pub const llama_vocab_type_LLAMA_VOCAB_TYPE_RWKV: llama_vocab_type = 5;
pub const llama_vocab_type_LLAMA_VOCAB_TYPE_PLAMO2: llama_vocab_type = 6;
pub const llama_vocab_type_LLAMA_VOCAB_TYPE_TEST: llama_vocab_type = 7;
pub const llama_vocab_type_LLAMA_VOCAB_TYPE_PLAMO3: llama_vocab_type = 8;
pub type llama_vocab_type = ::std::os::raw::c_uint;
pub const llama_rope_type_LLAMA_ROPE_TYPE_NONE: llama_rope_type = -1;
pub const llama_rope_type_LLAMA_ROPE_TYPE_NORM: llama_rope_type = 0;
pub const llama_rope_type_LLAMA_ROPE_TYPE_NEOX: llama_rope_type = 2;
pub const llama_rope_type_LLAMA_ROPE_TYPE_MROPE: llama_rope_type = 8;
pub const llama_rope_type_LLAMA_ROPE_TYPE_IMROPE: llama_rope_type = 40;
pub const llama_rope_type_LLAMA_ROPE_TYPE_VISION: llama_rope_type = 24;
pub type llama_rope_type = ::std::os::raw::c_int;
pub const llama_token_type_LLAMA_TOKEN_TYPE_UNDEFINED: llama_token_type = 0;
pub const llama_token_type_LLAMA_TOKEN_TYPE_NORMAL: llama_token_type = 1;
pub const llama_token_type_LLAMA_TOKEN_TYPE_UNKNOWN: llama_token_type = 2;
pub const llama_token_type_LLAMA_TOKEN_TYPE_CONTROL: llama_token_type = 3;
pub const llama_token_type_LLAMA_TOKEN_TYPE_USER_DEFINED: llama_token_type = 4;
pub const llama_token_type_LLAMA_TOKEN_TYPE_UNUSED: llama_token_type = 5;
pub const llama_token_type_LLAMA_TOKEN_TYPE_BYTE: llama_token_type = 6;
pub type llama_token_type = ::std::os::raw::c_uint;
pub const llama_token_attr_LLAMA_TOKEN_ATTR_UNDEFINED: llama_token_attr = 0;
pub const llama_token_attr_LLAMA_TOKEN_ATTR_UNKNOWN: llama_token_attr = 1;
pub const llama_token_attr_LLAMA_TOKEN_ATTR_UNUSED: llama_token_attr = 2;
pub const llama_token_attr_LLAMA_TOKEN_ATTR_NORMAL: llama_token_attr = 4;
pub const llama_token_attr_LLAMA_TOKEN_ATTR_CONTROL: llama_token_attr = 8;
pub const llama_token_attr_LLAMA_TOKEN_ATTR_USER_DEFINED: llama_token_attr = 16;
pub const llama_token_attr_LLAMA_TOKEN_ATTR_BYTE: llama_token_attr = 32;
pub const llama_token_attr_LLAMA_TOKEN_ATTR_NORMALIZED: llama_token_attr = 64;
pub const llama_token_attr_LLAMA_TOKEN_ATTR_LSTRIP: llama_token_attr = 128;
pub const llama_token_attr_LLAMA_TOKEN_ATTR_RSTRIP: llama_token_attr = 256;
pub const llama_token_attr_LLAMA_TOKEN_ATTR_SINGLE_WORD: llama_token_attr = 512;
pub type llama_token_attr = ::std::os::raw::c_uint;
pub const llama_ftype_LLAMA_FTYPE_ALL_F32: llama_ftype = 0;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_F16: llama_ftype = 1;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_Q4_0: llama_ftype = 2;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_Q4_1: llama_ftype = 3;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_Q8_0: llama_ftype = 7;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_Q5_0: llama_ftype = 8;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_Q5_1: llama_ftype = 9;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_Q2_K: llama_ftype = 10;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_Q3_K_S: llama_ftype = 11;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_Q3_K_M: llama_ftype = 12;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_Q3_K_L: llama_ftype = 13;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_Q4_K_S: llama_ftype = 14;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_Q4_K_M: llama_ftype = 15;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_Q5_K_S: llama_ftype = 16;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_Q5_K_M: llama_ftype = 17;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_Q6_K: llama_ftype = 18;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_IQ2_XXS: llama_ftype = 19;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_IQ2_XS: llama_ftype = 20;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_Q2_K_S: llama_ftype = 21;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_IQ3_XS: llama_ftype = 22;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_IQ3_XXS: llama_ftype = 23;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_IQ1_S: llama_ftype = 24;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_IQ4_NL: llama_ftype = 25;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_IQ3_S: llama_ftype = 26;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_IQ3_M: llama_ftype = 27;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_IQ2_S: llama_ftype = 28;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_IQ2_M: llama_ftype = 29;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_IQ4_XS: llama_ftype = 30;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_IQ1_M: llama_ftype = 31;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_BF16: llama_ftype = 32;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_TQ1_0: llama_ftype = 36;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_TQ2_0: llama_ftype = 37;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_MXFP4_MOE: llama_ftype = 38;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_NVFP4: llama_ftype = 39;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_Q1_0: llama_ftype = 40;
pub const llama_ftype_LLAMA_FTYPE_MOSTLY_Q2_0: llama_ftype = 41;
pub const llama_ftype_LLAMA_FTYPE_GUESSED: llama_ftype = 1024;
pub type llama_ftype = ::std::os::raw::c_uint;
unsafe extern "C" {
pub fn llama_ftype_name(ftype: llama_ftype) -> *const ::std::os::raw::c_char;
}
pub const llama_rope_scaling_type_LLAMA_ROPE_SCALING_TYPE_UNSPECIFIED: llama_rope_scaling_type = -1;
pub const llama_rope_scaling_type_LLAMA_ROPE_SCALING_TYPE_NONE: llama_rope_scaling_type = 0;
pub const llama_rope_scaling_type_LLAMA_ROPE_SCALING_TYPE_LINEAR: llama_rope_scaling_type = 1;
pub const llama_rope_scaling_type_LLAMA_ROPE_SCALING_TYPE_YARN: llama_rope_scaling_type = 2;
pub const llama_rope_scaling_type_LLAMA_ROPE_SCALING_TYPE_LONGROPE: llama_rope_scaling_type = 3;
pub const llama_rope_scaling_type_LLAMA_ROPE_SCALING_TYPE_MAX_VALUE: llama_rope_scaling_type = 3;
pub type llama_rope_scaling_type = ::std::os::raw::c_int;
pub const llama_pooling_type_LLAMA_POOLING_TYPE_UNSPECIFIED: llama_pooling_type = -1;
pub const llama_pooling_type_LLAMA_POOLING_TYPE_NONE: llama_pooling_type = 0;
pub const llama_pooling_type_LLAMA_POOLING_TYPE_MEAN: llama_pooling_type = 1;
pub const llama_pooling_type_LLAMA_POOLING_TYPE_CLS: llama_pooling_type = 2;
pub const llama_pooling_type_LLAMA_POOLING_TYPE_LAST: llama_pooling_type = 3;
pub const llama_pooling_type_LLAMA_POOLING_TYPE_RANK: llama_pooling_type = 4;
pub type llama_pooling_type = ::std::os::raw::c_int;
pub const llama_attention_type_LLAMA_ATTENTION_TYPE_UNSPECIFIED: llama_attention_type = -1;
pub const llama_attention_type_LLAMA_ATTENTION_TYPE_CAUSAL: llama_attention_type = 0;
pub const llama_attention_type_LLAMA_ATTENTION_TYPE_NON_CAUSAL: llama_attention_type = 1;
pub type llama_attention_type = ::std::os::raw::c_int;
pub const llama_flash_attn_type_LLAMA_FLASH_ATTN_TYPE_AUTO: llama_flash_attn_type = -1;
pub const llama_flash_attn_type_LLAMA_FLASH_ATTN_TYPE_DISABLED: llama_flash_attn_type = 0;
pub const llama_flash_attn_type_LLAMA_FLASH_ATTN_TYPE_ENABLED: llama_flash_attn_type = 1;
pub type llama_flash_attn_type = ::std::os::raw::c_int;
unsafe extern "C" {
pub fn llama_flash_attn_type_name(
flash_attn_type: llama_flash_attn_type,
) -> *const ::std::os::raw::c_char;
}
pub const llama_split_mode_LLAMA_SPLIT_MODE_NONE: llama_split_mode = 0;
pub const llama_split_mode_LLAMA_SPLIT_MODE_LAYER: llama_split_mode = 1;
pub const llama_split_mode_LLAMA_SPLIT_MODE_ROW: llama_split_mode = 2;
pub const llama_split_mode_LLAMA_SPLIT_MODE_TENSOR: llama_split_mode = 3;
pub type llama_split_mode = ::std::os::raw::c_uint;
pub const llama_load_mode_LLAMA_LOAD_MODE_AUTO: llama_load_mode = -1;
pub const llama_load_mode_LLAMA_LOAD_MODE_NONE: llama_load_mode = 0;
pub const llama_load_mode_LLAMA_LOAD_MODE_MMAP: llama_load_mode = 1;
pub const llama_load_mode_LLAMA_LOAD_MODE_MLOCK: llama_load_mode = 2;
pub const llama_load_mode_LLAMA_LOAD_MODE_MMAP_MLOCK: llama_load_mode = 3;
pub const llama_load_mode_LLAMA_LOAD_MODE_DIRECT_IO: llama_load_mode = 4;
pub type llama_load_mode = ::std::os::raw::c_int;
unsafe extern "C" {
pub fn llama_load_mode_name(
load_mode: llama_load_mode,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn llama_load_mode_from_str(
str_: *const ::std::os::raw::c_char,
) -> llama_load_mode;
}
pub const llama_lazy_mode_LLAMA_LAZY_MODE_OFF: llama_lazy_mode = 0;
pub const llama_lazy_mode_LLAMA_LAZY_MODE_AUTO: llama_lazy_mode = 1;
pub const llama_lazy_mode_LLAMA_LAZY_MODE_ON: llama_lazy_mode = 2;
pub type llama_lazy_mode = ::std::os::raw::c_uint;
pub const llama_context_type_LLAMA_CONTEXT_TYPE_DEFAULT: llama_context_type = 0;
pub const llama_context_type_LLAMA_CONTEXT_TYPE_MTP: llama_context_type = 1;
pub type llama_context_type = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct llama_token_data {
pub id: llama_token,
pub logit: f32,
pub p: f32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of llama_token_data"][::std::mem::size_of::<llama_token_data>() - 12usize];
[
"Alignment of llama_token_data",
][::std::mem::align_of::<llama_token_data>() - 4usize];
[
"Offset of field: llama_token_data::id",
][::std::mem::offset_of!(llama_token_data, id) - 0usize];
[
"Offset of field: llama_token_data::logit",
][::std::mem::offset_of!(llama_token_data, logit) - 4usize];
[
"Offset of field: llama_token_data::p",
][::std::mem::offset_of!(llama_token_data, p) - 8usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct llama_token_data_array {
pub data: *mut llama_token_data,
pub size: usize,
pub selected: i64,
pub sorted: bool,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of llama_token_data_array",
][::std::mem::size_of::<llama_token_data_array>() - 32usize];
[
"Alignment of llama_token_data_array",
][::std::mem::align_of::<llama_token_data_array>() - 8usize];
[
"Offset of field: llama_token_data_array::data",
][::std::mem::offset_of!(llama_token_data_array, data) - 0usize];
[
"Offset of field: llama_token_data_array::size",
][::std::mem::offset_of!(llama_token_data_array, size) - 8usize];
[
"Offset of field: llama_token_data_array::selected",
][::std::mem::offset_of!(llama_token_data_array, selected) - 16usize];
[
"Offset of field: llama_token_data_array::sorted",
][::std::mem::offset_of!(llama_token_data_array, sorted) - 24usize];
};
pub type llama_progress_callback = ::std::option::Option<
unsafe extern "C" fn(progress: f32, user_data: *mut ::std::os::raw::c_void) -> bool,
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct llama_batch {
pub n_tokens: i32,
pub token: *mut llama_token,
pub embd: *mut f32,
pub pos: *mut llama_pos,
pub n_seq_id: *mut i32,
pub seq_id: *mut *mut llama_seq_id,
pub logits: *mut i8,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of llama_batch"][::std::mem::size_of::<llama_batch>() - 56usize];
["Alignment of llama_batch"][::std::mem::align_of::<llama_batch>() - 8usize];
[
"Offset of field: llama_batch::n_tokens",
][::std::mem::offset_of!(llama_batch, n_tokens) - 0usize];
[
"Offset of field: llama_batch::token",
][::std::mem::offset_of!(llama_batch, token) - 8usize];
[
"Offset of field: llama_batch::embd",
][::std::mem::offset_of!(llama_batch, embd) - 16usize];
[
"Offset of field: llama_batch::pos",
][::std::mem::offset_of!(llama_batch, pos) - 24usize];
[
"Offset of field: llama_batch::n_seq_id",
][::std::mem::offset_of!(llama_batch, n_seq_id) - 32usize];
[
"Offset of field: llama_batch::seq_id",
][::std::mem::offset_of!(llama_batch, seq_id) - 40usize];
[
"Offset of field: llama_batch::logits",
][::std::mem::offset_of!(llama_batch, logits) - 48usize];
};
pub const llama_model_kv_override_type_LLAMA_KV_OVERRIDE_TYPE_INT: llama_model_kv_override_type = 0;
pub const llama_model_kv_override_type_LLAMA_KV_OVERRIDE_TYPE_FLOAT: llama_model_kv_override_type = 1;
pub const llama_model_kv_override_type_LLAMA_KV_OVERRIDE_TYPE_BOOL: llama_model_kv_override_type = 2;
pub const llama_model_kv_override_type_LLAMA_KV_OVERRIDE_TYPE_STR: llama_model_kv_override_type = 3;
pub type llama_model_kv_override_type = ::std::os::raw::c_uint;
pub const llama_model_meta_key_LLAMA_MODEL_META_KEY_SAMPLING_SEQUENCE: llama_model_meta_key = 0;
pub const llama_model_meta_key_LLAMA_MODEL_META_KEY_SAMPLING_TOP_K: llama_model_meta_key = 1;
pub const llama_model_meta_key_LLAMA_MODEL_META_KEY_SAMPLING_TOP_P: llama_model_meta_key = 2;
pub const llama_model_meta_key_LLAMA_MODEL_META_KEY_SAMPLING_MIN_P: llama_model_meta_key = 3;
pub const llama_model_meta_key_LLAMA_MODEL_META_KEY_SAMPLING_XTC_PROBABILITY: llama_model_meta_key = 4;
pub const llama_model_meta_key_LLAMA_MODEL_META_KEY_SAMPLING_XTC_THRESHOLD: llama_model_meta_key = 5;
pub const llama_model_meta_key_LLAMA_MODEL_META_KEY_SAMPLING_TEMP: llama_model_meta_key = 6;
pub const llama_model_meta_key_LLAMA_MODEL_META_KEY_SAMPLING_PENALTY_LAST_N: llama_model_meta_key = 7;
pub const llama_model_meta_key_LLAMA_MODEL_META_KEY_SAMPLING_PENALTY_REPEAT: llama_model_meta_key = 8;
pub const llama_model_meta_key_LLAMA_MODEL_META_KEY_SAMPLING_MIROSTAT: llama_model_meta_key = 9;
pub const llama_model_meta_key_LLAMA_MODEL_META_KEY_SAMPLING_MIROSTAT_TAU: llama_model_meta_key = 10;
pub const llama_model_meta_key_LLAMA_MODEL_META_KEY_SAMPLING_MIROSTAT_ETA: llama_model_meta_key = 11;
pub type llama_model_meta_key = ::std::os::raw::c_uint;
pub const llama_process_type_LLAMA_PROCESS_TYPE_ENCODE: llama_process_type = 0;
pub const llama_process_type_LLAMA_PROCESS_TYPE_DECODE: llama_process_type = 1;
pub type llama_process_type = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Copy, Clone)]
pub struct llama_model_kv_override {
pub tag: llama_model_kv_override_type,
pub key: [::std::os::raw::c_char; 128usize],
pub __bindgen_anon_1: llama_model_kv_override__bindgen_ty_1,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub union llama_model_kv_override__bindgen_ty_1 {
pub val_i64: i64,
pub val_f64: f64,
pub val_bool: bool,
pub val_str: [::std::os::raw::c_char; 128usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of llama_model_kv_override__bindgen_ty_1",
][::std::mem::size_of::<llama_model_kv_override__bindgen_ty_1>() - 128usize];
[
"Alignment of llama_model_kv_override__bindgen_ty_1",
][::std::mem::align_of::<llama_model_kv_override__bindgen_ty_1>() - 8usize];
[
"Offset of field: llama_model_kv_override__bindgen_ty_1::val_i64",
][::std::mem::offset_of!(llama_model_kv_override__bindgen_ty_1, val_i64) - 0usize];
[
"Offset of field: llama_model_kv_override__bindgen_ty_1::val_f64",
][::std::mem::offset_of!(llama_model_kv_override__bindgen_ty_1, val_f64) - 0usize];
[
"Offset of field: llama_model_kv_override__bindgen_ty_1::val_bool",
][::std::mem::offset_of!(llama_model_kv_override__bindgen_ty_1, val_bool) - 0usize];
[
"Offset of field: llama_model_kv_override__bindgen_ty_1::val_str",
][::std::mem::offset_of!(llama_model_kv_override__bindgen_ty_1, val_str) - 0usize];
};
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of llama_model_kv_override",
][::std::mem::size_of::<llama_model_kv_override>() - 264usize];
[
"Alignment of llama_model_kv_override",
][::std::mem::align_of::<llama_model_kv_override>() - 8usize];
[
"Offset of field: llama_model_kv_override::tag",
][::std::mem::offset_of!(llama_model_kv_override, tag) - 0usize];
[
"Offset of field: llama_model_kv_override::key",
][::std::mem::offset_of!(llama_model_kv_override, key) - 4usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct llama_model_tensor_buft_override {
pub pattern: *const ::std::os::raw::c_char,
pub buft: ggml_backend_buffer_type_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of llama_model_tensor_buft_override",
][::std::mem::size_of::<llama_model_tensor_buft_override>() - 16usize];
[
"Alignment of llama_model_tensor_buft_override",
][::std::mem::align_of::<llama_model_tensor_buft_override>() - 8usize];
[
"Offset of field: llama_model_tensor_buft_override::pattern",
][::std::mem::offset_of!(llama_model_tensor_buft_override, pattern) - 0usize];
[
"Offset of field: llama_model_tensor_buft_override::buft",
][::std::mem::offset_of!(llama_model_tensor_buft_override, buft) - 8usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct llama_model_params {
pub devices: *mut ggml_backend_dev_t,
pub tensor_buft_overrides: *const llama_model_tensor_buft_override,
pub n_gpu_layers: i32,
pub split_mode: llama_split_mode,
pub load_mode: llama_load_mode,
pub lazy_mode: llama_lazy_mode,
pub main_gpu: i32,
pub tensor_split: *const f32,
pub progress_callback: llama_progress_callback,
pub progress_callback_user_data: *mut ::std::os::raw::c_void,
pub kv_overrides: *const llama_model_kv_override,
pub vocab_only: bool,
pub check_tensors: bool,
pub use_extra_bufts: bool,
pub no_host: bool,
pub no_alloc: bool,
pub load_mtp: bool,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of llama_model_params",
][::std::mem::size_of::<llama_model_params>() - 80usize];
[
"Alignment of llama_model_params",
][::std::mem::align_of::<llama_model_params>() - 8usize];
[
"Offset of field: llama_model_params::devices",
][::std::mem::offset_of!(llama_model_params, devices) - 0usize];
[
"Offset of field: llama_model_params::tensor_buft_overrides",
][::std::mem::offset_of!(llama_model_params, tensor_buft_overrides) - 8usize];
[
"Offset of field: llama_model_params::n_gpu_layers",
][::std::mem::offset_of!(llama_model_params, n_gpu_layers) - 16usize];
[
"Offset of field: llama_model_params::split_mode",
][::std::mem::offset_of!(llama_model_params, split_mode) - 20usize];
[
"Offset of field: llama_model_params::load_mode",
][::std::mem::offset_of!(llama_model_params, load_mode) - 24usize];
[
"Offset of field: llama_model_params::lazy_mode",
][::std::mem::offset_of!(llama_model_params, lazy_mode) - 28usize];
[
"Offset of field: llama_model_params::main_gpu",
][::std::mem::offset_of!(llama_model_params, main_gpu) - 32usize];
[
"Offset of field: llama_model_params::tensor_split",
][::std::mem::offset_of!(llama_model_params, tensor_split) - 40usize];
[
"Offset of field: llama_model_params::progress_callback",
][::std::mem::offset_of!(llama_model_params, progress_callback) - 48usize];
[
"Offset of field: llama_model_params::progress_callback_user_data",
][::std::mem::offset_of!(llama_model_params, progress_callback_user_data) - 56usize];
[
"Offset of field: llama_model_params::kv_overrides",
][::std::mem::offset_of!(llama_model_params, kv_overrides) - 64usize];
[
"Offset of field: llama_model_params::vocab_only",
][::std::mem::offset_of!(llama_model_params, vocab_only) - 72usize];
[
"Offset of field: llama_model_params::check_tensors",
][::std::mem::offset_of!(llama_model_params, check_tensors) - 73usize];
[
"Offset of field: llama_model_params::use_extra_bufts",
][::std::mem::offset_of!(llama_model_params, use_extra_bufts) - 74usize];
[
"Offset of field: llama_model_params::no_host",
][::std::mem::offset_of!(llama_model_params, no_host) - 75usize];
[
"Offset of field: llama_model_params::no_alloc",
][::std::mem::offset_of!(llama_model_params, no_alloc) - 76usize];
[
"Offset of field: llama_model_params::load_mtp",
][::std::mem::offset_of!(llama_model_params, load_mtp) - 77usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct llama_sampler_seq_config {
pub seq_id: llama_seq_id,
pub sampler: *mut llama_sampler,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of llama_sampler_seq_config",
][::std::mem::size_of::<llama_sampler_seq_config>() - 16usize];
[
"Alignment of llama_sampler_seq_config",
][::std::mem::align_of::<llama_sampler_seq_config>() - 8usize];
[
"Offset of field: llama_sampler_seq_config::seq_id",
][::std::mem::offset_of!(llama_sampler_seq_config, seq_id) - 0usize];
[
"Offset of field: llama_sampler_seq_config::sampler",
][::std::mem::offset_of!(llama_sampler_seq_config, sampler) - 8usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct llama_context_params {
pub n_ctx: u32,
pub n_batch: u32,
pub n_ubatch: u32,
pub n_seq_max: u32,
pub n_rs_seq: u32,
pub n_outputs_max: u32,
pub n_outputs_max_per_seq: u32,
pub n_threads: i32,
pub n_threads_batch: i32,
pub ctx_type: llama_context_type,
pub rope_scaling_type: llama_rope_scaling_type,
pub pooling_type: llama_pooling_type,
pub attention_type: llama_attention_type,
pub flash_attn_type: llama_flash_attn_type,
pub rope_freq_base: f32,
pub rope_freq_scale: f32,
pub yarn_ext_factor: f32,
pub yarn_attn_factor: f32,
pub yarn_beta_fast: f32,
pub yarn_beta_slow: f32,
pub yarn_orig_ctx: u32,
pub defrag_thold: f32,
pub cb_eval: ggml_backend_sched_eval_callback,
pub cb_eval_user_data: *mut ::std::os::raw::c_void,
pub type_k: ggml_type,
pub type_v: ggml_type,
pub abort_callback: ggml_abort_callback,
pub abort_callback_data: *mut ::std::os::raw::c_void,
pub embeddings: bool,
pub offload_kqv: bool,
pub no_perf: bool,
pub op_offload: bool,
pub swa_full: bool,
pub kv_unified: bool,
pub samplers: *mut llama_sampler_seq_config,
pub n_samplers: usize,
pub ctx_other: *mut llama_context,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of llama_context_params",
][::std::mem::size_of::<llama_context_params>() - 160usize];
[
"Alignment of llama_context_params",
][::std::mem::align_of::<llama_context_params>() - 8usize];
[
"Offset of field: llama_context_params::n_ctx",
][::std::mem::offset_of!(llama_context_params, n_ctx) - 0usize];
[
"Offset of field: llama_context_params::n_batch",
][::std::mem::offset_of!(llama_context_params, n_batch) - 4usize];
[
"Offset of field: llama_context_params::n_ubatch",
][::std::mem::offset_of!(llama_context_params, n_ubatch) - 8usize];
[
"Offset of field: llama_context_params::n_seq_max",
][::std::mem::offset_of!(llama_context_params, n_seq_max) - 12usize];
[
"Offset of field: llama_context_params::n_rs_seq",
][::std::mem::offset_of!(llama_context_params, n_rs_seq) - 16usize];
[
"Offset of field: llama_context_params::n_outputs_max",
][::std::mem::offset_of!(llama_context_params, n_outputs_max) - 20usize];
[
"Offset of field: llama_context_params::n_outputs_max_per_seq",
][::std::mem::offset_of!(llama_context_params, n_outputs_max_per_seq) - 24usize];
[
"Offset of field: llama_context_params::n_threads",
][::std::mem::offset_of!(llama_context_params, n_threads) - 28usize];
[
"Offset of field: llama_context_params::n_threads_batch",
][::std::mem::offset_of!(llama_context_params, n_threads_batch) - 32usize];
[
"Offset of field: llama_context_params::ctx_type",
][::std::mem::offset_of!(llama_context_params, ctx_type) - 36usize];
[
"Offset of field: llama_context_params::rope_scaling_type",
][::std::mem::offset_of!(llama_context_params, rope_scaling_type) - 40usize];
[
"Offset of field: llama_context_params::pooling_type",
][::std::mem::offset_of!(llama_context_params, pooling_type) - 44usize];
[
"Offset of field: llama_context_params::attention_type",
][::std::mem::offset_of!(llama_context_params, attention_type) - 48usize];
[
"Offset of field: llama_context_params::flash_attn_type",
][::std::mem::offset_of!(llama_context_params, flash_attn_type) - 52usize];
[
"Offset of field: llama_context_params::rope_freq_base",
][::std::mem::offset_of!(llama_context_params, rope_freq_base) - 56usize];
[
"Offset of field: llama_context_params::rope_freq_scale",
][::std::mem::offset_of!(llama_context_params, rope_freq_scale) - 60usize];
[
"Offset of field: llama_context_params::yarn_ext_factor",
][::std::mem::offset_of!(llama_context_params, yarn_ext_factor) - 64usize];
[
"Offset of field: llama_context_params::yarn_attn_factor",
][::std::mem::offset_of!(llama_context_params, yarn_attn_factor) - 68usize];
[
"Offset of field: llama_context_params::yarn_beta_fast",
][::std::mem::offset_of!(llama_context_params, yarn_beta_fast) - 72usize];
[
"Offset of field: llama_context_params::yarn_beta_slow",
][::std::mem::offset_of!(llama_context_params, yarn_beta_slow) - 76usize];
[
"Offset of field: llama_context_params::yarn_orig_ctx",
][::std::mem::offset_of!(llama_context_params, yarn_orig_ctx) - 80usize];
[
"Offset of field: llama_context_params::defrag_thold",
][::std::mem::offset_of!(llama_context_params, defrag_thold) - 84usize];
[
"Offset of field: llama_context_params::cb_eval",
][::std::mem::offset_of!(llama_context_params, cb_eval) - 88usize];
[
"Offset of field: llama_context_params::cb_eval_user_data",
][::std::mem::offset_of!(llama_context_params, cb_eval_user_data) - 96usize];
[
"Offset of field: llama_context_params::type_k",
][::std::mem::offset_of!(llama_context_params, type_k) - 104usize];
[
"Offset of field: llama_context_params::type_v",
][::std::mem::offset_of!(llama_context_params, type_v) - 108usize];
[
"Offset of field: llama_context_params::abort_callback",
][::std::mem::offset_of!(llama_context_params, abort_callback) - 112usize];
[
"Offset of field: llama_context_params::abort_callback_data",
][::std::mem::offset_of!(llama_context_params, abort_callback_data) - 120usize];
[
"Offset of field: llama_context_params::embeddings",
][::std::mem::offset_of!(llama_context_params, embeddings) - 128usize];
[
"Offset of field: llama_context_params::offload_kqv",
][::std::mem::offset_of!(llama_context_params, offload_kqv) - 129usize];
[
"Offset of field: llama_context_params::no_perf",
][::std::mem::offset_of!(llama_context_params, no_perf) - 130usize];
[
"Offset of field: llama_context_params::op_offload",
][::std::mem::offset_of!(llama_context_params, op_offload) - 131usize];
[
"Offset of field: llama_context_params::swa_full",
][::std::mem::offset_of!(llama_context_params, swa_full) - 132usize];
[
"Offset of field: llama_context_params::kv_unified",
][::std::mem::offset_of!(llama_context_params, kv_unified) - 133usize];
[
"Offset of field: llama_context_params::samplers",
][::std::mem::offset_of!(llama_context_params, samplers) - 136usize];
[
"Offset of field: llama_context_params::n_samplers",
][::std::mem::offset_of!(llama_context_params, n_samplers) - 144usize];
[
"Offset of field: llama_context_params::ctx_other",
][::std::mem::offset_of!(llama_context_params, ctx_other) - 152usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct llama_model_tensor_override {
pub pattern: *const ::std::os::raw::c_char,
pub type_: ggml_type,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of llama_model_tensor_override",
][::std::mem::size_of::<llama_model_tensor_override>() - 16usize];
[
"Alignment of llama_model_tensor_override",
][::std::mem::align_of::<llama_model_tensor_override>() - 8usize];
[
"Offset of field: llama_model_tensor_override::pattern",
][::std::mem::offset_of!(llama_model_tensor_override, pattern) - 0usize];
[
"Offset of field: llama_model_tensor_override::type_",
][::std::mem::offset_of!(llama_model_tensor_override, type_) - 8usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct llama_model_imatrix_data {
pub name: *const ::std::os::raw::c_char,
pub data: *const f32,
pub size: usize,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of llama_model_imatrix_data",
][::std::mem::size_of::<llama_model_imatrix_data>() - 24usize];
[
"Alignment of llama_model_imatrix_data",
][::std::mem::align_of::<llama_model_imatrix_data>() - 8usize];
[
"Offset of field: llama_model_imatrix_data::name",
][::std::mem::offset_of!(llama_model_imatrix_data, name) - 0usize];
[
"Offset of field: llama_model_imatrix_data::data",
][::std::mem::offset_of!(llama_model_imatrix_data, data) - 8usize];
[
"Offset of field: llama_model_imatrix_data::size",
][::std::mem::offset_of!(llama_model_imatrix_data, size) - 16usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct llama_model_quantize_params {
pub nthread: i32,
pub ftype: llama_ftype,
pub output_tensor_type: ggml_type,
pub token_embedding_type: ggml_type,
pub allow_requantize: bool,
pub quantize_output_tensor: bool,
pub only_copy: bool,
pub pure_: bool,
pub keep_split: bool,
pub dry_run: bool,
pub imatrix: *const llama_model_imatrix_data,
pub kv_overrides: *const llama_model_kv_override,
pub tt_overrides: *const llama_model_tensor_override,
pub prune_layers: *const i32,
pub max_buf_size: usize,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of llama_model_quantize_params",
][::std::mem::size_of::<llama_model_quantize_params>() - 64usize];
[
"Alignment of llama_model_quantize_params",
][::std::mem::align_of::<llama_model_quantize_params>() - 8usize];
[
"Offset of field: llama_model_quantize_params::nthread",
][::std::mem::offset_of!(llama_model_quantize_params, nthread) - 0usize];
[
"Offset of field: llama_model_quantize_params::ftype",
][::std::mem::offset_of!(llama_model_quantize_params, ftype) - 4usize];
[
"Offset of field: llama_model_quantize_params::output_tensor_type",
][::std::mem::offset_of!(llama_model_quantize_params, output_tensor_type) - 8usize];
[
"Offset of field: llama_model_quantize_params::token_embedding_type",
][::std::mem::offset_of!(llama_model_quantize_params, token_embedding_type)
- 12usize];
[
"Offset of field: llama_model_quantize_params::allow_requantize",
][::std::mem::offset_of!(llama_model_quantize_params, allow_requantize) - 16usize];
[
"Offset of field: llama_model_quantize_params::quantize_output_tensor",
][::std::mem::offset_of!(llama_model_quantize_params, quantize_output_tensor)
- 17usize];
[
"Offset of field: llama_model_quantize_params::only_copy",
][::std::mem::offset_of!(llama_model_quantize_params, only_copy) - 18usize];
[
"Offset of field: llama_model_quantize_params::pure_",
][::std::mem::offset_of!(llama_model_quantize_params, pure_) - 19usize];
[
"Offset of field: llama_model_quantize_params::keep_split",
][::std::mem::offset_of!(llama_model_quantize_params, keep_split) - 20usize];
[
"Offset of field: llama_model_quantize_params::dry_run",
][::std::mem::offset_of!(llama_model_quantize_params, dry_run) - 21usize];
[
"Offset of field: llama_model_quantize_params::imatrix",
][::std::mem::offset_of!(llama_model_quantize_params, imatrix) - 24usize];
[
"Offset of field: llama_model_quantize_params::kv_overrides",
][::std::mem::offset_of!(llama_model_quantize_params, kv_overrides) - 32usize];
[
"Offset of field: llama_model_quantize_params::tt_overrides",
][::std::mem::offset_of!(llama_model_quantize_params, tt_overrides) - 40usize];
[
"Offset of field: llama_model_quantize_params::prune_layers",
][::std::mem::offset_of!(llama_model_quantize_params, prune_layers) - 48usize];
[
"Offset of field: llama_model_quantize_params::max_buf_size",
][::std::mem::offset_of!(llama_model_quantize_params, max_buf_size) - 56usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct llama_logit_bias {
pub token: llama_token,
pub bias: f32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of llama_logit_bias"][::std::mem::size_of::<llama_logit_bias>() - 8usize];
[
"Alignment of llama_logit_bias",
][::std::mem::align_of::<llama_logit_bias>() - 4usize];
[
"Offset of field: llama_logit_bias::token",
][::std::mem::offset_of!(llama_logit_bias, token) - 0usize];
[
"Offset of field: llama_logit_bias::bias",
][::std::mem::offset_of!(llama_logit_bias, bias) - 4usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct llama_sampler_chain_params {
pub no_perf: bool,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of llama_sampler_chain_params",
][::std::mem::size_of::<llama_sampler_chain_params>() - 1usize];
[
"Alignment of llama_sampler_chain_params",
][::std::mem::align_of::<llama_sampler_chain_params>() - 1usize];
[
"Offset of field: llama_sampler_chain_params::no_perf",
][::std::mem::offset_of!(llama_sampler_chain_params, no_perf) - 0usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct llama_chat_message {
pub role: *const ::std::os::raw::c_char,
pub content: *const ::std::os::raw::c_char,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of llama_chat_message",
][::std::mem::size_of::<llama_chat_message>() - 16usize];
[
"Alignment of llama_chat_message",
][::std::mem::align_of::<llama_chat_message>() - 8usize];
[
"Offset of field: llama_chat_message::role",
][::std::mem::offset_of!(llama_chat_message, role) - 0usize];
[
"Offset of field: llama_chat_message::content",
][::std::mem::offset_of!(llama_chat_message, content) - 8usize];
};
#[repr(C)]
#[derive(Debug)]
pub struct llama_adapter_lora {
_unused: [u8; 0],
}
unsafe extern "C" {
pub fn llama_version() -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn llama_model_default_params() -> llama_model_params;
}
unsafe extern "C" {
pub fn llama_context_default_params() -> llama_context_params;
}
unsafe extern "C" {
pub fn llama_sampler_chain_default_params() -> llama_sampler_chain_params;
}
unsafe extern "C" {
pub fn llama_model_quantize_default_params() -> llama_model_quantize_params;
}
unsafe extern "C" {
pub fn llama_backend_init();
}
unsafe extern "C" {
pub fn llama_backend_free();
}
unsafe extern "C" {
pub fn llama_numa_init(numa: ggml_numa_strategy);
}
unsafe extern "C" {
pub fn llama_attach_threadpool(
ctx: *mut llama_context,
threadpool: ggml_threadpool_t,
threadpool_batch: ggml_threadpool_t,
);
}
unsafe extern "C" {
pub fn llama_detach_threadpool(ctx: *mut llama_context);
}
pub type llama_model_set_tensor_data_t = ::std::option::Option<
unsafe extern "C" fn(tensor: *mut ggml_tensor, userdata: *mut ::std::os::raw::c_void),
>;
unsafe extern "C" {
pub fn llama_model_init_from_user(
metadata: *mut gguf_context,
set_tensor_data: llama_model_set_tensor_data_t,
set_tensor_data_ud: *mut ::std::os::raw::c_void,
params: llama_model_params,
) -> *mut llama_model;
}
unsafe extern "C" {
pub fn llama_load_model_from_file(
path_model: *const ::std::os::raw::c_char,
params: llama_model_params,
) -> *mut llama_model;
}
unsafe extern "C" {
pub fn llama_model_load_from_file(
path_model: *const ::std::os::raw::c_char,
params: llama_model_params,
) -> *mut llama_model;
}
unsafe extern "C" {
pub fn llama_model_load_from_file_ptr(
file: *mut FILE,
params: llama_model_params,
) -> *mut llama_model;
}
unsafe extern "C" {
pub fn llama_model_load_from_splits(
paths: *mut *const ::std::os::raw::c_char,
n_paths: usize,
params: llama_model_params,
) -> *mut llama_model;
}
unsafe extern "C" {
pub fn llama_model_save_to_file(
model: *const llama_model,
path_model: *const ::std::os::raw::c_char,
);
}
unsafe extern "C" {
pub fn llama_free_model(model: *mut llama_model);
}
unsafe extern "C" {
pub fn llama_model_free(model: *mut llama_model);
}
unsafe extern "C" {
pub fn llama_init_from_model(
model: *mut llama_model,
params: llama_context_params,
) -> *mut llama_context;
}
unsafe extern "C" {
pub fn llama_new_context_with_model(
model: *mut llama_model,
params: llama_context_params,
) -> *mut llama_context;
}
unsafe extern "C" {
pub fn llama_free(ctx: *mut llama_context);
}
unsafe extern "C" {
pub fn llama_time_us() -> i64;
}
unsafe extern "C" {
pub fn llama_max_devices() -> usize;
}
unsafe extern "C" {
pub fn llama_max_parallel_sequences() -> usize;
}
unsafe extern "C" {
pub fn llama_max_tensor_buft_overrides() -> usize;
}
unsafe extern "C" {
pub fn llama_supports_mmap() -> bool;
}
unsafe extern "C" {
pub fn llama_supports_mlock() -> bool;
}
unsafe extern "C" {
pub fn llama_supports_gpu_offload() -> bool;
}
unsafe extern "C" {
pub fn llama_supports_rpc() -> bool;
}
unsafe extern "C" {
pub fn llama_n_ctx(ctx: *const llama_context) -> u32;
}
unsafe extern "C" {
pub fn llama_n_ctx_seq(ctx: *const llama_context) -> u32;
}
unsafe extern "C" {
pub fn llama_n_batch(ctx: *const llama_context) -> u32;
}
unsafe extern "C" {
pub fn llama_n_ubatch(ctx: *const llama_context) -> u32;
}
unsafe extern "C" {
pub fn llama_n_seq_max(ctx: *const llama_context) -> u32;
}
unsafe extern "C" {
pub fn llama_n_rs_seq(ctx: *const llama_context) -> u32;
}
unsafe extern "C" {
pub fn llama_n_ctx_train(model: *const llama_model) -> i32;
}
unsafe extern "C" {
pub fn llama_n_embd(model: *const llama_model) -> i32;
}
unsafe extern "C" {
pub fn llama_n_layer(model: *const llama_model) -> i32;
}
unsafe extern "C" {
pub fn llama_n_head(model: *const llama_model) -> i32;
}
unsafe extern "C" {
pub fn llama_n_vocab(vocab: *const llama_vocab) -> i32;
}
unsafe extern "C" {
pub fn llama_get_model(ctx: *const llama_context) -> *const llama_model;
}
unsafe extern "C" {
pub fn llama_get_memory(ctx: *const llama_context) -> llama_memory_t;
}
unsafe extern "C" {
pub fn llama_pooling_type(ctx: *const llama_context) -> llama_pooling_type;
}
unsafe extern "C" {
pub fn llama_model_get_vocab(model: *const llama_model) -> *const llama_vocab;
}
unsafe extern "C" {
pub fn llama_model_rope_type(model: *const llama_model) -> llama_rope_type;
}
unsafe extern "C" {
pub fn llama_model_n_ctx_train(model: *const llama_model) -> i32;
}
unsafe extern "C" {
pub fn llama_model_n_embd(model: *const llama_model) -> i32;
}
unsafe extern "C" {
pub fn llama_model_n_embd_inp(model: *const llama_model) -> i32;
}
unsafe extern "C" {
pub fn llama_model_n_embd_out(model: *const llama_model) -> i32;
}
unsafe extern "C" {
pub fn llama_model_n_layer(model: *const llama_model) -> i32;
}
unsafe extern "C" {
pub fn llama_model_n_layer_nextn(model: *const llama_model) -> i32;
}
unsafe extern "C" {
pub fn llama_model_n_head(model: *const llama_model) -> i32;
}
unsafe extern "C" {
pub fn llama_model_n_head_kv(model: *const llama_model) -> i32;
}
unsafe extern "C" {
pub fn llama_model_n_swa(model: *const llama_model) -> i32;
}
unsafe extern "C" {
pub fn llama_model_rope_freq_scale_train(model: *const llama_model) -> f32;
}
unsafe extern "C" {
pub fn llama_model_n_cls_out(model: *const llama_model) -> u32;
}
unsafe extern "C" {
pub fn llama_model_cls_label(
model: *const llama_model,
i: u32,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn llama_vocab_type(vocab: *const llama_vocab) -> llama_vocab_type;
}
unsafe extern "C" {
pub fn llama_vocab_n_tokens(vocab: *const llama_vocab) -> i32;
}
unsafe extern "C" {
pub fn llama_model_meta_val_str(
model: *const llama_model,
key: *const ::std::os::raw::c_char,
buf: *mut ::std::os::raw::c_char,
buf_size: usize,
) -> i32;
}
unsafe extern "C" {
pub fn llama_model_meta_count(model: *const llama_model) -> i32;
}
unsafe extern "C" {
pub fn llama_model_meta_key_str(
key: llama_model_meta_key,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn llama_model_meta_key_by_index(
model: *const llama_model,
i: i32,
buf: *mut ::std::os::raw::c_char,
buf_size: usize,
) -> i32;
}
unsafe extern "C" {
pub fn llama_model_meta_val_str_by_index(
model: *const llama_model,
i: i32,
buf: *mut ::std::os::raw::c_char,
buf_size: usize,
) -> i32;
}
unsafe extern "C" {
pub fn llama_model_desc(
model: *const llama_model,
buf: *mut ::std::os::raw::c_char,
buf_size: usize,
) -> i32;
}
unsafe extern "C" {
pub fn llama_model_ftype(model: *const llama_model) -> llama_ftype;
}
unsafe extern "C" {
pub fn llama_model_size(model: *const llama_model) -> u64;
}
unsafe extern "C" {
pub fn llama_model_chat_template(
model: *const llama_model,
name: *const ::std::os::raw::c_char,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn llama_model_n_params(model: *const llama_model) -> u64;
}
unsafe extern "C" {
pub fn llama_model_has_encoder(model: *const llama_model) -> bool;
}
unsafe extern "C" {
pub fn llama_model_has_decoder(model: *const llama_model) -> bool;
}
unsafe extern "C" {
pub fn llama_model_decoder_start_token(model: *const llama_model) -> llama_token;
}
unsafe extern "C" {
pub fn llama_model_is_recurrent(model: *const llama_model) -> bool;
}
unsafe extern "C" {
pub fn llama_model_is_hybrid(model: *const llama_model) -> bool;
}
unsafe extern "C" {
pub fn llama_model_is_diffusion(model: *const llama_model) -> bool;
}
unsafe extern "C" {
pub fn llama_model_quantize(
fname_inp: *const ::std::os::raw::c_char,
fname_out: *const ::std::os::raw::c_char,
params: *const llama_model_quantize_params,
) -> u32;
}
unsafe extern "C" {
pub fn llama_adapter_lora_init(
model: *mut llama_model,
path_lora: *const ::std::os::raw::c_char,
) -> *mut llama_adapter_lora;
}
unsafe extern "C" {
pub fn llama_adapter_lora_init_from_file_ptr(
model: *mut llama_model,
file: *mut FILE,
) -> *mut llama_adapter_lora;
}
unsafe extern "C" {
pub fn llama_adapter_meta_val_str(
adapter: *const llama_adapter_lora,
key: *const ::std::os::raw::c_char,
buf: *mut ::std::os::raw::c_char,
buf_size: usize,
) -> i32;
}
unsafe extern "C" {
pub fn llama_adapter_meta_count(adapter: *const llama_adapter_lora) -> i32;
}
unsafe extern "C" {
pub fn llama_adapter_meta_key_by_index(
adapter: *const llama_adapter_lora,
i: i32,
buf: *mut ::std::os::raw::c_char,
buf_size: usize,
) -> i32;
}
unsafe extern "C" {
pub fn llama_adapter_meta_val_str_by_index(
adapter: *const llama_adapter_lora,
i: i32,
buf: *mut ::std::os::raw::c_char,
buf_size: usize,
) -> i32;
}
unsafe extern "C" {
pub fn llama_adapter_lora_free(adapter: *mut llama_adapter_lora);
}
unsafe extern "C" {
pub fn llama_adapter_get_alora_n_invocation_tokens(
adapter: *const llama_adapter_lora,
) -> u64;
}
unsafe extern "C" {
pub fn llama_adapter_get_alora_invocation_tokens(
adapter: *const llama_adapter_lora,
) -> *const llama_token;
}
unsafe extern "C" {
pub fn llama_set_adapters_lora(
ctx: *mut llama_context,
adapters: *mut *mut llama_adapter_lora,
n_adapters: usize,
scales: *mut f32,
) -> i32;
}
unsafe extern "C" {
pub fn llama_set_adapter_cvec(
ctx: *mut llama_context,
data: *const f32,
len: usize,
n_embd: i32,
il_start: i32,
il_end: i32,
) -> i32;
}
unsafe extern "C" {
pub fn llama_memory_clear(mem: llama_memory_t, data: bool);
}
unsafe extern "C" {
pub fn llama_memory_seq_rm(
mem: llama_memory_t,
seq_id: llama_seq_id,
p0: llama_pos,
p1: llama_pos,
) -> bool;
}
unsafe extern "C" {
pub fn llama_memory_seq_cp(
mem: llama_memory_t,
seq_id_src: llama_seq_id,
seq_id_dst: llama_seq_id,
p0: llama_pos,
p1: llama_pos,
);
}
unsafe extern "C" {
pub fn llama_memory_seq_keep(mem: llama_memory_t, seq_id: llama_seq_id);
}
unsafe extern "C" {
pub fn llama_memory_seq_add(
mem: llama_memory_t,
seq_id: llama_seq_id,
p0: llama_pos,
p1: llama_pos,
delta: llama_pos,
);
}
unsafe extern "C" {
pub fn llama_memory_seq_div(
mem: llama_memory_t,
seq_id: llama_seq_id,
p0: llama_pos,
p1: llama_pos,
d: ::std::os::raw::c_int,
);
}
unsafe extern "C" {
pub fn llama_memory_seq_pos_min(
mem: llama_memory_t,
seq_id: llama_seq_id,
) -> llama_pos;
}
unsafe extern "C" {
pub fn llama_memory_seq_pos_max(
mem: llama_memory_t,
seq_id: llama_seq_id,
) -> llama_pos;
}
unsafe extern "C" {
pub fn llama_memory_can_shift(mem: llama_memory_t) -> bool;
}
unsafe extern "C" {
pub fn llama_state_get_size(ctx: *mut llama_context) -> usize;
}
unsafe extern "C" {
pub fn llama_get_state_size(ctx: *mut llama_context) -> usize;
}
unsafe extern "C" {
pub fn llama_state_get_data(
ctx: *mut llama_context,
dst: *mut u8,
size: usize,
) -> usize;
}
unsafe extern "C" {
pub fn llama_copy_state_data(ctx: *mut llama_context, dst: *mut u8) -> usize;
}
unsafe extern "C" {
pub fn llama_state_set_data(
ctx: *mut llama_context,
src: *const u8,
size: usize,
) -> usize;
}
unsafe extern "C" {
pub fn llama_set_state_data(ctx: *mut llama_context, src: *const u8) -> usize;
}
unsafe extern "C" {
pub fn llama_state_load_file(
ctx: *mut llama_context,
path_session: *const ::std::os::raw::c_char,
tokens_out: *mut llama_token,
n_token_capacity: usize,
n_token_count_out: *mut usize,
) -> bool;
}
unsafe extern "C" {
pub fn llama_load_session_file(
ctx: *mut llama_context,
path_session: *const ::std::os::raw::c_char,
tokens_out: *mut llama_token,
n_token_capacity: usize,
n_token_count_out: *mut usize,
) -> bool;
}
unsafe extern "C" {
pub fn llama_state_save_file(
ctx: *mut llama_context,
path_session: *const ::std::os::raw::c_char,
tokens: *const llama_token,
n_token_count: usize,
) -> bool;
}
unsafe extern "C" {
pub fn llama_save_session_file(
ctx: *mut llama_context,
path_session: *const ::std::os::raw::c_char,
tokens: *const llama_token,
n_token_count: usize,
) -> bool;
}
unsafe extern "C" {
pub fn llama_state_seq_get_size(
ctx: *mut llama_context,
seq_id: llama_seq_id,
) -> usize;
}
unsafe extern "C" {
pub fn llama_state_seq_get_data(
ctx: *mut llama_context,
dst: *mut u8,
size: usize,
seq_id: llama_seq_id,
) -> usize;
}
unsafe extern "C" {
pub fn llama_state_seq_set_data(
ctx: *mut llama_context,
src: *const u8,
size: usize,
dest_seq_id: llama_seq_id,
) -> usize;
}
unsafe extern "C" {
pub fn llama_state_seq_save_file(
ctx: *mut llama_context,
filepath: *const ::std::os::raw::c_char,
seq_id: llama_seq_id,
tokens: *const llama_token,
n_token_count: usize,
) -> usize;
}
unsafe extern "C" {
pub fn llama_state_seq_load_file(
ctx: *mut llama_context,
filepath: *const ::std::os::raw::c_char,
dest_seq_id: llama_seq_id,
tokens_out: *mut llama_token,
n_token_capacity: usize,
n_token_count_out: *mut usize,
) -> usize;
}
pub type llama_state_seq_flags = u32;
unsafe extern "C" {
pub fn llama_state_seq_get_size_ext(
ctx: *mut llama_context,
seq_id: llama_seq_id,
flags: llama_state_seq_flags,
) -> usize;
}
unsafe extern "C" {
pub fn llama_state_seq_get_data_ext(
ctx: *mut llama_context,
dst: *mut u8,
size: usize,
seq_id: llama_seq_id,
flags: llama_state_seq_flags,
) -> usize;
}
unsafe extern "C" {
pub fn llama_state_seq_set_data_ext(
ctx: *mut llama_context,
src: *const u8,
size: usize,
dest_seq_id: llama_seq_id,
flags: llama_state_seq_flags,
) -> usize;
}
unsafe extern "C" {
pub fn llama_batch_get_one(tokens: *mut llama_token, n_tokens: i32) -> llama_batch;
}
unsafe extern "C" {
pub fn llama_batch_init(n_tokens: i32, embd: i32, n_seq_max: i32) -> llama_batch;
}
unsafe extern "C" {
pub fn llama_batch_free(batch: llama_batch);
}
unsafe extern "C" {
pub fn llama_encode(ctx: *mut llama_context, batch: llama_batch) -> i32;
}
unsafe extern "C" {
pub fn llama_decode(ctx: *mut llama_context, batch: llama_batch) -> i32;
}
#[repr(C)]
#[derive(Debug)]
pub struct llama_batch_ext {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct llama_embd {
pub data: *const f32,
pub n_rows: usize,
pub n_embd: usize,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of llama_embd"][::std::mem::size_of::<llama_embd>() - 24usize];
["Alignment of llama_embd"][::std::mem::align_of::<llama_embd>() - 8usize];
[
"Offset of field: llama_embd::data",
][::std::mem::offset_of!(llama_embd, data) - 0usize];
[
"Offset of field: llama_embd::n_rows",
][::std::mem::offset_of!(llama_embd, n_rows) - 8usize];
[
"Offset of field: llama_embd::n_embd",
][::std::mem::offset_of!(llama_embd, n_embd) - 16usize];
};
unsafe extern "C" {
pub fn llama_batch_ext_init(ctx: *mut llama_context) -> *mut llama_batch_ext;
}
unsafe extern "C" {
pub fn llama_batch_ext_free(batch: *mut llama_batch_ext);
}
unsafe extern "C" {
pub fn llama_batch_ext_clear(batch: *mut llama_batch_ext);
}
unsafe extern "C" {
pub fn llama_batch_ext_add(batch: *mut llama_batch_ext, seq_id: llama_seq_id) -> i32;
}
unsafe extern "C" {
pub fn llama_batch_ext_add_token(
batch: *mut llama_batch_ext,
seq_id: llama_seq_id,
id: llama_token,
) -> i32;
}
unsafe extern "C" {
pub fn llama_batch_ext_add_embd(
batch: *mut llama_batch_ext,
seq_id: llama_seq_id,
embd: llama_embd,
) -> i32;
}
unsafe extern "C" {
pub fn llama_batch_ext_add_seq(
batch: *mut llama_batch_ext,
idx: i32,
seq_id: llama_seq_id,
) -> bool;
}
unsafe extern "C" {
pub fn llama_batch_ext_set_embd_token(
batch: *mut llama_batch_ext,
idx: i32,
embd: llama_embd,
) -> bool;
}
unsafe extern "C" {
pub fn llama_batch_ext_set_embd_state(
batch: *mut llama_batch_ext,
idx: i32,
embd: llama_embd,
) -> bool;
}
unsafe extern "C" {
pub fn llama_batch_ext_set_output_embd(
batch: *mut llama_batch_ext,
idx: i32,
value: bool,
) -> bool;
}
unsafe extern "C" {
pub fn llama_batch_ext_set_output_logits(
batch: *mut llama_batch_ext,
idx: i32,
value: bool,
) -> bool;
}
unsafe extern "C" {
pub fn llama_batch_ext_set_pos(
batch: *mut llama_batch_ext,
idx: i32,
pos: *const llama_pos,
) -> bool;
}
unsafe extern "C" {
pub fn llama_process(
ctx: *mut llama_context,
type_: llama_process_type,
batch: *mut llama_batch_ext,
) -> i32;
}
unsafe extern "C" {
pub fn llama_set_n_threads(
ctx: *mut llama_context,
n_threads: i32,
n_threads_batch: i32,
);
}
unsafe extern "C" {
pub fn llama_n_threads(ctx: *mut llama_context) -> i32;
}
unsafe extern "C" {
pub fn llama_n_threads_batch(ctx: *mut llama_context) -> i32;
}
unsafe extern "C" {
pub fn llama_set_embeddings(ctx: *mut llama_context, embeddings: bool);
}
unsafe extern "C" {
pub fn llama_set_causal_attn(ctx: *mut llama_context, causal_attn: bool);
}
unsafe extern "C" {
pub fn llama_get_causal_attn(ctx: *const llama_context) -> bool;
}
unsafe extern "C" {
pub fn llama_set_warmup(ctx: *mut llama_context, warmup: bool);
}
unsafe extern "C" {
pub fn llama_set_abort_callback(
ctx: *mut llama_context,
abort_callback: ggml_abort_callback,
abort_callback_data: *mut ::std::os::raw::c_void,
);
}
unsafe extern "C" {
pub fn llama_synchronize(ctx: *mut llama_context);
}
unsafe extern "C" {
pub fn llama_get_logits(ctx: *mut llama_context) -> *mut f32;
}
unsafe extern "C" {
pub fn llama_get_logits_ith(ctx: *mut llama_context, i: i32) -> *mut f32;
}
unsafe extern "C" {
pub fn llama_get_embeddings(ctx: *mut llama_context) -> *mut f32;
}
unsafe extern "C" {
pub fn llama_get_embeddings_ith(ctx: *mut llama_context, i: i32) -> *mut f32;
}
unsafe extern "C" {
pub fn llama_get_embeddings_seq(
ctx: *mut llama_context,
seq_id: llama_seq_id,
) -> *mut f32;
}
unsafe extern "C" {
pub fn llama_get_sampled_token_ith(ctx: *mut llama_context, i: i32) -> llama_token;
}
unsafe extern "C" {
pub fn llama_get_sampled_probs_ith(ctx: *mut llama_context, i: i32) -> *mut f32;
}
unsafe extern "C" {
pub fn llama_get_sampled_probs_count_ith(ctx: *mut llama_context, i: i32) -> u32;
}
unsafe extern "C" {
pub fn llama_get_sampled_logits_ith(ctx: *mut llama_context, i: i32) -> *mut f32;
}
unsafe extern "C" {
pub fn llama_get_sampled_logits_count_ith(ctx: *mut llama_context, i: i32) -> u32;
}
unsafe extern "C" {
pub fn llama_get_sampled_candidates_ith(
ctx: *mut llama_context,
i: i32,
) -> *mut llama_token;
}
unsafe extern "C" {
pub fn llama_get_sampled_candidates_count_ith(
ctx: *mut llama_context,
i: i32,
) -> u32;
}
unsafe extern "C" {
pub fn llama_vocab_get_text(
vocab: *const llama_vocab,
token: llama_token,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn llama_vocab_get_score(vocab: *const llama_vocab, token: llama_token) -> f32;
}
unsafe extern "C" {
pub fn llama_vocab_get_attr(
vocab: *const llama_vocab,
token: llama_token,
) -> llama_token_attr;
}
unsafe extern "C" {
pub fn llama_vocab_is_eog(vocab: *const llama_vocab, token: llama_token) -> bool;
}
unsafe extern "C" {
pub fn llama_vocab_is_control(vocab: *const llama_vocab, token: llama_token) -> bool;
}
unsafe extern "C" {
pub fn llama_vocab_bos(vocab: *const llama_vocab) -> llama_token;
}
unsafe extern "C" {
pub fn llama_vocab_eos(vocab: *const llama_vocab) -> llama_token;
}
unsafe extern "C" {
pub fn llama_vocab_eot(vocab: *const llama_vocab) -> llama_token;
}
unsafe extern "C" {
pub fn llama_vocab_sep(vocab: *const llama_vocab) -> llama_token;
}
unsafe extern "C" {
pub fn llama_vocab_nl(vocab: *const llama_vocab) -> llama_token;
}
unsafe extern "C" {
pub fn llama_vocab_pad(vocab: *const llama_vocab) -> llama_token;
}
unsafe extern "C" {
pub fn llama_vocab_mask(vocab: *const llama_vocab) -> llama_token;
}
unsafe extern "C" {
pub fn llama_vocab_get_add_bos(vocab: *const llama_vocab) -> bool;
}
unsafe extern "C" {
pub fn llama_vocab_get_add_eos(vocab: *const llama_vocab) -> bool;
}
unsafe extern "C" {
pub fn llama_vocab_get_add_sep(vocab: *const llama_vocab) -> bool;
}
unsafe extern "C" {
pub fn llama_vocab_get_suppress_tokens(
vocab: *const llama_vocab,
n_suppress_tokens: *mut i32,
) -> *const llama_token;
}
unsafe extern "C" {
pub fn llama_vocab_fim_pre(vocab: *const llama_vocab) -> llama_token;
}
unsafe extern "C" {
pub fn llama_vocab_fim_suf(vocab: *const llama_vocab) -> llama_token;
}
unsafe extern "C" {
pub fn llama_vocab_fim_mid(vocab: *const llama_vocab) -> llama_token;
}
unsafe extern "C" {
pub fn llama_vocab_fim_pad(vocab: *const llama_vocab) -> llama_token;
}
unsafe extern "C" {
pub fn llama_vocab_fim_rep(vocab: *const llama_vocab) -> llama_token;
}
unsafe extern "C" {
pub fn llama_vocab_fim_sep(vocab: *const llama_vocab) -> llama_token;
}
unsafe extern "C" {
pub fn llama_token_get_text(
vocab: *const llama_vocab,
token: llama_token,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn llama_token_get_score(vocab: *const llama_vocab, token: llama_token) -> f32;
}
unsafe extern "C" {
pub fn llama_token_get_attr(
vocab: *const llama_vocab,
token: llama_token,
) -> llama_token_attr;
}
unsafe extern "C" {
pub fn llama_token_is_eog(vocab: *const llama_vocab, token: llama_token) -> bool;
}
unsafe extern "C" {
pub fn llama_token_is_control(vocab: *const llama_vocab, token: llama_token) -> bool;
}
unsafe extern "C" {
pub fn llama_token_bos(vocab: *const llama_vocab) -> llama_token;
}
unsafe extern "C" {
pub fn llama_token_eos(vocab: *const llama_vocab) -> llama_token;
}
unsafe extern "C" {
pub fn llama_token_eot(vocab: *const llama_vocab) -> llama_token;
}
unsafe extern "C" {
pub fn llama_token_cls(vocab: *const llama_vocab) -> llama_token;
}
unsafe extern "C" {
pub fn llama_token_sep(vocab: *const llama_vocab) -> llama_token;
}
unsafe extern "C" {
pub fn llama_token_nl(vocab: *const llama_vocab) -> llama_token;
}
unsafe extern "C" {
pub fn llama_token_pad(vocab: *const llama_vocab) -> llama_token;
}
unsafe extern "C" {
pub fn llama_add_bos_token(vocab: *const llama_vocab) -> bool;
}
unsafe extern "C" {
pub fn llama_add_eos_token(vocab: *const llama_vocab) -> bool;
}
unsafe extern "C" {
pub fn llama_token_fim_pre(vocab: *const llama_vocab) -> llama_token;
}
unsafe extern "C" {
pub fn llama_token_fim_suf(vocab: *const llama_vocab) -> llama_token;
}
unsafe extern "C" {
pub fn llama_token_fim_mid(vocab: *const llama_vocab) -> llama_token;
}
unsafe extern "C" {
pub fn llama_token_fim_pad(vocab: *const llama_vocab) -> llama_token;
}
unsafe extern "C" {
pub fn llama_token_fim_rep(vocab: *const llama_vocab) -> llama_token;
}
unsafe extern "C" {
pub fn llama_token_fim_sep(vocab: *const llama_vocab) -> llama_token;
}
unsafe extern "C" {
pub fn llama_vocab_cls(vocab: *const llama_vocab) -> llama_token;
}
unsafe extern "C" {
pub fn llama_tokenize(
vocab: *const llama_vocab,
text: *const ::std::os::raw::c_char,
text_len: i32,
tokens: *mut llama_token,
n_tokens_max: i32,
add_special: bool,
parse_special: bool,
) -> i32;
}
unsafe extern "C" {
pub fn llama_token_to_piece(
vocab: *const llama_vocab,
token: llama_token,
buf: *mut ::std::os::raw::c_char,
length: i32,
lstrip: i32,
special: bool,
) -> i32;
}
unsafe extern "C" {
pub fn llama_detokenize(
vocab: *const llama_vocab,
tokens: *const llama_token,
n_tokens: i32,
text: *mut ::std::os::raw::c_char,
text_len_max: i32,
remove_special: bool,
unparse_special: bool,
) -> i32;
}
unsafe extern "C" {
pub fn llama_chat_apply_template(
tmpl: *const ::std::os::raw::c_char,
chat: *const llama_chat_message,
n_msg: usize,
add_ass: bool,
buf: *mut ::std::os::raw::c_char,
length: i32,
) -> i32;
}
unsafe extern "C" {
pub fn llama_chat_builtin_templates(
output: *mut *const ::std::os::raw::c_char,
len: usize,
) -> i32;
}
pub type llama_sampler_context_t = *mut ::std::os::raw::c_void;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct llama_sampler_data {
pub logits: *mut ggml_tensor,
pub probs: *mut ggml_tensor,
pub sampled: *mut ggml_tensor,
pub candidates: *mut ggml_tensor,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of llama_sampler_data",
][::std::mem::size_of::<llama_sampler_data>() - 32usize];
[
"Alignment of llama_sampler_data",
][::std::mem::align_of::<llama_sampler_data>() - 8usize];
[
"Offset of field: llama_sampler_data::logits",
][::std::mem::offset_of!(llama_sampler_data, logits) - 0usize];
[
"Offset of field: llama_sampler_data::probs",
][::std::mem::offset_of!(llama_sampler_data, probs) - 8usize];
[
"Offset of field: llama_sampler_data::sampled",
][::std::mem::offset_of!(llama_sampler_data, sampled) - 16usize];
[
"Offset of field: llama_sampler_data::candidates",
][::std::mem::offset_of!(llama_sampler_data, candidates) - 24usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct llama_sampler_i {
pub name: ::std::option::Option<
unsafe extern "C" fn(smpl: *const llama_sampler) -> *const ::std::os::raw::c_char,
>,
pub accept: ::std::option::Option<
unsafe extern "C" fn(smpl: *mut llama_sampler, token: llama_token),
>,
pub apply: ::std::option::Option<
unsafe extern "C" fn(
smpl: *mut llama_sampler,
cur_p: *mut llama_token_data_array,
),
>,
pub reset: ::std::option::Option<unsafe extern "C" fn(smpl: *mut llama_sampler)>,
pub clone: ::std::option::Option<
unsafe extern "C" fn(smpl: *const llama_sampler) -> *mut llama_sampler,
>,
pub free: ::std::option::Option<unsafe extern "C" fn(smpl: *mut llama_sampler)>,
pub backend_init: ::std::option::Option<
unsafe extern "C" fn(
smpl: *mut llama_sampler,
buft: ggml_backend_buffer_type_t,
n_outputs_max_per_seq: u32,
) -> bool,
>,
pub backend_accept: ::std::option::Option<
unsafe extern "C" fn(
smpl: *mut llama_sampler,
ctx: *mut ggml_context,
gf: *mut ggml_cgraph,
selected_token: *mut ggml_tensor,
),
>,
pub backend_apply: ::std::option::Option<
unsafe extern "C" fn(
smpl: *mut llama_sampler,
ctx: *mut ggml_context,
gf: *mut ggml_cgraph,
data: *mut llama_sampler_data,
),
>,
pub backend_set_input: ::std::option::Option<
unsafe extern "C" fn(smpl: *mut llama_sampler),
>,
pub backend_reset: ::std::option::Option<
unsafe extern "C" fn(smpl: *mut llama_sampler),
>,
pub copy_state: ::std::option::Option<
unsafe extern "C" fn(src: *const llama_sampler, dst: *mut llama_sampler),
>,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of llama_sampler_i"][::std::mem::size_of::<llama_sampler_i>() - 96usize];
["Alignment of llama_sampler_i"][::std::mem::align_of::<llama_sampler_i>() - 8usize];
[
"Offset of field: llama_sampler_i::name",
][::std::mem::offset_of!(llama_sampler_i, name) - 0usize];
[
"Offset of field: llama_sampler_i::accept",
][::std::mem::offset_of!(llama_sampler_i, accept) - 8usize];
[
"Offset of field: llama_sampler_i::apply",
][::std::mem::offset_of!(llama_sampler_i, apply) - 16usize];
[
"Offset of field: llama_sampler_i::reset",
][::std::mem::offset_of!(llama_sampler_i, reset) - 24usize];
[
"Offset of field: llama_sampler_i::clone",
][::std::mem::offset_of!(llama_sampler_i, clone) - 32usize];
[
"Offset of field: llama_sampler_i::free",
][::std::mem::offset_of!(llama_sampler_i, free) - 40usize];
[
"Offset of field: llama_sampler_i::backend_init",
][::std::mem::offset_of!(llama_sampler_i, backend_init) - 48usize];
[
"Offset of field: llama_sampler_i::backend_accept",
][::std::mem::offset_of!(llama_sampler_i, backend_accept) - 56usize];
[
"Offset of field: llama_sampler_i::backend_apply",
][::std::mem::offset_of!(llama_sampler_i, backend_apply) - 64usize];
[
"Offset of field: llama_sampler_i::backend_set_input",
][::std::mem::offset_of!(llama_sampler_i, backend_set_input) - 72usize];
[
"Offset of field: llama_sampler_i::backend_reset",
][::std::mem::offset_of!(llama_sampler_i, backend_reset) - 80usize];
[
"Offset of field: llama_sampler_i::copy_state",
][::std::mem::offset_of!(llama_sampler_i, copy_state) - 88usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct llama_sampler {
pub iface: *mut llama_sampler_i,
pub ctx: llama_sampler_context_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of llama_sampler"][::std::mem::size_of::<llama_sampler>() - 16usize];
["Alignment of llama_sampler"][::std::mem::align_of::<llama_sampler>() - 8usize];
[
"Offset of field: llama_sampler::iface",
][::std::mem::offset_of!(llama_sampler, iface) - 0usize];
[
"Offset of field: llama_sampler::ctx",
][::std::mem::offset_of!(llama_sampler, ctx) - 8usize];
};
unsafe extern "C" {
pub fn llama_set_sampler(
ctx: *mut llama_context,
seq_id: llama_seq_id,
smpl: *mut llama_sampler,
) -> bool;
}
unsafe extern "C" {
pub fn llama_sampler_init(
iface: *mut llama_sampler_i,
ctx: llama_sampler_context_t,
) -> *mut llama_sampler;
}
unsafe extern "C" {
pub fn llama_sampler_name(
smpl: *const llama_sampler,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn llama_sampler_accept(smpl: *mut llama_sampler, token: llama_token);
}
unsafe extern "C" {
pub fn llama_sampler_apply(
smpl: *mut llama_sampler,
cur_p: *mut llama_token_data_array,
);
}
unsafe extern "C" {
pub fn llama_sampler_reset(smpl: *mut llama_sampler);
}
unsafe extern "C" {
pub fn llama_sampler_clone(smpl: *const llama_sampler) -> *mut llama_sampler;
}
unsafe extern "C" {
pub fn llama_sampler_copy(src: *const llama_sampler, dst: *mut llama_sampler);
}
unsafe extern "C" {
pub fn llama_sampler_free(smpl: *mut llama_sampler);
}
unsafe extern "C" {
pub fn llama_sampler_chain_init(
params: llama_sampler_chain_params,
) -> *mut llama_sampler;
}
unsafe extern "C" {
pub fn llama_sampler_chain_add(chain: *mut llama_sampler, smpl: *mut llama_sampler);
}
unsafe extern "C" {
pub fn llama_sampler_chain_get(
chain: *mut llama_sampler,
i: i32,
) -> *mut llama_sampler;
}
unsafe extern "C" {
pub fn llama_sampler_chain_n(chain: *const llama_sampler) -> i32;
}
unsafe extern "C" {
pub fn llama_sampler_chain_remove(
chain: *mut llama_sampler,
i: i32,
) -> *mut llama_sampler;
}
unsafe extern "C" {
pub fn llama_sampler_init_greedy() -> *mut llama_sampler;
}
unsafe extern "C" {
pub fn llama_sampler_init_dist(seed: u32) -> *mut llama_sampler;
}
unsafe extern "C" {
pub fn llama_sampler_init_top_k(k: i32) -> *mut llama_sampler;
}
unsafe extern "C" {
pub fn llama_sampler_init_top_p(p: f32, min_keep: usize) -> *mut llama_sampler;
}
unsafe extern "C" {
pub fn llama_sampler_init_min_p(p: f32, min_keep: usize) -> *mut llama_sampler;
}
unsafe extern "C" {
pub fn llama_sampler_init_typical(p: f32, min_keep: usize) -> *mut llama_sampler;
}
unsafe extern "C" {
pub fn llama_sampler_init_temp(t: f32) -> *mut llama_sampler;
}
unsafe extern "C" {
pub fn llama_sampler_init_temp_ext(
t: f32,
delta: f32,
exponent: f32,
) -> *mut llama_sampler;
}
unsafe extern "C" {
pub fn llama_sampler_init_xtc(
p: f32,
t: f32,
min_keep: usize,
seed: u32,
) -> *mut llama_sampler;
}
unsafe extern "C" {
pub fn llama_sampler_init_top_n_sigma(n: f32) -> *mut llama_sampler;
}
unsafe extern "C" {
pub fn llama_sampler_init_mirostat(
n_vocab: i32,
seed: u32,
tau: f32,
eta: f32,
m: i32,
) -> *mut llama_sampler;
}
unsafe extern "C" {
pub fn llama_sampler_init_mirostat_v2(
seed: u32,
tau: f32,
eta: f32,
) -> *mut llama_sampler;
}
unsafe extern "C" {
pub fn llama_sampler_init_grammar(
vocab: *const llama_vocab,
grammar_str: *const ::std::os::raw::c_char,
grammar_root: *const ::std::os::raw::c_char,
) -> *mut llama_sampler;
}
unsafe extern "C" {
pub fn llama_sampler_init_grammar_lazy(
vocab: *const llama_vocab,
grammar_str: *const ::std::os::raw::c_char,
grammar_root: *const ::std::os::raw::c_char,
trigger_words: *mut *const ::std::os::raw::c_char,
num_trigger_words: usize,
trigger_tokens: *const llama_token,
num_trigger_tokens: usize,
) -> *mut llama_sampler;
}
unsafe extern "C" {
pub fn llama_sampler_init_grammar_lazy_patterns(
vocab: *const llama_vocab,
grammar_str: *const ::std::os::raw::c_char,
grammar_root: *const ::std::os::raw::c_char,
trigger_patterns: *mut *const ::std::os::raw::c_char,
num_trigger_patterns: usize,
trigger_tokens: *const llama_token,
num_trigger_tokens: usize,
) -> *mut llama_sampler;
}
unsafe extern "C" {
pub fn llama_sampler_init_penalties(
n_vocab: i32,
penalty_last_n: i32,
penalty_repeat: f32,
penalty_freq: f32,
penalty_present: f32,
) -> *mut llama_sampler;
}
unsafe extern "C" {
pub fn llama_sampler_init_dry(
vocab: *const llama_vocab,
dry_multiplier: f32,
dry_base: f32,
dry_allowed_length: i32,
dry_penalty_last_n: i32,
seq_breakers: *mut *const ::std::os::raw::c_char,
num_breakers: usize,
) -> *mut llama_sampler;
}
unsafe extern "C" {
pub fn llama_sampler_init_adaptive_p(
target: f32,
decay: f32,
seed: u32,
) -> *mut llama_sampler;
}
unsafe extern "C" {
pub fn llama_sampler_init_logit_bias(
n_vocab: i32,
n_logit_bias: i32,
logit_bias: *const llama_logit_bias,
) -> *mut llama_sampler;
}
unsafe extern "C" {
pub fn llama_sampler_init_infill(vocab: *const llama_vocab) -> *mut llama_sampler;
}
unsafe extern "C" {
pub fn llama_sampler_get_seed(smpl: *const llama_sampler) -> u32;
}
unsafe extern "C" {
pub fn llama_sampler_sample(
smpl: *mut llama_sampler,
ctx: *mut llama_context,
idx: i32,
) -> llama_token;
}
unsafe extern "C" {
pub fn llama_split_path(
split_path: *mut ::std::os::raw::c_char,
maxlen: usize,
path_prefix: *const ::std::os::raw::c_char,
split_no: i32,
split_count: i32,
) -> i32;
}
unsafe extern "C" {
pub fn llama_split_prefix(
split_prefix: *mut ::std::os::raw::c_char,
maxlen: usize,
split_path: *const ::std::os::raw::c_char,
split_no: i32,
split_count: i32,
) -> i32;
}
unsafe extern "C" {
pub fn llama_print_system_info() -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn llama_log_get(
log_callback: *mut ggml_log_callback,
user_data: *mut *mut ::std::os::raw::c_void,
);
}
unsafe extern "C" {
pub fn llama_log_set(
log_callback: ggml_log_callback,
user_data: *mut ::std::os::raw::c_void,
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct llama_perf_context_data {
pub t_start_ms: f64,
pub t_load_ms: f64,
pub t_p_eval_ms: f64,
pub t_eval_ms: f64,
pub n_p_eval: i32,
pub n_eval: i32,
pub n_reused: i32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of llama_perf_context_data",
][::std::mem::size_of::<llama_perf_context_data>() - 48usize];
[
"Alignment of llama_perf_context_data",
][::std::mem::align_of::<llama_perf_context_data>() - 8usize];
[
"Offset of field: llama_perf_context_data::t_start_ms",
][::std::mem::offset_of!(llama_perf_context_data, t_start_ms) - 0usize];
[
"Offset of field: llama_perf_context_data::t_load_ms",
][::std::mem::offset_of!(llama_perf_context_data, t_load_ms) - 8usize];
[
"Offset of field: llama_perf_context_data::t_p_eval_ms",
][::std::mem::offset_of!(llama_perf_context_data, t_p_eval_ms) - 16usize];
[
"Offset of field: llama_perf_context_data::t_eval_ms",
][::std::mem::offset_of!(llama_perf_context_data, t_eval_ms) - 24usize];
[
"Offset of field: llama_perf_context_data::n_p_eval",
][::std::mem::offset_of!(llama_perf_context_data, n_p_eval) - 32usize];
[
"Offset of field: llama_perf_context_data::n_eval",
][::std::mem::offset_of!(llama_perf_context_data, n_eval) - 36usize];
[
"Offset of field: llama_perf_context_data::n_reused",
][::std::mem::offset_of!(llama_perf_context_data, n_reused) - 40usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct llama_perf_sampler_data {
pub t_sample_ms: f64,
pub n_sample: i32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of llama_perf_sampler_data",
][::std::mem::size_of::<llama_perf_sampler_data>() - 16usize];
[
"Alignment of llama_perf_sampler_data",
][::std::mem::align_of::<llama_perf_sampler_data>() - 8usize];
[
"Offset of field: llama_perf_sampler_data::t_sample_ms",
][::std::mem::offset_of!(llama_perf_sampler_data, t_sample_ms) - 0usize];
[
"Offset of field: llama_perf_sampler_data::n_sample",
][::std::mem::offset_of!(llama_perf_sampler_data, n_sample) - 8usize];
};
unsafe extern "C" {
pub fn llama_perf_context(ctx: *const llama_context) -> llama_perf_context_data;
}
unsafe extern "C" {
pub fn llama_perf_context_print(ctx: *const llama_context);
}
unsafe extern "C" {
pub fn llama_perf_context_reset(ctx: *mut llama_context);
}
unsafe extern "C" {
pub fn llama_perf_sampler(chain: *const llama_sampler) -> llama_perf_sampler_data;
}
unsafe extern "C" {
pub fn llama_perf_sampler_print(chain: *const llama_sampler);
}
unsafe extern "C" {
pub fn llama_perf_sampler_reset(chain: *mut llama_sampler);
}
pub type llama_opt_param_filter = ::std::option::Option<
unsafe extern "C" fn(
tensor: *const ggml_tensor,
userdata: *mut ::std::os::raw::c_void,
) -> bool,
>;
unsafe extern "C" {
pub fn llama_opt_param_filter_all(
tensor: *const ggml_tensor,
userdata: *mut ::std::os::raw::c_void,
) -> bool;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct llama_opt_params {
pub n_ctx_train: u32,
pub param_filter: llama_opt_param_filter,
pub param_filter_ud: *mut ::std::os::raw::c_void,
pub get_opt_pars: ggml_opt_get_optimizer_params,
pub get_opt_pars_ud: *mut ::std::os::raw::c_void,
pub optimizer_type: ggml_opt_optimizer_type,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of llama_opt_params"][::std::mem::size_of::<llama_opt_params>() - 48usize];
[
"Alignment of llama_opt_params",
][::std::mem::align_of::<llama_opt_params>() - 8usize];
[
"Offset of field: llama_opt_params::n_ctx_train",
][::std::mem::offset_of!(llama_opt_params, n_ctx_train) - 0usize];
[
"Offset of field: llama_opt_params::param_filter",
][::std::mem::offset_of!(llama_opt_params, param_filter) - 8usize];
[
"Offset of field: llama_opt_params::param_filter_ud",
][::std::mem::offset_of!(llama_opt_params, param_filter_ud) - 16usize];
[
"Offset of field: llama_opt_params::get_opt_pars",
][::std::mem::offset_of!(llama_opt_params, get_opt_pars) - 24usize];
[
"Offset of field: llama_opt_params::get_opt_pars_ud",
][::std::mem::offset_of!(llama_opt_params, get_opt_pars_ud) - 32usize];
[
"Offset of field: llama_opt_params::optimizer_type",
][::std::mem::offset_of!(llama_opt_params, optimizer_type) - 40usize];
};
unsafe extern "C" {
pub fn llama_opt_init(
lctx: *mut llama_context,
model: *mut llama_model,
lopt_params: llama_opt_params,
);
}
unsafe extern "C" {
pub fn llama_opt_epoch(
lctx: *mut llama_context,
dataset: ggml_opt_dataset_t,
result_train: ggml_opt_result_t,
result_eval: ggml_opt_result_t,
idata_split: i64,
callback_train: ggml_opt_epoch_callback,
callback_eval: ggml_opt_epoch_callback,
);
}
pub const mtmd_input_chunk_type_MTMD_INPUT_CHUNK_TYPE_TEXT: mtmd_input_chunk_type = 0;
pub const mtmd_input_chunk_type_MTMD_INPUT_CHUNK_TYPE_IMAGE: mtmd_input_chunk_type = 1;
pub const mtmd_input_chunk_type_MTMD_INPUT_CHUNK_TYPE_AUDIO: mtmd_input_chunk_type = 2;
pub const mtmd_input_chunk_type_MTMD_INPUT_CHUNK_TYPE_COUNT: mtmd_input_chunk_type = 3;
pub type mtmd_input_chunk_type = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug)]
pub struct mtmd_context {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug)]
pub struct mtmd_bitmap {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug)]
pub struct mtmd_image_tokens {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug)]
pub struct mtmd_input_chunk {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug)]
pub struct mtmd_input_chunks {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug)]
pub struct mtmd_batch {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct mtmd_input_text {
pub text: *const ::std::os::raw::c_char,
pub text_len: usize,
pub add_special: bool,
pub parse_special: bool,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of mtmd_input_text"][::std::mem::size_of::<mtmd_input_text>() - 24usize];
["Alignment of mtmd_input_text"][::std::mem::align_of::<mtmd_input_text>() - 8usize];
[
"Offset of field: mtmd_input_text::text",
][::std::mem::offset_of!(mtmd_input_text, text) - 0usize];
[
"Offset of field: mtmd_input_text::text_len",
][::std::mem::offset_of!(mtmd_input_text, text_len) - 8usize];
[
"Offset of field: mtmd_input_text::add_special",
][::std::mem::offset_of!(mtmd_input_text, add_special) - 16usize];
[
"Offset of field: mtmd_input_text::parse_special",
][::std::mem::offset_of!(mtmd_input_text, parse_special) - 17usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct mtmd_input_part {
pub text: *const mtmd_input_text,
pub bitmap: *const mtmd_bitmap,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of mtmd_input_part"][::std::mem::size_of::<mtmd_input_part>() - 16usize];
["Alignment of mtmd_input_part"][::std::mem::align_of::<mtmd_input_part>() - 8usize];
[
"Offset of field: mtmd_input_part::text",
][::std::mem::offset_of!(mtmd_input_part, text) - 0usize];
[
"Offset of field: mtmd_input_part::bitmap",
][::std::mem::offset_of!(mtmd_input_part, bitmap) - 8usize];
};
pub type mtmd_progress_callback = ::std::option::Option<
unsafe extern "C" fn(progress: f32, user_data: *mut ::std::os::raw::c_void) -> bool,
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct mtmd_context_params {
pub use_gpu: bool,
pub device: ggml_backend_dev_t,
pub print_timings: bool,
pub n_threads: ::std::os::raw::c_int,
pub image_marker: *const ::std::os::raw::c_char,
pub media_marker: *const ::std::os::raw::c_char,
pub flash_attn_type: llama_flash_attn_type,
pub warmup: bool,
pub image_min_tokens: ::std::os::raw::c_int,
pub image_max_tokens: ::std::os::raw::c_int,
pub cb_eval: ggml_backend_sched_eval_callback,
pub cb_eval_user_data: *mut ::std::os::raw::c_void,
pub batch_max_tokens: i32,
pub progress_callback: mtmd_progress_callback,
pub progress_callback_user_data: *mut ::std::os::raw::c_void,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of mtmd_context_params",
][::std::mem::size_of::<mtmd_context_params>() - 96usize];
[
"Alignment of mtmd_context_params",
][::std::mem::align_of::<mtmd_context_params>() - 8usize];
[
"Offset of field: mtmd_context_params::use_gpu",
][::std::mem::offset_of!(mtmd_context_params, use_gpu) - 0usize];
[
"Offset of field: mtmd_context_params::device",
][::std::mem::offset_of!(mtmd_context_params, device) - 8usize];
[
"Offset of field: mtmd_context_params::print_timings",
][::std::mem::offset_of!(mtmd_context_params, print_timings) - 16usize];
[
"Offset of field: mtmd_context_params::n_threads",
][::std::mem::offset_of!(mtmd_context_params, n_threads) - 20usize];
[
"Offset of field: mtmd_context_params::image_marker",
][::std::mem::offset_of!(mtmd_context_params, image_marker) - 24usize];
[
"Offset of field: mtmd_context_params::media_marker",
][::std::mem::offset_of!(mtmd_context_params, media_marker) - 32usize];
[
"Offset of field: mtmd_context_params::flash_attn_type",
][::std::mem::offset_of!(mtmd_context_params, flash_attn_type) - 40usize];
[
"Offset of field: mtmd_context_params::warmup",
][::std::mem::offset_of!(mtmd_context_params, warmup) - 44usize];
[
"Offset of field: mtmd_context_params::image_min_tokens",
][::std::mem::offset_of!(mtmd_context_params, image_min_tokens) - 48usize];
[
"Offset of field: mtmd_context_params::image_max_tokens",
][::std::mem::offset_of!(mtmd_context_params, image_max_tokens) - 52usize];
[
"Offset of field: mtmd_context_params::cb_eval",
][::std::mem::offset_of!(mtmd_context_params, cb_eval) - 56usize];
[
"Offset of field: mtmd_context_params::cb_eval_user_data",
][::std::mem::offset_of!(mtmd_context_params, cb_eval_user_data) - 64usize];
[
"Offset of field: mtmd_context_params::batch_max_tokens",
][::std::mem::offset_of!(mtmd_context_params, batch_max_tokens) - 72usize];
[
"Offset of field: mtmd_context_params::progress_callback",
][::std::mem::offset_of!(mtmd_context_params, progress_callback) - 80usize];
[
"Offset of field: mtmd_context_params::progress_callback_user_data",
][::std::mem::offset_of!(mtmd_context_params, progress_callback_user_data)
- 88usize];
};
unsafe extern "C" {
pub fn mtmd_default_marker() -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn mtmd_context_params_default() -> mtmd_context_params;
}
unsafe extern "C" {
pub fn mtmd_init_from_file(
mmproj_fname: *const ::std::os::raw::c_char,
text_model: *const llama_model,
ctx_params: mtmd_context_params,
) -> *mut mtmd_context;
}
unsafe extern "C" {
pub fn mtmd_free(ctx: *mut mtmd_context);
}
unsafe extern "C" {
pub fn mtmd_decode_use_non_causal(
ctx: *const mtmd_context,
chunk: *const mtmd_input_chunk,
) -> bool;
}
unsafe extern "C" {
pub fn mtmd_decode_use_mrope(ctx: *const mtmd_context) -> bool;
}
unsafe extern "C" {
pub fn mtmd_support_vision(ctx: *const mtmd_context) -> bool;
}
unsafe extern "C" {
pub fn mtmd_support_audio(ctx: *const mtmd_context) -> bool;
}
unsafe extern "C" {
pub fn mtmd_get_audio_sample_rate(ctx: *const mtmd_context) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn mtmd_get_marker(ctx: *const mtmd_context) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn mtmd_bitmap_init(
nx: u32,
ny: u32,
data: *const ::std::os::raw::c_uchar,
) -> *mut mtmd_bitmap;
}
unsafe extern "C" {
pub fn mtmd_bitmap_init_from_audio(
n_samples: usize,
data: *const f32,
) -> *mut mtmd_bitmap;
}
unsafe extern "C" {
pub fn mtmd_bitmap_get_nx(bitmap: *const mtmd_bitmap) -> u32;
}
unsafe extern "C" {
pub fn mtmd_bitmap_get_ny(bitmap: *const mtmd_bitmap) -> u32;
}
unsafe extern "C" {
pub fn mtmd_bitmap_get_data(
bitmap: *const mtmd_bitmap,
) -> *const ::std::os::raw::c_uchar;
}
unsafe extern "C" {
pub fn mtmd_bitmap_get_n_bytes(bitmap: *const mtmd_bitmap) -> usize;
}
unsafe extern "C" {
pub fn mtmd_bitmap_is_audio(bitmap: *const mtmd_bitmap) -> bool;
}
unsafe extern "C" {
pub fn mtmd_bitmap_free(bitmap: *mut mtmd_bitmap);
}
unsafe extern "C" {
pub fn mtmd_bitmap_get_id(
bitmap: *const mtmd_bitmap,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn mtmd_bitmap_set_id(
bitmap: *mut mtmd_bitmap,
id: *const ::std::os::raw::c_char,
);
}
unsafe extern "C" {
pub fn mtmd_bitmap_set_mergeable(bitmap: *mut mtmd_bitmap, mergeable: bool);
}
pub type mtmd_bitmap_lazy_callback = ::std::option::Option<
unsafe extern "C" fn(
chunk_idx: usize,
user_data: *mut ::std::os::raw::c_void,
out_bitmap: *mut *mut mtmd_bitmap,
out_text: *mut *mut ::std::os::raw::c_char,
) -> ::std::os::raw::c_int,
>;
unsafe extern "C" {
pub fn mtmd_bitmap_init_lazy(
ctx: *const mtmd_context,
id: *const ::std::os::raw::c_char,
user_data: *mut ::std::os::raw::c_void,
callback: mtmd_bitmap_lazy_callback,
) -> *mut mtmd_bitmap;
}
unsafe extern "C" {
pub fn mtmd_input_chunks_init() -> *mut mtmd_input_chunks;
}
unsafe extern "C" {
pub fn mtmd_input_chunks_size(chunks: *const mtmd_input_chunks) -> usize;
}
unsafe extern "C" {
pub fn mtmd_input_chunks_get(
chunks: *const mtmd_input_chunks,
idx: usize,
) -> *const mtmd_input_chunk;
}
unsafe extern "C" {
pub fn mtmd_input_chunks_free(chunks: *mut mtmd_input_chunks);
}
unsafe extern "C" {
pub fn mtmd_input_chunk_get_type(
chunk: *const mtmd_input_chunk,
) -> mtmd_input_chunk_type;
}
unsafe extern "C" {
pub fn mtmd_input_chunk_get_tokens_text(
chunk: *const mtmd_input_chunk,
n_tokens_output: *mut usize,
) -> *const llama_token;
}
unsafe extern "C" {
pub fn mtmd_input_chunk_get_tokens_image(
chunk: *const mtmd_input_chunk,
) -> *const mtmd_image_tokens;
}
unsafe extern "C" {
pub fn mtmd_input_chunk_get_n_tokens(chunk: *const mtmd_input_chunk) -> usize;
}
unsafe extern "C" {
pub fn mtmd_input_chunk_get_id(
chunk: *const mtmd_input_chunk,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn mtmd_input_chunk_get_n_pos(chunk: *const mtmd_input_chunk) -> llama_pos;
}
unsafe extern "C" {
pub fn mtmd_input_chunk_copy(
chunk: *const mtmd_input_chunk,
) -> *mut mtmd_input_chunk;
}
unsafe extern "C" {
pub fn mtmd_input_chunk_free(chunk: *mut mtmd_input_chunk);
}
unsafe extern "C" {
pub fn mtmd_input_chunk_get_placeholder(
chunk: *const mtmd_input_chunk,
) -> *mut mtmd_input_chunk;
}
unsafe extern "C" {
pub fn mtmd_input_chunk_save(
chunk: *const mtmd_input_chunk,
out_buf: *mut ::std::os::raw::c_char,
out_len: usize,
expected_out_len: *mut usize,
) -> i32;
}
unsafe extern "C" {
pub fn mtmd_input_chunk_load(
buf: *const ::std::os::raw::c_char,
len: usize,
) -> *mut mtmd_input_chunk;
}
unsafe extern "C" {
pub fn mtmd_image_tokens_get_n_tokens(
image_tokens: *const mtmd_image_tokens,
) -> usize;
}
unsafe extern "C" {
pub fn mtmd_image_tokens_get_id(
image_tokens: *const mtmd_image_tokens,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn mtmd_image_tokens_get_n_pos(
image_tokens: *const mtmd_image_tokens,
) -> llama_pos;
}
unsafe extern "C" {
pub fn mtmd_image_tokens_get_nx(image_tokens: *const mtmd_image_tokens) -> usize;
}
unsafe extern "C" {
pub fn mtmd_image_tokens_get_ny(image_tokens: *const mtmd_image_tokens) -> usize;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct mtmd_decoder_pos {
pub t: u32,
pub x: u32,
pub y: u32,
pub z: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of mtmd_decoder_pos"][::std::mem::size_of::<mtmd_decoder_pos>() - 16usize];
[
"Alignment of mtmd_decoder_pos",
][::std::mem::align_of::<mtmd_decoder_pos>() - 4usize];
[
"Offset of field: mtmd_decoder_pos::t",
][::std::mem::offset_of!(mtmd_decoder_pos, t) - 0usize];
[
"Offset of field: mtmd_decoder_pos::x",
][::std::mem::offset_of!(mtmd_decoder_pos, x) - 4usize];
[
"Offset of field: mtmd_decoder_pos::y",
][::std::mem::offset_of!(mtmd_decoder_pos, y) - 8usize];
[
"Offset of field: mtmd_decoder_pos::z",
][::std::mem::offset_of!(mtmd_decoder_pos, z) - 12usize];
};
unsafe extern "C" {
pub fn mtmd_image_tokens_get_decoder_pos(
image_tokens: *const mtmd_image_tokens,
pos_0: llama_pos,
i: usize,
) -> mtmd_decoder_pos;
}
unsafe extern "C" {
pub fn mtmd_tokenize(
ctx: *const mtmd_context,
output: *mut mtmd_input_chunks,
text: *const mtmd_input_text,
bitmaps: *const *const mtmd_bitmap,
n_bitmaps: usize,
) -> i32;
}
unsafe extern "C" {
pub fn mtmd_tokenize_from_parts(
ctx: *const mtmd_context,
output: *mut mtmd_input_chunks,
parts: *const *const mtmd_input_part,
n_parts: usize,
add_special: bool,
) -> i32;
}
unsafe extern "C" {
pub fn mtmd_encode(
ctx: *mut mtmd_context,
image_tokens: *const mtmd_image_tokens,
) -> i32;
}
unsafe extern "C" {
pub fn mtmd_encode_chunk(
ctx: *mut mtmd_context,
chunk: *const mtmd_input_chunk,
) -> i32;
}
unsafe extern "C" {
pub fn mtmd_get_output_embd(ctx: *mut mtmd_context) -> *mut f32;
}
unsafe extern "C" {
pub fn mtmd_batch_init(ctx: *mut mtmd_context) -> *mut mtmd_batch;
}
unsafe extern "C" {
pub fn mtmd_batch_free(batch: *mut mtmd_batch);
}
unsafe extern "C" {
pub fn mtmd_batch_add_chunk(
batch: *mut mtmd_batch,
chunk: *const mtmd_input_chunk,
) -> i32;
}
unsafe extern "C" {
pub fn mtmd_batch_encode(batch: *mut mtmd_batch) -> i32;
}
unsafe extern "C" {
pub fn mtmd_batch_get_output_embd(
batch: *mut mtmd_batch,
chunk: *const mtmd_input_chunk,
) -> *mut f32;
}
unsafe extern "C" {
pub fn mtmd_log_set(
log_callback: ggml_log_callback,
user_data: *mut ::std::os::raw::c_void,
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct mtmd_caps {
pub inp_vision: bool,
pub inp_audio: bool,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of mtmd_caps"][::std::mem::size_of::<mtmd_caps>() - 2usize];
["Alignment of mtmd_caps"][::std::mem::align_of::<mtmd_caps>() - 1usize];
[
"Offset of field: mtmd_caps::inp_vision",
][::std::mem::offset_of!(mtmd_caps, inp_vision) - 0usize];
[
"Offset of field: mtmd_caps::inp_audio",
][::std::mem::offset_of!(mtmd_caps, inp_audio) - 1usize];
};
unsafe extern "C" {
pub fn mtmd_get_cap_from_file(
mmproj_fname: *const ::std::os::raw::c_char,
) -> mtmd_caps;
}
pub const mtmd_gen_audio_type_MTMD_GEN_AUDIO_TYPE_NONE: mtmd_gen_audio_type = 0;
pub const mtmd_gen_audio_type_MTMD_GEN_AUDIO_TYPE_QWEN3TTS: mtmd_gen_audio_type = 1;
pub const mtmd_gen_audio_type_MTMD_GEN_AUDIO_TYPE_POCKETTTS: mtmd_gen_audio_type = 2;
pub type mtmd_gen_audio_type = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct mtmd_gen_audio_info {
pub type_: mtmd_gen_audio_type,
pub sample_rate: i32,
pub model_variant: *const ::std::os::raw::c_char,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of mtmd_gen_audio_info",
][::std::mem::size_of::<mtmd_gen_audio_info>() - 16usize];
[
"Alignment of mtmd_gen_audio_info",
][::std::mem::align_of::<mtmd_gen_audio_info>() - 8usize];
[
"Offset of field: mtmd_gen_audio_info::type_",
][::std::mem::offset_of!(mtmd_gen_audio_info, type_) - 0usize];
[
"Offset of field: mtmd_gen_audio_info::sample_rate",
][::std::mem::offset_of!(mtmd_gen_audio_info, sample_rate) - 4usize];
[
"Offset of field: mtmd_gen_audio_info::model_variant",
][::std::mem::offset_of!(mtmd_gen_audio_info, model_variant) - 8usize];
};
unsafe extern "C" {
pub fn mtmd_gen_audio_get_info(ctx: *const mtmd_context) -> mtmd_gen_audio_info;
}
pub const mtmd_gen_process_type_MTMD_GEN_PROCESS_TYPE_GEN_CODE: mtmd_gen_process_type = 0;
pub const mtmd_gen_process_type_MTMD_GEN_PROCESS_TYPE_GEN_WAV: mtmd_gen_process_type = 1;
pub type mtmd_gen_process_type = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct mtmd_gen_inp {
pub type_: mtmd_gen_process_type,
pub code0: i32,
pub embd: *mut f32,
pub top_k: i32,
pub top_p: f32,
pub seed: u32,
pub temp: f32,
pub codes: *mut i32,
pub n_codes: usize,
pub feats: *const f32,
pub n_feats: usize,
pub state_data: *const ::std::os::raw::c_char,
pub state_size: usize,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of mtmd_gen_inp"][::std::mem::size_of::<mtmd_gen_inp>() - 80usize];
["Alignment of mtmd_gen_inp"][::std::mem::align_of::<mtmd_gen_inp>() - 8usize];
[
"Offset of field: mtmd_gen_inp::type_",
][::std::mem::offset_of!(mtmd_gen_inp, type_) - 0usize];
[
"Offset of field: mtmd_gen_inp::code0",
][::std::mem::offset_of!(mtmd_gen_inp, code0) - 4usize];
[
"Offset of field: mtmd_gen_inp::embd",
][::std::mem::offset_of!(mtmd_gen_inp, embd) - 8usize];
[
"Offset of field: mtmd_gen_inp::top_k",
][::std::mem::offset_of!(mtmd_gen_inp, top_k) - 16usize];
[
"Offset of field: mtmd_gen_inp::top_p",
][::std::mem::offset_of!(mtmd_gen_inp, top_p) - 20usize];
[
"Offset of field: mtmd_gen_inp::seed",
][::std::mem::offset_of!(mtmd_gen_inp, seed) - 24usize];
[
"Offset of field: mtmd_gen_inp::temp",
][::std::mem::offset_of!(mtmd_gen_inp, temp) - 28usize];
[
"Offset of field: mtmd_gen_inp::codes",
][::std::mem::offset_of!(mtmd_gen_inp, codes) - 32usize];
[
"Offset of field: mtmd_gen_inp::n_codes",
][::std::mem::offset_of!(mtmd_gen_inp, n_codes) - 40usize];
[
"Offset of field: mtmd_gen_inp::feats",
][::std::mem::offset_of!(mtmd_gen_inp, feats) - 48usize];
[
"Offset of field: mtmd_gen_inp::n_feats",
][::std::mem::offset_of!(mtmd_gen_inp, n_feats) - 56usize];
[
"Offset of field: mtmd_gen_inp::state_data",
][::std::mem::offset_of!(mtmd_gen_inp, state_data) - 64usize];
[
"Offset of field: mtmd_gen_inp::state_size",
][::std::mem::offset_of!(mtmd_gen_inp, state_size) - 72usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct mtmd_gen_out {
pub codes: *const i32,
pub n_codes: usize,
pub feats: *const f32,
pub n_feats: usize,
pub embd: *const f32,
pub is_eos: bool,
pub audio: *const f32,
pub n_samples: usize,
pub state_data: *const ::std::os::raw::c_char,
pub state_size: usize,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of mtmd_gen_out"][::std::mem::size_of::<mtmd_gen_out>() - 80usize];
["Alignment of mtmd_gen_out"][::std::mem::align_of::<mtmd_gen_out>() - 8usize];
[
"Offset of field: mtmd_gen_out::codes",
][::std::mem::offset_of!(mtmd_gen_out, codes) - 0usize];
[
"Offset of field: mtmd_gen_out::n_codes",
][::std::mem::offset_of!(mtmd_gen_out, n_codes) - 8usize];
[
"Offset of field: mtmd_gen_out::feats",
][::std::mem::offset_of!(mtmd_gen_out, feats) - 16usize];
[
"Offset of field: mtmd_gen_out::n_feats",
][::std::mem::offset_of!(mtmd_gen_out, n_feats) - 24usize];
[
"Offset of field: mtmd_gen_out::embd",
][::std::mem::offset_of!(mtmd_gen_out, embd) - 32usize];
[
"Offset of field: mtmd_gen_out::is_eos",
][::std::mem::offset_of!(mtmd_gen_out, is_eos) - 40usize];
[
"Offset of field: mtmd_gen_out::audio",
][::std::mem::offset_of!(mtmd_gen_out, audio) - 48usize];
[
"Offset of field: mtmd_gen_out::n_samples",
][::std::mem::offset_of!(mtmd_gen_out, n_samples) - 56usize];
[
"Offset of field: mtmd_gen_out::state_data",
][::std::mem::offset_of!(mtmd_gen_out, state_data) - 64usize];
[
"Offset of field: mtmd_gen_out::state_size",
][::std::mem::offset_of!(mtmd_gen_out, state_size) - 72usize];
};
unsafe extern "C" {
pub fn mtmd_gen_inp_default(ctx: *const mtmd_context) -> mtmd_gen_inp;
}
unsafe extern "C" {
pub fn mtmd_gen_audio_process(
ctx: *mut mtmd_context,
inp: *const mtmd_gen_inp,
out: *mut mtmd_gen_out,
) -> i32;
}
unsafe extern "C" {
pub fn mtmd_test_create_input_chunks() -> *mut mtmd_input_chunks;
}
#[repr(C)]
#[derive(Debug)]
pub struct mtmd_helper_video {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct mtmd_helper_video_init_params {
pub fps_target: f32,
pub ffmpeg_bin_dir: *const ::std::os::raw::c_char,
pub timestamp_interval_ms: i64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of mtmd_helper_video_init_params",
][::std::mem::size_of::<mtmd_helper_video_init_params>() - 24usize];
[
"Alignment of mtmd_helper_video_init_params",
][::std::mem::align_of::<mtmd_helper_video_init_params>() - 8usize];
[
"Offset of field: mtmd_helper_video_init_params::fps_target",
][::std::mem::offset_of!(mtmd_helper_video_init_params, fps_target) - 0usize];
[
"Offset of field: mtmd_helper_video_init_params::ffmpeg_bin_dir",
][::std::mem::offset_of!(mtmd_helper_video_init_params, ffmpeg_bin_dir) - 8usize];
[
"Offset of field: mtmd_helper_video_init_params::timestamp_interval_ms",
][::std::mem::offset_of!(mtmd_helper_video_init_params, timestamp_interval_ms)
- 16usize];
};
unsafe extern "C" {
pub fn mtmd_helper_video_init_params_default() -> mtmd_helper_video_init_params;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct mtmd_helper_init_opt {
pub video_params: mtmd_helper_video_init_params,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of mtmd_helper_init_opt",
][::std::mem::size_of::<mtmd_helper_init_opt>() - 24usize];
[
"Alignment of mtmd_helper_init_opt",
][::std::mem::align_of::<mtmd_helper_init_opt>() - 8usize];
[
"Offset of field: mtmd_helper_init_opt::video_params",
][::std::mem::offset_of!(mtmd_helper_init_opt, video_params) - 0usize];
};
unsafe extern "C" {
pub fn mtmd_helper_init_opt_default() -> mtmd_helper_init_opt;
}
unsafe extern "C" {
pub fn mtmd_helper_log_set(
log_callback: ggml_log_callback,
user_data: *mut ::std::os::raw::c_void,
);
}
unsafe extern "C" {
pub fn mtmd_helper_support_video(ctx: *const mtmd_context) -> bool;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct mtmd_helper_bitmap_wrapper {
pub bitmap: *mut mtmd_bitmap,
pub video_ctx: *mut mtmd_helper_video,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of mtmd_helper_bitmap_wrapper",
][::std::mem::size_of::<mtmd_helper_bitmap_wrapper>() - 16usize];
[
"Alignment of mtmd_helper_bitmap_wrapper",
][::std::mem::align_of::<mtmd_helper_bitmap_wrapper>() - 8usize];
[
"Offset of field: mtmd_helper_bitmap_wrapper::bitmap",
][::std::mem::offset_of!(mtmd_helper_bitmap_wrapper, bitmap) - 0usize];
[
"Offset of field: mtmd_helper_bitmap_wrapper::video_ctx",
][::std::mem::offset_of!(mtmd_helper_bitmap_wrapper, video_ctx) - 8usize];
};
unsafe extern "C" {
pub fn mtmd_helper_bitmap_init_from_file(
ctx: *const mtmd_context,
fname: *const ::std::os::raw::c_char,
placeholder: bool,
opt: mtmd_helper_init_opt,
) -> mtmd_helper_bitmap_wrapper;
}
unsafe extern "C" {
pub fn mtmd_helper_bitmap_init_from_buf(
ctx: *const mtmd_context,
buf: *const ::std::os::raw::c_uchar,
len: usize,
placeholder: bool,
opt: mtmd_helper_init_opt,
) -> mtmd_helper_bitmap_wrapper;
}
unsafe extern "C" {
pub fn mtmd_helper_get_n_tokens(chunks: *const mtmd_input_chunks) -> usize;
}
unsafe extern "C" {
pub fn mtmd_helper_get_n_pos(chunks: *const mtmd_input_chunks) -> llama_pos;
}
unsafe extern "C" {
pub fn mtmd_helper_image_get_decoder_pos(
image: *const mtmd_image_tokens,
pos_0: llama_pos,
out_pos: *mut mtmd_decoder_pos,
);
}
unsafe extern "C" {
pub fn mtmd_helper_eval_chunks(
ctx: *mut mtmd_context,
lctx: *mut llama_context,
chunks: *const mtmd_input_chunks,
n_past: llama_pos,
seq_id: llama_seq_id,
n_batch: i32,
logits_last: bool,
new_n_past: *mut llama_pos,
) -> i32;
}
unsafe extern "C" {
pub fn mtmd_helper_eval_chunk_single(
ctx: *mut mtmd_context,
lctx: *mut llama_context,
chunk: *const mtmd_input_chunk,
n_past: llama_pos,
seq_id: llama_seq_id,
n_batch: i32,
logits_last: bool,
new_n_past: *mut llama_pos,
) -> i32;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct mtmd_helper_embd_batch {
pub n_tokens: i32,
pub embd: *const f32,
pub n_embd: i32,
pub pos: *const llama_pos,
pub n_pos: i32,
pub seq_id: llama_seq_id,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of mtmd_helper_embd_batch",
][::std::mem::size_of::<mtmd_helper_embd_batch>() - 40usize];
[
"Alignment of mtmd_helper_embd_batch",
][::std::mem::align_of::<mtmd_helper_embd_batch>() - 8usize];
[
"Offset of field: mtmd_helper_embd_batch::n_tokens",
][::std::mem::offset_of!(mtmd_helper_embd_batch, n_tokens) - 0usize];
[
"Offset of field: mtmd_helper_embd_batch::embd",
][::std::mem::offset_of!(mtmd_helper_embd_batch, embd) - 8usize];
[
"Offset of field: mtmd_helper_embd_batch::n_embd",
][::std::mem::offset_of!(mtmd_helper_embd_batch, n_embd) - 16usize];
[
"Offset of field: mtmd_helper_embd_batch::pos",
][::std::mem::offset_of!(mtmd_helper_embd_batch, pos) - 24usize];
[
"Offset of field: mtmd_helper_embd_batch::n_pos",
][::std::mem::offset_of!(mtmd_helper_embd_batch, n_pos) - 32usize];
[
"Offset of field: mtmd_helper_embd_batch::seq_id",
][::std::mem::offset_of!(mtmd_helper_embd_batch, seq_id) - 36usize];
};
pub type mtmd_helper_post_decode_callback = ::std::option::Option<
unsafe extern "C" fn(
batch: *const mtmd_helper_embd_batch,
user_data: *mut ::std::os::raw::c_void,
) -> i32,
>;
unsafe extern "C" {
pub fn mtmd_helper_decode_image_chunk(
ctx: *mut mtmd_context,
lctx: *mut llama_context,
chunk: *const mtmd_input_chunk,
encoded_embd: *mut f32,
n_past: llama_pos,
seq_id: llama_seq_id,
n_batch: i32,
new_n_past: *mut llama_pos,
callback: mtmd_helper_post_decode_callback,
user_data: *mut ::std::os::raw::c_void,
) -> i32;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct mtmd_helper_video_info {
pub width: u32,
pub height: u32,
pub fps: f32,
pub n_frames: i32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of mtmd_helper_video_info",
][::std::mem::size_of::<mtmd_helper_video_info>() - 16usize];
[
"Alignment of mtmd_helper_video_info",
][::std::mem::align_of::<mtmd_helper_video_info>() - 4usize];
[
"Offset of field: mtmd_helper_video_info::width",
][::std::mem::offset_of!(mtmd_helper_video_info, width) - 0usize];
[
"Offset of field: mtmd_helper_video_info::height",
][::std::mem::offset_of!(mtmd_helper_video_info, height) - 4usize];
[
"Offset of field: mtmd_helper_video_info::fps",
][::std::mem::offset_of!(mtmd_helper_video_info, fps) - 8usize];
[
"Offset of field: mtmd_helper_video_info::n_frames",
][::std::mem::offset_of!(mtmd_helper_video_info, n_frames) - 12usize];
};
unsafe extern "C" {
pub fn mtmd_helper_video_init(
mctx: *const mtmd_context,
path: *const ::std::os::raw::c_char,
params: mtmd_helper_video_init_params,
) -> *mut mtmd_helper_video;
}
unsafe extern "C" {
pub fn mtmd_helper_video_init_from_buf(
mctx: *const mtmd_context,
buf: *const ::std::os::raw::c_uchar,
len: usize,
params: mtmd_helper_video_init_params,
) -> *mut mtmd_helper_video;
}
unsafe extern "C" {
pub fn mtmd_helper_video_free(ctx: *mut mtmd_helper_video);
}
unsafe extern "C" {
pub fn mtmd_helper_video_get_info(
ctx: *const mtmd_helper_video,
) -> mtmd_helper_video_info;
}
unsafe extern "C" {
pub fn mtmd_helper_video_read_next(
ctx: *mut mtmd_helper_video,
out_bitmap: *mut *mut mtmd_bitmap,
out_text: *mut *mut ::std::os::raw::c_char,
) -> i32;
}
unsafe extern "C" {
pub fn mtmd_helper_model_can_chat(
lctx: *const llama_context,
mctx: *const mtmd_context,
) -> bool;
}
#[repr(C)]
#[derive(Debug)]
pub struct mtmd_helper_gen_audio {
_unused: [u8; 0],
}
pub const mtmd_helper_gen_audio_outtype_MTMD_HELPER_GEN_AUDIO_OUTTYPE_PCM: mtmd_helper_gen_audio_outtype = 0;
pub const mtmd_helper_gen_audio_outtype_MTMD_HELPER_GEN_AUDIO_OUTTYPE_WAV: mtmd_helper_gen_audio_outtype = 1;
pub type mtmd_helper_gen_audio_outtype = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct mtmd_helper_gen_audio_inp {
pub seq_id: llama_seq_id,
pub prompt: *const ::std::os::raw::c_char,
pub prompt_len: usize,
pub speaker_ref: *mut mtmd_bitmap,
pub lang: *const ::std::os::raw::c_char,
pub top_k: i32,
pub top_p: f32,
pub seed: u32,
pub out_type: mtmd_helper_gen_audio_outtype,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of mtmd_helper_gen_audio_inp",
][::std::mem::size_of::<mtmd_helper_gen_audio_inp>() - 56usize];
[
"Alignment of mtmd_helper_gen_audio_inp",
][::std::mem::align_of::<mtmd_helper_gen_audio_inp>() - 8usize];
[
"Offset of field: mtmd_helper_gen_audio_inp::seq_id",
][::std::mem::offset_of!(mtmd_helper_gen_audio_inp, seq_id) - 0usize];
[
"Offset of field: mtmd_helper_gen_audio_inp::prompt",
][::std::mem::offset_of!(mtmd_helper_gen_audio_inp, prompt) - 8usize];
[
"Offset of field: mtmd_helper_gen_audio_inp::prompt_len",
][::std::mem::offset_of!(mtmd_helper_gen_audio_inp, prompt_len) - 16usize];
[
"Offset of field: mtmd_helper_gen_audio_inp::speaker_ref",
][::std::mem::offset_of!(mtmd_helper_gen_audio_inp, speaker_ref) - 24usize];
[
"Offset of field: mtmd_helper_gen_audio_inp::lang",
][::std::mem::offset_of!(mtmd_helper_gen_audio_inp, lang) - 32usize];
[
"Offset of field: mtmd_helper_gen_audio_inp::top_k",
][::std::mem::offset_of!(mtmd_helper_gen_audio_inp, top_k) - 40usize];
[
"Offset of field: mtmd_helper_gen_audio_inp::top_p",
][::std::mem::offset_of!(mtmd_helper_gen_audio_inp, top_p) - 44usize];
[
"Offset of field: mtmd_helper_gen_audio_inp::seed",
][::std::mem::offset_of!(mtmd_helper_gen_audio_inp, seed) - 48usize];
[
"Offset of field: mtmd_helper_gen_audio_inp::out_type",
][::std::mem::offset_of!(mtmd_helper_gen_audio_inp, out_type) - 52usize];
};
unsafe extern "C" {
pub fn mtmd_helper_gen_audio_init(
lctx: *mut llama_context,
mctx: *mut mtmd_context,
) -> *mut mtmd_helper_gen_audio;
}
unsafe extern "C" {
pub fn mtmd_helper_gen_audio_free(ctx: *mut mtmd_helper_gen_audio);
}
unsafe extern "C" {
pub fn mtmd_helper_gen_audio_reset(ctx: *mut mtmd_helper_gen_audio);
}
unsafe extern "C" {
pub fn mtmd_helper_gen_audio_set_input(
ctx: *mut mtmd_helper_gen_audio,
inp: *const mtmd_helper_gen_audio_inp,
) -> i32;
}
unsafe extern "C" {
pub fn mtmd_helper_gen_audio_step_prompt(
ctx: *mut mtmd_helper_gen_audio,
n_batch: i32,
) -> i32;
}
unsafe extern "C" {
pub fn mtmd_helper_gen_audio_step_gen(
ctx: *mut mtmd_helper_gen_audio,
sampled: llama_token,
h_state_in: *const f32,
h_state_out: *mut *const f32,
out_stop: *mut bool,
) -> i32;
}
unsafe extern "C" {
pub fn mtmd_helper_gen_audio_get_output(
ctx: *mut mtmd_helper_gen_audio,
out_sample_rate: *mut i32,
out_data: *mut *const ::std::os::raw::c_char,
out_data_len: *mut usize,
out_n_samples: *mut i64,
) -> i32;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ggml_backend_buffer {
pub _address: u8,
}