Skip to content

Commit 4bb6d16

Browse files
committed
feat(viz): allow local --root usage without repo-id and document it
1 parent 2117ba5 commit 4bb6d16

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

docs/source/tutorials/visualization.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ The following example shows how to visualize the first episode (index 0) of the
99
1010
opentau-dataset-viz --repo-id lerobot/droid_100 --episode-index 0
1111
12+
When the dataset is already available in a local directory, ``--repo-id`` is optional and you can point directly to it with ``--root``:
13+
14+
.. code-block:: bash
15+
16+
opentau-dataset-viz --root ~/.cache/huggingface/lerobot/lerobot/droid_100 --episode-index 0
17+
1218
This command will open a `rerun <https://rerun.io>`_ window displaying the selected episode, allowing you to explore the episode interactively.
1319

1420
Camera Logging Mode

src/opentau/scripts/visualize_dataset.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
local$ opentau-dataset-viz --repo-id lerobot/pusht --episode-index 0
3434
```
3535
36+
- Visualize a local dataset directory without specifying `repo_id`:
37+
```
38+
local$ opentau-dataset-viz --root data/lerobot/pusht --episode-index 0
39+
```
40+
3641
- Visualize using source MP4 assets when available (smaller .rrd files):
3742
```
3843
local$ opentau-dataset-viz --repo-id lerobot/pusht --episode-index 0 --camera-log-mode asset_video
@@ -443,8 +448,11 @@ def parse_args() -> dict:
443448
parser.add_argument(
444449
"--repo-id",
445450
type=str,
446-
required=True,
447-
help="Name of hugging face repository containing a LeRobotDataset dataset (e.g. `lerobot/pusht`).",
451+
default=None,
452+
help=(
453+
"Name of hugging face repository containing a LeRobotDataset dataset "
454+
"(e.g. `lerobot/pusht`). Optional when `--root` points to a local dataset directory."
455+
),
448456
)
449457
parser.add_argument(
450458
"--episode-index",
@@ -555,6 +563,8 @@ def parse_args() -> dict:
555563
)
556564

557565
args = parser.parse_args()
566+
if args.repo_id is None and args.root is None:
567+
parser.error("Either `--repo-id` or `--root` must be provided.")
558568
return vars(args)
559569

560570

@@ -572,6 +582,12 @@ def main():
572582
if not PERMIT_URDF:
573583
kwargs["urdf"] = None
574584

585+
if repo_id is None:
586+
assert root is not None # guarded in parse_args
587+
# LeRobotDataset requires a repo_id; synthesize one for local-only visualization.
588+
local_name = Path(root).expanduser().resolve().name or "dataset"
589+
repo_id = f"local/{local_name}"
590+
575591
logging.info("Loading dataset")
576592
tolerance_schedule = [tolerance_s]
577593
for candidate in [1e-3, 3e-3, 1e-2]:

0 commit comments

Comments
 (0)