nemo_automodel.components.models.common.decision_reader
nemo_automodel.components.models.common.decision_reader
Model-owned reads for decision post-training.
The decision recipe reads every question of a SystemOne record on its own. A DecisionReader owns the two
model-specific steps of a read: encoding one question as model input, and returning that question’s option logits.
DecisionReaderConfig is the YAML reader: block; the recipe calls prepare before it loads the model and
build after.
Module Contents
Classes
Data
API
One question encoded for a model.
Option IDs in the order of the model’s logits.
Key of the question in its record.
Bases: Generic[ReadT]
Encodes questions for one model and scores them (see the module docstring).
Longest read the checkpoint accepts.
Encode one question of a validated SystemOne record.
Parameters:
Validated SystemOne record that holds the question.
Key of the question in record["questions"].
Option-shuffle seed, or None for the model’s own option order.
Returns: ReadT | None
The read, or None when this model cannot read the question; the recipe counts those as skipped.
Model-specific stage fields; the recipe refuses to load a stage whose identity differs.
Score one read.
Parameters:
A read returned by encode.
Returns: torch.Tensor
fp32 tensor of shape [options] in read.labels order.
Bases: Generic[ReadT]
YAML reader: block of the decision recipe.
Model-specific part of build (same arguments).
Check the checkpoint contract, set the trainable parameters, and return the reader.
Parameters:
The model as the recipe runs it (DDP or FSDP2); reads run their forward through it.
Tokenizer of the checkpoint.
Checkpoint directory or Hub ID.
Checkpoint revision, or None.
Longest read to accept (data.max_tokens).
Whether a PEFT adapter is configured.
Device of the reads.
Returns: DecisionReader[ReadT]
The reader.
Raises:
ValueError: Ifmax_tokensexceeds the checkpoint’s read limit, or the checkpoint or configuration is outside the reader’s contract.
Run the checks and setup that must happen before the model is loaded.
Parameters:
Checkpoint directory or Hub ID.
Checkpoint revision, or None.