Skip to navigation

nemo_automodel.components.models.nemotron_decision.reader

View as MarkdownOpen in Claude

Nemotron 3.5 Decision reads: the checkpoint’s serving prompt, one question per read, the frozen head at the mask.

Module Contents

Classes

NameDescription
NemotronDecisionReaderReads questions through a Nemotron 3.5 Decision checkpoint’s own decision contract.
NemotronDecisionReaderConfigRead Nemotron 3.5 Decision checkpoints; the recipe’s default reader.

Data

STAGE_FORMAT

API

class nemo_automodel.components.models.nemotron_decision.reader.NemotronDecisionReader(
model: torch.nn.Module,
tokenizer: transformers.PreTrainedTokenizerBase,
mask_token_id: int,
token_ids: tuple[int, ...],
head_rows: torch.Tensor,
max_tokens: int,
max_input_tokens: int,
device: torch.device
)

Bases: DecisionReader[PreparedQuestion]

Reads questions through a Nemotron 3.5 Decision checkpoint’s own decision contract.

head_rows
nemo_automodel.components.models.nemotron_decision.reader.NemotronDecisionReader.encode(
record: dict[str, typing.Any],
question_id: str,
shuffle_seed: int | None = None

Encode one question as its serving prompt (see DecisionReader.encode).

nemo_automodel.components.models.nemotron_decision.reader.NemotronDecisionReader.identity() -> dict[str, typing.Any]

Stage fields that pin the readout contract (unchanged from the recipe’s original identity).

nemo_automodel.components.models.nemotron_decision.reader.NemotronDecisionReader.logits(
) -> torch.Tensor

Option logits at the mask, fp32 tensor of shape [options] in prompt order.

class nemo_automodel.components.models.nemotron_decision.reader.NemotronDecisionReaderConfig()
Dataclass

Bases: DecisionReaderConfig[PreparedQuestion]

Read Nemotron 3.5 Decision checkpoints; the recipe’s default reader.

model: torch.nn.Module,
tokenizer: transformers.PreTrainedTokenizerBase,
model_path: str,
revision: str | None,
max_tokens: int,
peft: bool,
device: torch.device

Check the loaded checkpoint, freeze everything but the trained scope, and gather the head rows.

nemo_automodel.components.models.nemotron_decision.reader.NemotronDecisionReaderConfig.prepare(
model_path: str,
revision: str | None
) -> None

Reject a checkpoint this reader cannot train, before its weights load.

Rejects an unsupported architecture, a checkpoint without a decision contract, and a contract whose readout token is not the model config’s mask token.

nemo_automodel.components.models.nemotron_decision.reader.STAGE_FORMAT = 'nemotron-decision-stage-v1'