Spaces:
Sleeping
Sleeping
Emil Ernerfeldt
commited on
Commit
·
6442fbd
1
Parent(s):
4337a31
Make it easy to log any HuggingFace dataset
Browse files
README.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
-
# Rerun visualization
|
|
|
|
|
2 |
* https://huggingface.co/lerobot
|
3 |
* https://huggingface.co/datasets/lerobot/pusht
|
4 |
|
|
|
1 |
+
# Rerun visualization of HuggingFace datasets
|
2 |
+
Tested with LeRobot datasets:
|
3 |
+
|
4 |
* https://huggingface.co/lerobot
|
5 |
* https://huggingface.co/datasets/lerobot/pusht
|
6 |
|
main.py
CHANGED
@@ -2,6 +2,8 @@
|
|
2 |
|
3 |
from __future__ import annotations
|
4 |
|
|
|
|
|
5 |
import rerun as rr
|
6 |
from datasets import load_dataset
|
7 |
from PIL import Image
|
@@ -43,16 +45,34 @@ def log_dataset_to_rerun(dataset) -> None:
|
|
43 |
elif isinstance(cell, float) or isinstance(cell, int):
|
44 |
rr.log(column_name, rr.Scalar(cell))
|
45 |
else:
|
|
|
46 |
rr.log(column_name, rr.TextDocument(str(cell)))
|
47 |
|
48 |
|
49 |
def main():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
print("Loading dataset…")
|
51 |
-
|
52 |
-
dataset = load_dataset("lerobot/aloha_sim_transfer_cube_human", split="train")
|
53 |
|
54 |
-
print("Selecting
|
55 |
-
ds_subset = dataset.filter(lambda frame: frame["episode_id"] ==
|
56 |
|
57 |
print("Starting Rerun…")
|
58 |
rr.init("rerun_example_lerobot", spawn=True)
|
|
|
2 |
|
3 |
from __future__ import annotations
|
4 |
|
5 |
+
import argparse
|
6 |
+
|
7 |
import rerun as rr
|
8 |
from datasets import load_dataset
|
9 |
from PIL import Image
|
|
|
45 |
elif isinstance(cell, float) or isinstance(cell, int):
|
46 |
rr.log(column_name, rr.Scalar(cell))
|
47 |
else:
|
48 |
+
# TODO(emilk): check if it is a tensor and then log it using rr.Tensor
|
49 |
rr.log(column_name, rr.TextDocument(str(cell)))
|
50 |
|
51 |
|
52 |
def main():
|
53 |
+
# Define the available datasets
|
54 |
+
available_datasets = [
|
55 |
+
"lerobot/aloha_sim_insertion_human",
|
56 |
+
"lerobot/aloha_sim_insertion_scripted",
|
57 |
+
"lerobot/aloha_sim_transfer_cube_human",
|
58 |
+
"lerobot/aloha_sim_transfer_cube_scripted",
|
59 |
+
"lerobot/pusht",
|
60 |
+
"lerobot/xarm_lift_medium",
|
61 |
+
]
|
62 |
+
|
63 |
+
# Create the parser
|
64 |
+
parser = argparse.ArgumentParser(description="Log a HuggingFace dataset to Rerun.")
|
65 |
+
parser.add_argument("--dataset", choices=available_datasets, default="pusht", help="The name of the dataset to load")
|
66 |
+
parser.add_argument("--episode-id", default=1, help="Which episode to select")
|
67 |
+
|
68 |
+
# Parse the arguments
|
69 |
+
args = parser.parse_args()
|
70 |
+
|
71 |
print("Loading dataset…")
|
72 |
+
dataset = load_dataset(args.dataset, split="train")
|
|
|
73 |
|
74 |
+
print("Selecting episode {args.episode_id}…")
|
75 |
+
ds_subset = dataset.filter(lambda frame: frame["episode_id"] == args.episode_id)
|
76 |
|
77 |
print("Starting Rerun…")
|
78 |
rr.init("rerun_example_lerobot", spawn=True)
|