nemo_rl.models.generation.prefix_recovery.progress#

The backend-specific seam: reading how far each live call has decoded.

Module Contents#

Classes#

GenerationProgress

One call’s generated tokens past a cut’s start, read at an output boundary.

ProgressRead

Progress per model call ID, and how long the read held the engine up.

ProgressReader

Reads every named call’s new tokens at one engine output boundary.

API#

class nemo_rl.models.generation.prefix_recovery.progress.GenerationProgress#

One call’s generated tokens past a cut’s start, read at an output boundary.

logprobs is the engine’s own append-only container; positions up to start + len(token_ids) were published when the tokens were copied.

token_ids: list[int]#

None

logprobs: Any#

None

finish_reason: str | None#

None

stop_reason: str | int | None#

None

route_pieces: list[Any] | None#

None

class nemo_rl.models.generation.prefix_recovery.progress.ProgressRead#

Progress per model call ID, and how long the read held the engine up.

A call the engine does not hold (not yet submitted, aborted, or not a single engine request) is missing from progress.

progress: collections.abc.Mapping[str, nemo_rl.models.generation.prefix_recovery.progress.GenerationProgress]#

None

wait_seconds: float#

None

hold_seconds: float#

None

class nemo_rl.models.generation.prefix_recovery.progress.ProgressReader#

Bases: typing.Protocol

Reads every named call’s new tokens at one engine output boundary.

read(
calls: collections.abc.Sequence[tuple[str, int]],
*,
timeout_s: float | None,
route_calls: frozenset[str] = frozenset(),
) → nemo_rl.models.generation.prefix_recovery.progress.ProgressRead#

Read (model_call_id, start) calls; raise TimeoutError past timeout_s.

Calls named in route_calls also get their route pieces copied.

logprobs(
token_ids: collections.abc.Sequence[int],
logprobs: Any,
*,
start: int,
) → list[float]#

The sampled log probability of each token, from the engine’s container.

Raises RuntimeError, TypeError or ValueError when they do not line up.