nemo_automodel.components.models.ergo.tokenization
nemo_automodel.components.models.ergo.tokenization
SentencePiece and token-level chat formatting for Ergo.
The chat protocol implemented here (speaker labels, the default system prompt, the CONTROL token boundaries,
tool definitions and tool calls) is the one of the chat template published with the weights:
Amazon-FMR/Ergo-bf16 at revision f47e685ec4b5095a0880e05cc514a4026859f9ed,
https://huggingface.co/Amazon-FMR/Ergo-bf16/tree/f47e685ec4b5095a0880e05cc514a4026859f9ed
Original files: chat_template.jinja (the protocol) and tokenizer.model (the SentencePiece model this
tokenizer loads), under the Amazon Ergo Open-Weights License (LICENSE.md of that repository).
CONTROL boundaries are inserted by ID; encoding literal message text never creates these boundaries.
Module Contents
Classes
Functions
Data
API
Bases: PreTrainedTokenizer
HF tokenizer using explicit CONTROL IDs and exact assistant token masks.
Return the unmodified SentencePiece vocabulary size.
Serialize chats by ID, preserving assistant masks through padding.
Text rendering cannot represent this CONTROL protocol: tokenize=False is rejected so callers cannot accidentally train on literal delimiters. The shared SFT formatter consumes the IDs and owns the next-token shift.
Add the begin and end tokens to plain text only as the tokenizer settings say.
Parameters:
Token IDs of the text, of any length.
Optional token IDs of a second text, appended to the first.
Returns: list[int]
The IDs of both texts, with bos_token_id in front when add_bos_token is set and
Decode ordinary SentencePiece pieces.
Return SentencePiece’s vocabulary plus any explicitly added tokens.
Save the exact SentencePiece binary for lossless tokenizer reload.
Encode ordinary text without HF’s special-token string matching.