Skip to navigation

nemo_gym.models.token_capture

View as Markdown

Provide the core training-token capture interfaces.

Training capture is separate from evaluation capture. Middleware sets a request-scoped token sink. The model server records a TokenEntry from its complete response. Consumers call TokenSource.freeze for an atomic snapshot. The snapshot includes entries and incomplete state. Its snapshot_id identifies the exact frozen state. TokenCaptureStore is Gym’s local sink and source implementation. Framework transports may provide their own sink and source. finalize_rollout_token_capture rebuilds one rollout record from its frozen snapshot. The incomplete state prevents training on a rollout that lost a model call. Finalization freezes and rebuilds the rollout. Finalization does not retire the snapshot. The caller retires it only after durable handoff. Retirement uses the frozen snapshot_id and version. Failed or masked builds retain their capture evidence.

This package is token capture’s public API. Code outside nemo_gym/ imports token capture names from nemo_gym.models.token_capture, not from nemo_gym.models. Every name it serves imports without Gym’s server stack or an OpenAI client, because frameworks implement its protocols. Framework token staging has a public API of its own, nemo_gym.models.token_capture.staging.

Subpackages

Submodules

Package Contents

Data

_PUBLIC_API

API

nemo_gym.models.token_capture._PUBLIC_API = {'CAPTURE_REFUSAL_HEADER': 'protocols', 'CONTEXT_LENGTH_EXCEEDED_ERROR_CODE': 'r...