nemo_gym.token_id_capture.consumer
nemo_gym.token_id_capture.consumer
Turn a rollout’s frozen token capture into trajectories.
Gym rollout collection and trainer finalization use this consumer.
Gym reads a frozen snapshot from the local token store.
A trainer freezes the TokenSource provided by its transport.
Both paths pass snapshot entries through the same build and projection.
Single-response delivery rejects per_request because it can return multiple trajectories.
This module does not import rollout-record or model-server modules.
The caller supplies the rollout_id.
Gym derives that ID from task, rollout, and attempt indices.
The result includes metrics that describe the build.
Module Contents
Functions
Data
API
Remove stale token records for rollouts about to be dispatched.
Rollout IDs are deterministic.
TokenCaptureStore.append uses append mode.
A reused ID would append records to a previous attempt.
The builder could then combine two attempts.
The caller passes only rows ready for dispatch.
Retry suffixes must already be assigned.
Return the enabled token store directory or an empty list.
Build trajectories from a frozen local token-store snapshot.
Return None only when no capture directory is configured.
Missing records are unsafe and return a masked result.
An incomplete snapshot is unsafe and returns a masked result.
Build trajectories from a frozen TokenSource snapshot.
Missing records are unsafe and return a masked result. An incomplete snapshot is unsafe and returns a masked result.