Skip to main content

Module tokenizer

Module tokenizer 

Source
Expand description

Byte-level BPE tokenizer — HF tokenizer.json parity.

Faithful pipeline (matches tokenizers for Qwen-style files): added-token split (raw text) → NFC → pre-tokenizer regex (GPT-2 style, needs lookahead) → byte-level mapping → ranked BPE merges → vocab ids. Decode reverses through the byte-level map, assembling UTF-8 across token boundaries.

No silent corruption: a symbol that cannot be encoded is reported (tracing::error), never dropped without a trace.

Structs§

Tokenizer
A loaded BPE tokenizer.

Enums§

TokenizerError

Constants§

TOOL_MARKUP_TOKENS
Tool-call grammar tokens that decode as TEXT even when the vocabulary marks them special.

Functions§

template_reads_reasoning_effort
Whether a chat template consumes a reasoning_effort variable (Minico-M1’s off/low/medium/high/max dial, GLM-5, gpt-oss): only such templates are handed a caller’s effort, verbatim, by run --reasoning-effort and the server’s reasoning_effort field.