Skip to content
class

RoFormerTokenizerFast

extendsWordPieceTokenizerFast
RoFormerTokenizerFast(vocab: dict[str, int], unk_token: str = '[UNK]', continuing_prefix: str = '##', max_chars_per_word: int = 100, do_lower_case: bool = True, normalizer: Normalizer | None = None, pre_tokenizer: PreTokenizer | None = None, special_tokens: SpecialTokens | None = None)

RoFormer tokenizer — C++-backed.

Bit-identical to RoFormerTokenizer. The greedy longest-match loop runs in C++ via the engine-side WordPiece binding.

Constructor parameters mirror RoFormerTokenizer — see that class for the full reference.

Examples

>>> from lucid.models.text.roformer._tokenizer import (
...     RoFormerTokenizerFast,
... )
>>> vocab = {"[UNK]": 0, "he": 1, "##llo": 2}
>>> tok = RoFormerTokenizerFast(vocab=vocab)
>>> tok.encode("hello")
[1, 2]

Used by 1

Constructors

1
dunder

__init__

→None
__init__(vocab: dict[str, int], unk_token: str = '[UNK]', continuing_prefix: str = '##', max_chars_per_word: int = 100, do_lower_case: bool = True, normalizer: Normalizer | None = None, pre_tokenizer: PreTokenizer | None = None, special_tokens: SpecialTokens | None = None)