TacRich-Manip-LeRobot-teleoperation-cyclically-arrange-steel-plate / examples /load_lerobot_dataset.py
Download examples/load_lerobot_dataset.py from qingzhu-robotics/TacRich-Manip-LeRobot-teleoperation-cyclically-arrange-steel-plate: direct link, hf CLI and curl.
- Browser
- Download file 2.28 kB
-
https://huggingface.co/datasets/qingzhu-robotics/TacRich-Manip-LeRobot-teleoperation-cyclically-arrange-steel-plate/resolve/main/examples/load_lerobot_dataset.py
- Command line
-
hf download hf://datasets/qingzhu-robotics/TacRich-Manip-LeRobot-teleoperation-cyclically-arrange-steel-plate/examples/load_lerobot_dataset.py
-
curl -L -o load_lerobot_dataset.py https://huggingface.co/datasets/qingzhu-robotics/TacRich-Manip-LeRobot-teleoperation-cyclically-arrange-steel-plate/resolve/main/examples/load_lerobot_dataset.py
2.28 kB
| #!/usr/bin/env python3 | |
| """Load one TacRich-Manip episode and print every key, shape, dtype, and value order.""" | |
| from __future__ import annotations | |
| import argparse | |
| from pathlib import Path | |
| def lerobot_dataset_class(): | |
| try: | |
| from lerobot.datasets.lerobot_dataset import LeRobotDataset | |
| except ModuleNotFoundError: | |
| from lerobot.common.datasets.lerobot_dataset import LeRobotDataset | |
| return LeRobotDataset | |
| def describe(value: object) -> str: | |
| shape = tuple(getattr(value, "shape", ())) | |
| dtype = getattr(value, "dtype", type(value).__name__) | |
| return f"shape={shape}, dtype={dtype}" | |
| def main() -> None: | |
| parser = argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument("--repo-id", default="qingzhu-robotics/TacRich-Manip-LeRobot-teleoperation-cyclically-arrange-steel-plate") | |
| parser.add_argument("--revision", default="main") | |
| parser.add_argument("--root", type=Path, help="Optional existing local dataset root") | |
| parser.add_argument("--episode-index", type=int, default=0) | |
| parser.add_argument("--frame-index", type=int, default=0, | |
| help="Zero-based index inside the selected episode") | |
| parser.add_argument("--video-backend", default="pyav") | |
| args = parser.parse_args() | |
| dataset = lerobot_dataset_class()( | |
| repo_id=args.repo_id, | |
| root=args.root, | |
| revision=args.revision, | |
| episodes=[args.episode_index], | |
| video_backend=args.video_backend, | |
| ) | |
| if not 0 <= args.frame_index < len(dataset): | |
| raise IndexError(f"frame {args.frame_index} outside [0, {len(dataset) - 1}]") | |
| sample = dataset[args.frame_index] | |
| print(dataset) | |
| print(f"selected episode={args.episode_index}, local frame={args.frame_index}") | |
| print("runtime sample keys:") | |
| for key in sorted(sample): | |
| print(f" {key:48s} {describe(sample[key])}") | |
| print("\nordered vectors:") | |
| for key in ( | |
| "observation.state", | |
| "action", | |
| "observation.state_gripper", | |
| "action_gripper", | |
| ): | |
| print(f" {key}: {sample[key]}") | |
| print("\nCanonical orders are documented in docs/DATASET_SCHEMA.md.") | |
| print("For exact float64 source times, read the Parquet columns with PyArrow.") | |
| if __name__ == "__main__": | |
| main() | |