Tokenizers documentation

Encode Inputs

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

Encode Inputs

Not supported by the rc0 bindings yet. rc0 loads a tokenizer.json and encodes and decodes with it — building a tokenizer from its components, editing one, saving one and training are not exposed. They are coming soon, along with the other bindings. See REQUIRED_FOR_V1.md for the full list.

Python
Rust
Node

These types represent all the different kinds of input that a Tokenizer accepts when using encode_batch().

TextEncodeInput[[[ tokenizers.TextEncodeInput ]]]

tokenizers.TextEncodeInput

Represents a textual input for encoding. Can be either:

alias of Union[str, Tuple[str, str], List[str]].

PreTokenizedEncodeInput[[[ tokenizers.PreTokenizedEncodeInput ]]]

tokenizers.PreTokenizedEncodeInput

Represents a pre-tokenized input for encoding. Can be either:

alias of Union[List[str], Tuple[str], Tuple[Union[List[str], Tuple[str]], Union[List[str], Tuple[str]]], List[Union[List[str], Tuple[str]]]].

EncodeInput[[[ tokenizers.EncodeInput ]]]

tokenizers.EncodeInput

Represents all the possible types of input for encoding. Can be:

alias of Union[str, Tuple[str, str], List[str], Tuple[str], Tuple[Union[List[str], Tuple[str]], Union[List[str], Tuple[str]]], List[Union[List[str], Tuple[str]]]].

Update on GitHub