nemo_gym.atif_export

View as Markdown

Strict offline conversion from Gym rollout trajectories to ATIF v1.7.

Module Contents

Classes

NameDescription
AtifExportErrorA rollout cannot be represented by Gym’s supported ATIF profile.
AtifExportResult-
ExportAtifConfigConfiguration for gym eval export --format atif.
_AgentGroup-
_ModelCallIndex-

Functions

NameDescription
_apply_turns-
_build_groups-
_canonical_conversation_copyValidate a redundant turn copy and compare its normalized supported fields.
_encoded_trajectory-
_final_metrics-
_index-
_json_value-
_message_content-
_model_call_index-
_parse_arguments-
_path_error-
_preflight_conversationReject raw fields that supported Pydantic variants would silently erase.
_preflight_model_call_refs-
_preflight_model_ref-
_preflight_parts-
_preflight_raw_trajectory-
_preflight_training_metadata-
_reasoning_text-
_reject_unknown_fields-
_resolve_model_call-
_source_item_idsReturn provider item identities that ATIF has no standard fields for.
_text_content-
_tool_record_extra-
_validate_json_valueReject Python values that cannot round-trip through UTF-8 JSON unchanged.
export_rollouts_to_atifValidate a rollout JSONL completely, then atomically publish ATIF files and a manifest.
gym_rollout_to_atifConvert one rollout row, rejecting any structure Gym cannot represent completely.

Data

_CONVERSATION_ADAPTER

_KNOWN_INCOMPLETE_FINISH_REASONS

_TRAINING_METADATA_FIELDS

API

class nemo_gym.atif_export.AtifExportError()

Bases: ConfigError

A rollout cannot be represented by Gym’s supported ATIF profile.

class nemo_gym.atif_export.AtifExportResult(
output_dirpath: pathlib.Path,
trajectory_count: int,
manifest_fpath: pathlib.Path
)
Dataclass
manifest_fpath
Path
output_dirpath
Path
trajectory_count
int
class nemo_gym.atif_export.ExportAtifConfig()

Bases: BaseNeMoGymCLIConfig

Configuration for gym eval export --format atif.

agent_version
str = Field(min_length=1)
format
Literal['atif'] = 'atif'
output_dirpath
Path
rollouts_jsonl_fpath
Path
session_id
str = Field(min_length=1)
nemo_gym.atif_export.ExportAtifConfig.reject_blank_identity(
value: str
) -> str
classmethod
class nemo_gym.atif_export._AgentGroup(
question: list[typing.Any],
reasoning: list[typing.Any],
answer: list[typing.Any],
)
Dataclass
answer
list[Any]
question
list[Any]
reasoning
list[Any]
step
AtifStep
class nemo_gym.atif_export._ModelCallIndex(
by_id: dict[str, list[int]],
by_response: dict[tuple[str, str, str], list[int]]
)
Dataclass
by_id
dict[str, list[int]]
by_response
dict[tuple[str, str, str], list[int]]
calls
list[TrajectoryModelCall]
nemo_gym.atif_export._apply_turns(
) -> set[int]
nemo_gym.atif_export._build_groups(
invocation: typing.Any
nemo_gym.atif_export._canonical_conversation_copy(
value: typing.Any,
path: str
) -> typing.Any

Validate a redundant turn copy and compare its normalized supported fields.

nemo_gym.atif_export._encoded_trajectory(
) -> bytes
nemo_gym.atif_export._final_metrics(
total_steps: int
nemo_gym.atif_export._index(
row: dict[str, typing.Any],
key: str,
path: str
) -> int
nemo_gym.atif_export._json_value(
value: typing.Any
) -> typing.Any
nemo_gym.atif_export._message_content(
item: typing.Any,
path: str
nemo_gym.atif_export._model_call_index(
nemo_gym.atif_export._parse_arguments(
path: str
) -> dict[str, typing.Any]
nemo_gym.atif_export._path_error(
path: str,
detail: str
nemo_gym.atif_export._preflight_conversation(
conversation: typing.Any,
path: str
) -> None

Reject raw fields that supported Pydantic variants would silently erase.

nemo_gym.atif_export._preflight_model_call_refs(
value: typing.Any,
path: str
) -> None
nemo_gym.atif_export._preflight_model_ref(
value: typing.Any,
path: str
) -> None
nemo_gym.atif_export._preflight_parts(
value: typing.Any,
path: str,
supported_fields: dict[str, frozenset[str]]
) -> None
nemo_gym.atif_export._preflight_raw_trajectory(
value: typing.Any
) -> None
nemo_gym.atif_export._preflight_training_metadata(
item: dict[typing.Any, typing.Any],
path: str
) -> None
nemo_gym.atif_export._reasoning_text(
path: str
) -> str | None
nemo_gym.atif_export._reject_unknown_fields(
value: dict[typing.Any, typing.Any],
allowed: set[str] | frozenset[str],
path: str
) -> None
nemo_gym.atif_export._source_item_ids(
) -> dict[str, typing.Any]

Return provider item identities that ATIF has no standard fields for.

nemo_gym.atif_export._text_content(
value: typing.Any,
path: str
nemo_gym.atif_export._tool_record_extra(
record: typing.Any,
source_item_id: str | None = None
) -> dict[str, typing.Any] | None
nemo_gym.atif_export._validate_json_value(
value: typing.Any,
path: str
) -> None

Reject Python values that cannot round-trip through UTF-8 JSON unchanged.

nemo_gym.atif_export.export_rollouts_to_atif(

Validate a rollout JSONL completely, then atomically publish ATIF files and a manifest.

nemo_gym.atif_export.gym_rollout_to_atif(
rollout: dict[str, typing.Any],
session_id: str,
agent_version: str

Convert one rollout row, rejecting any structure Gym cannot represent completely.

nemo_gym.atif_export._CONVERSATION_ADAPTER = TypeAdapter(list[NeMoGymResponseInputItem])
nemo_gym.atif_export._KNOWN_INCOMPLETE_FINISH_REASONS = frozenset({'aborted', 'canceled', 'cancelled', 'content_filter', 'failed', 'inco...
nemo_gym.atif_export._TRAINING_METADATA_FIELDS = frozenset({'prompt_token_ids', 'generation_token_ids', 'generation_log_probs', '...