Skip to main content

tokenize

Function tokenize 

Source
pub fn tokenize<T: AsRef<str> + Sync>(texts: &[T]) -> Vec<Vec<u32>>
Expand description

Tokenize texts using bpe-openai o200k_base encoding.

Automatically parallelizes for large workloads (>= 1,000 texts or >= 1MB bytes).

§Arguments

  • texts - Input documents

§Returns

Vector of token ID sequences, one per input text