Skip to navigation

nemo_gym.utils.task_ids

View as MarkdownOpen in Claude

The task ids a run selects (task_ids or task_ids_fpath), their digest, and the record a subset run keeps.

Nothing here writes; the run that collects the rows writes the record (rollouts_task_selection.json).

Module Contents

Classes

NameDescription
TaskSelectionThe ids a run selects, as strings, and where they came from: task_ids or the id file’s path.

Functions

NameDescription
read_task_ids_fileThe ids a task id file lists, one per line; blank lines and lines starting with # are skipped.
read_task_selection_recordA saved selection record; None when the run selected no tasks (no record). An unreadable record is a subset
task_ids_as_stringsInline ids as strings: Hydra reads an unquoted 7 as an int and true as a bool. A float is refused, since
task_ids_digestThe sha256 of the selected ids, sorted and unique, one per line: the same set always gives the same digest.
task_selectionThe run’s selection from its task_ids or task_ids_fpath setting; None when it selects no tasks by id.
task_selection_recordWhat rollouts_task_selection.json holds: the source, the counts, the sorted ids and their digest.

API

class nemo_gym.utils.task_ids.TaskSelection()

Bases: NamedTuple

The ids a run selects, as strings, and where they came from: task_ids or the id file’s path.

source
str
task_ids
list[str]
nemo_gym.utils.task_ids.read_task_ids_file(
fpath: str
) -> list[str]

The ids a task id file lists, one per line; blank lines and lines starting with # are skipped.

nemo_gym.utils.task_ids.read_task_selection_record(
path: pathlib.Path
) -> dict[str, typing.Any] | None

A saved selection record; None when the run selected no tasks (no record). An unreadable record is a subset whose source and digest are unknown, never a run of every task.

nemo_gym.utils.task_ids.task_ids_as_strings(
value: typing.Any
) -> typing.Any

Inline ids as strings: Hydra reads an unquoted 7 as an int and true as a bool. A float is refused, since its text (1e3, 1.50) is gone; anything that is not a list is returned for the caller to reject.

nemo_gym.utils.task_ids.task_ids_digest(
task_ids: collections.abc.Sequence[str]
) -> str

The sha256 of the selected ids, sorted and unique, one per line: the same set always gives the same digest.

nemo_gym.utils.task_ids.task_selection(
task_ids: typing.Any,
task_ids_fpath: str | None

The run’s selection from its task_ids or task_ids_fpath setting; None when it selects no tasks by id.

nemo_gym.utils.task_ids.task_selection_record(
rows: int
) -> dict[str, typing.Any]

What rollouts_task_selection.json holds: the source, the counts, the sorted ids and their digest.