pub struct EncodedInput {
pub texts: Vec<String>,
pub tokens: Vec<Vec<Token>>,
pub entities: Vec<String>,
pub num_words: usize,
pub num_tokens: usize,
pub input_ids: Array2<i64>,
pub attention_masks: Array2<i64>,
pub word_masks: Array2<i64>,
pub text_lengths: Array2<i64>,
}Expand description
Represents encoded prompts (after sub-word tokenization)
Fields§
§texts: Vec<String>§tokens: Vec<Vec<Token>>§entities: Vec<String>§num_words: usize§num_tokens: usize§input_ids: Array2<i64>§attention_masks: Array2<i64>§word_masks: Array2<i64>§text_lengths: Array2<i64>Implementations§
Source§impl EncodedInput
impl EncodedInput
pub fn from(input: PromptInput, tokenizer: &impl Tokenizer) -> Result<Self>
Trait Implementations§
Source§impl<'a> Composable<EncodedInput, SpanTensors<'a>> for EncodedToTensors
impl<'a> Composable<EncodedInput, SpanTensors<'a>> for EncodedToTensors
fn apply(&self, input: EncodedInput) -> Result<SpanTensors<'a>>
fn compose<T, P>(self, other: T) -> impl Composable<I, P>where
Self: Sized,
T: Composable<O, P>,
Source§impl<'a> Composable<EncodedInput, TokenTensors<'a>> for EncodedToTensors
impl<'a> Composable<EncodedInput, TokenTensors<'a>> for EncodedToTensors
fn apply(&self, input: EncodedInput) -> Result<TokenTensors<'a>>
fn compose<T, P>(self, other: T) -> impl Composable<I, P>where
Self: Sized,
T: Composable<O, P>,
Source§impl<T: Tokenizer> Composable<PromptInput, EncodedInput> for PromptsToEncoded<'_, T>
impl<T: Tokenizer> Composable<PromptInput, EncodedInput> for PromptsToEncoded<'_, T>
fn apply(&self, input: PromptInput) -> Result<EncodedInput>
fn compose<T, P>(self, other: T) -> impl Composable<I, P>where
Self: Sized,
T: Composable<O, P>,
Auto Trait Implementations§
impl Freeze for EncodedInput
impl RefUnwindSafe for EncodedInput
impl Send for EncodedInput
impl Sync for EncodedInput
impl Unpin for EncodedInput
impl UnwindSafe for EncodedInput
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> 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