opentau.utils.libero_dataset_recorder

Utilities for recording and converting LIBERO datasets.

This module provides functions for converting LIBERO episode data into the standard dataset format, including consolidation of task results, aggregation of multiple results, and generation of dataset metadata.

Functions

aggregate_task_results(results)

Aggregate multiple LIBERO task results into a single result dictionary.

consolidate_task_result(task_result, output_dir)

Consolidate LIBERO task results into a standardized dataset format.

make_libero_info(total_episodes, ...)

Generate metadata dictionary for LIBERO dataset.

make_readme()

Generate a README string for automatically generated datasets.

uint8_arr_to_png_bytes(arr)

Convert a uint8 image array to PNG bytes.

opentau.utils.libero_dataset_recorder.aggregate_task_results(results: list[dict]) dict[source]

Aggregate multiple LIBERO task results into a single result dictionary.

Parameters:

results – List of task result dictionaries to aggregate.

Returns:

Dictionary containing aggregated episode data with all observations, actions, and per-episode metadata combined.

opentau.utils.libero_dataset_recorder.consolidate_task_result(task_result: dict, output_dir: str | Path, allow_overwrite: bool = False) None[source]

Consolidate LIBERO task results into a standardized dataset format.

Parameters:
  • task_result – Dictionary containing episode data with observations, actions, and metadata.

  • output_dir – Directory path where the consolidated dataset will be saved.

  • allow_overwrite – If True, overwrite existing output directory. Defaults to False.

Raises:

FileExistsError – If output_dir already exists and allow_overwrite is False.

opentau.utils.libero_dataset_recorder.make_libero_info(total_episodes: int, total_frames: int, total_chunks: int) dict[source]

Generate metadata dictionary for LIBERO dataset.

Parameters:
  • total_episodes – Total number of episodes in the dataset.

  • total_frames – Total number of frames across all episodes.

  • total_chunks – Total number of data chunks.

Returns:

Dictionary containing dataset metadata including codebase version, robot type, episode/frame counts, task information, and feature specifications.

opentau.utils.libero_dataset_recorder.make_readme() str[source]

Generate a README string for automatically generated datasets.

Returns:

String containing information about when and how the dataset was generated.

opentau.utils.libero_dataset_recorder.uint8_arr_to_png_bytes(arr: ndarray) bytes[source]

Convert a uint8 image array to PNG bytes.

Parameters:

arr – Image array in CHW format (channels, height, width) with uint8 values.

Returns:

PNG-encoded image bytes.