pub enum ModelInputs {
Text {
input_ids: Tensor,
attention_mask: Option<Tensor>,
position_ids: Option<Tensor>,
},
Image {
pixel_values: Tensor,
image_mask: Option<Tensor>,
},
Multimodal {
input_ids: Tensor,
pixel_values: Option<Tensor>,
attention_mask: Option<Tensor>,
image_mask: Option<Tensor>,
},
Audio {
input_features: Tensor,
attention_mask: Option<Tensor>,
},
}Expand description
Unified model inputs - supports all model types
Variants§
Text
Text-only inputs (most language models)
Image
Image-only inputs (vision models)
Multimodal
Multimodal inputs (vision-language models)
Fields
Audio
Audio inputs (speech models)
Implementations§
Source§impl ModelInputs
Utility functions for model inputs/outputs
impl ModelInputs
Utility functions for model inputs/outputs
Sourcepub fn text_with_mask(input_ids: Tensor, attention_mask: Tensor) -> Self
pub fn text_with_mask(input_ids: Tensor, attention_mask: Tensor) -> Self
Create text inputs with attention mask
Sourcepub fn multimodal(input_ids: Tensor, pixel_values: Option<Tensor>) -> Self
pub fn multimodal(input_ids: Tensor, pixel_values: Option<Tensor>) -> Self
Create multimodal inputs
Sourcepub fn batch_size(&self) -> usize
pub fn batch_size(&self) -> usize
Get batch size
Sourcepub fn sequence_length(&self) -> Option<usize>
pub fn sequence_length(&self) -> Option<usize>
Get sequence length (for text inputs)
Trait Implementations§
Source§impl Clone for ModelInputs
impl Clone for ModelInputs
Source§fn clone(&self) -> ModelInputs
fn clone(&self) -> ModelInputs
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ModelInputs
impl !UnwindSafe for ModelInputs
impl Freeze for ModelInputs
impl Send for ModelInputs
impl Sync for ModelInputs
impl Unpin for ModelInputs
impl UnsafeUnpin for ModelInputs
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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