pub struct ConfigurableAsyncTokenizer<T> { /* private fields */ }Expand description
Advanced async tokenizer with configurable behavior
Implementations§
Source§impl<T> ConfigurableAsyncTokenizer<T>
impl<T> ConfigurableAsyncTokenizer<T>
Sourcepub fn new(tokenizer: T, config: AsyncTokenizerConfig) -> Self
pub fn new(tokenizer: T, config: AsyncTokenizerConfig) -> Self
Create a new configurable async tokenizer
Sourcepub fn update_config(&mut self, config: AsyncTokenizerConfig)
pub fn update_config(&mut self, config: AsyncTokenizerConfig)
Update configuration
Sourcepub fn config(&self) -> &AsyncTokenizerConfig
pub fn config(&self) -> &AsyncTokenizerConfig
Get current configuration
Sourcepub async fn encode_large_batch_with_progress<F>(
&self,
texts: &[&str],
progress_callback: F,
) -> Result<Vec<TokenizedInput>>
pub async fn encode_large_batch_with_progress<F>( &self, texts: &[&str], progress_callback: F, ) -> Result<Vec<TokenizedInput>>
Process a large batch with progress reporting
Trait Implementations§
Source§impl<T> AsyncTokenizer for ConfigurableAsyncTokenizer<T>
impl<T> AsyncTokenizer for ConfigurableAsyncTokenizer<T>
Source§fn encode_async<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<TokenizedInput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn encode_async<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<TokenizedInput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Asynchronously encode a single text
Source§fn encode_pair_async<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
text2: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<TokenizedInput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn encode_pair_async<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
text2: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<TokenizedInput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Asynchronously encode text pairs
Source§fn decode_async<'life0, 'life1, 'async_trait>(
&'life0 self,
ids: &'life1 [u32],
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn decode_async<'life0, 'life1, 'async_trait>(
&'life0 self,
ids: &'life1 [u32],
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Asynchronously decode token IDs to text
Source§fn encode_batch_async<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = Result<Vec<TokenizedInput>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn encode_batch_async<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = Result<Vec<TokenizedInput>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Asynchronously encode multiple texts in parallel
Source§fn encode_pair_batch_async<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
text_pairs: &'life1 [(&'life2 str, &'life3 str)],
) -> Pin<Box<dyn Future<Output = Result<Vec<TokenizedInput>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn encode_pair_batch_async<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
text_pairs: &'life1 [(&'life2 str, &'life3 str)],
) -> Pin<Box<dyn Future<Output = Result<Vec<TokenizedInput>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Asynchronously encode text pairs in parallel
Auto Trait Implementations§
impl<T> Freeze for ConfigurableAsyncTokenizer<T>
impl<T> !RefUnwindSafe for ConfigurableAsyncTokenizer<T>
impl<T> Send for ConfigurableAsyncTokenizer<T>
impl<T> Sync for ConfigurableAsyncTokenizer<T>
impl<T> Unpin for ConfigurableAsyncTokenizer<T>
impl<T> UnsafeUnpin for ConfigurableAsyncTokenizer<T>
impl<T> !UnwindSafe for ConfigurableAsyncTokenizer<T>
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