pub struct MtmdInputChunk {
pub chunk: NonNull<mtmd_input_chunk>,
pub owned: bool,
}Fields§
§chunk: NonNull<mtmd_input_chunk>§owned: boolImplementations§
Source§impl MtmdInputChunk
impl MtmdInputChunk
Sourcepub fn chunk_type(&self) -> Result<MtmdInputChunkType, MtmdInputChunkTypeError>
pub fn chunk_type(&self) -> Result<MtmdInputChunkType, MtmdInputChunkTypeError>
§Errors
Returns an error if the chunk type is unknown.
pub fn text_tokens(&self) -> Option<&[LlamaToken]>
pub fn n_tokens(&self) -> usize
pub fn n_positions(&self) -> i32
pub fn id(&self) -> Option<String>
Sourcepub fn copy(&self) -> Result<Self, MtmdInputChunkError>
pub fn copy(&self) -> Result<Self, MtmdInputChunkError>
§Errors
Returns MtmdInputChunkError::ChunkOperationFailed if copying fails.
Sourcepub fn eval_single(
&self,
mtmd_ctx: &MtmdContext,
llama_ctx: &LlamaContext<'_>,
start_position: llama_pos,
seq_id: llama_seq_id,
n_batch: i32,
logits_last: bool,
) -> Result<llama_pos, MtmdEvalError>
pub fn eval_single( &self, mtmd_ctx: &MtmdContext, llama_ctx: &LlamaContext<'_>, start_position: llama_pos, seq_id: llama_seq_id, n_batch: i32, logits_last: bool, ) -> Result<llama_pos, MtmdEvalError>
§Errors
Returns MtmdEvalError::ImageChunkExceedsBatchSize when this is an
image chunk whose token count exceeds n_batch. Returns
[MtmdEvalError::EvalFailure] if the underlying encode or decode step
fails.
Trait Implementations§
Source§impl Debug for MtmdInputChunk
impl Debug for MtmdInputChunk
Source§impl Drop for MtmdInputChunk
impl Drop for MtmdInputChunk
Auto Trait Implementations§
impl Freeze for MtmdInputChunk
impl RefUnwindSafe for MtmdInputChunk
impl !Send for MtmdInputChunk
impl !Sync for MtmdInputChunk
impl Unpin for MtmdInputChunk
impl UnsafeUnpin for MtmdInputChunk
impl UnwindSafe for MtmdInputChunk
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more