pub struct BatchTokenizer<T: Tokenizer + Sync> { /* private fields */ }Expand description
Batch tokenization with padding and truncation support
Implementations§
Source§impl<T: Tokenizer + Sync> BatchTokenizer<T>
impl<T: Tokenizer + Sync> BatchTokenizer<T>
Sourcepub fn with_max_length(self, max_length: usize) -> Self
pub fn with_max_length(self, max_length: usize) -> Self
Set the maximum sequence length
Sourcepub fn with_padding(self, pad_token_id: u32) -> Self
pub fn with_padding(self, pad_token_id: u32) -> Self
Enable padding to max length
Sourcepub fn with_truncation(self) -> Self
pub fn with_truncation(self) -> Self
Enable truncation to max length
Sourcepub fn encode_batch_padded(
&self,
texts: &[&str],
) -> Result<BatchedTokenizedInput>
pub fn encode_batch_padded( &self, texts: &[&str], ) -> Result<BatchedTokenizedInput>
Encode a batch with padding and truncation
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for BatchTokenizer<T>
impl<T> RefUnwindSafe for BatchTokenizer<T>where
T: RefUnwindSafe,
impl<T> Send for BatchTokenizer<T>
impl<T> Sync for BatchTokenizer<T>
impl<T> Unpin for BatchTokenizer<T>
impl<T> UnsafeUnpin for BatchTokenizer<T>
impl<T> UnwindSafe for BatchTokenizer<T>where
T: RefUnwindSafe,
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,
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