Unable to Stream Dataset using StreamingLerobotDataset

#2
by sattwik21 - opened

Description

As the dataset is ~780 Gb, I tried to load it using the streaming feature in Lerobot. But faced an HfHubHTTPError.

Reproducing the Error

import torch
from lerobot.datasets.streaming_dataset import StreamingLeRobotDataset


def main():
    dataset = StreamingLeRobotDataset("SharpaIT/Robotic_Origami_Challenge")
    sample = dataset[100]


if __name__ == "__main__":
    main()
Error
Traceback (most recent call last):
  File "/mnt/toshiba_hdd/code/robot-learning/iros-origami/.venv/lib/python3.12/site-packages/lerobot/datasets/dataset_metadata.py", line 109, in __init__
    self._load_metadata()
  File "/mnt/toshiba_hdd/code/robot-learning/iros-origami/.venv/lib/python3.12/site-packages/lerobot/datasets/dataset_metadata.py", line 176, in _load_metadata
    self.info = load_info(self.root)
                ^^^^^^^^^^^^^^^^^^^^
  File "/mnt/toshiba_hdd/code/robot-learning/iros-origami/.venv/lib/python3.12/site-packages/lerobot/datasets/io_utils.py", line 161, in load_info
    info = load_json(local_dir / INFO_PATH)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/toshiba_hdd/code/robot-learning/iros-origami/.venv/lib/python3.12/site-packages/lerobot/datasets/io_utils.py", line 128, in load_json
    with open(fpath) as f:
         ^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/home/moonlab/.cache/huggingface/lerobot/SharpaIT/Robotic_Origami_Challenge/meta/info.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/mnt/toshiba_hdd/code/robot-learning/iros-origami/src/iros_origami/test_data.py", line 11, in <module>
    main()
  File "/mnt/toshiba_hdd/code/robot-learning/iros-origami/src/iros_origami/test_data.py", line 6, in main
    dataset = StreamingLeRobotDataset("SharpaIT/Robotic_Origami_Challenge")
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/toshiba_hdd/code/robot-learning/iros-origami/.venv/lib/python3.12/site-packages/lerobot/datasets/streaming_dataset.py", line 298, in __init__
    self.meta = LeRobotDatasetMetadata(
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/toshiba_hdd/code/robot-learning/iros-origami/.venv/lib/python3.12/site-packages/lerobot/datasets/dataset_metadata.py", line 112, in __init__
    self.revision = get_safe_version(self.repo_id, self.revision)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/toshiba_hdd/code/robot-learning/iros-origami/.venv/lib/python3.12/site-packages/lerobot/datasets/utils.py", line 302, in get_safe_version
    raise RevisionNotFoundError(
          ^^^^^^^^^^^^^^^^^^^^^^
TypeError: HfHubHTTPError.__init__() missing 1 required keyword-only argument: 'response'

Debugging

Verified Access

I have confirmed that I have access to the dataset. I logged out and back into huggingface cli using hf auth login

image

I also tried verifying it using the following code.

from huggingface_hub import HfApi

api = HfApi()
print(api.repo_info("SharpaIT/Robotic_Origami_Challenge", repo_type="dataset"))

The output had no errors. It printed out the information related to the dataset.

File Tree Structure

Reading the errors and the documentation on your dataset README, I think this could probably be because Lerobot cannot find a meta/ directory at the root of your dataset file tree. This is because the lerobotv3.0/ folder contains the seasons and episodes inside it. How can I access this data using the Lerobot streaming feature?

sattwik21 changed discussion title from Unable to Stream Dataset using `StreamingLerobotDataset` to Unable to Stream Dataset using StreamingLerobotDataset

Hi, thanks for reporting this.

The issue is not related to dataset access permission. This dataset is organized by collection season, rather than as one flattened LeRobot dataset root.

In other words, the repository root does not contain a top-level meta/info.json. Instead, each season has its own LeRobot export:

season_xxx_train/
β”œβ”€β”€ lerobot3.0/
β”‚   β”œβ”€β”€ meta/
β”‚   β”œβ”€β”€ data/
β”‚   └── videos/
└── lerobotv2.1/
    β”œβ”€β”€ meta/
    β”œβ”€β”€ data/
    └── videos/

However, StreamingLeRobotDataset("SharpaIT/Robotic_Origami_Challenge") expects the repository root itself to be a standard LeRobot dataset root:

meta/
data/
videos/

So LeRobot tries to find meta/info.json at the repository root and fails.

For the current release, please select one season and load that season's lerobot3.0 folder:

from pathlib import Path

from huggingface_hub import snapshot_download
from lerobot.datasets.streaming_dataset import StreamingLeRobotDataset

repo_id = "SharpaIT/Robotic_Origami_Challenge"
season = "season_xxx_train"  # replace with one season name from the README
fmt = "lerobot3.0"

cache_root = Path.home() / ".cache" / "roco_lerobot_seasons"

snapshot_download(
    repo_id=repo_id,
    repo_type="dataset",
    allow_patterns=[f"{season}/{fmt}/**"],
    local_dir=cache_root,
)

dataset = StreamingLeRobotDataset(
    repo_id=repo_id,
    root=cache_root / season / fmt,
    streaming=True,
)

sample = next(iter(dataset))
print(sample.keys())

If you want to use multiple seasons, you can create one dataset per season and chain them:

from pathlib import Path

from huggingface_hub import snapshot_download
from lerobot.datasets.streaming_dataset import StreamingLeRobotDataset
from torch.utils.data import ChainDataset

repo_id = "SharpaIT/Robotic_Origami_Challenge"
seasons = [
    "season_A_train",
    "season_B_train",
]
fmt = "lerobot3.0"

cache_root = Path.home() / ".cache" / "roco_lerobot_seasons"

datasets = []

for season in seasons:
    snapshot_download(
        repo_id=repo_id,
        repo_type="dataset",
        allow_patterns=[f"{season}/{fmt}/**"],
        local_dir=cache_root,
    )

    datasets.append(
        StreamingLeRobotDataset(
            repo_id=repo_id,
            root=cache_root / season / fmt,
            streaming=True,
        )
    )

dataset = ChainDataset(datasets)
sample = next(iter(dataset))
print(sample.keys())

One more note: the TypeError: HfHubHTTPError.__init__() message is likely a compatibility issue between the current LeRobot error handling and the installed huggingface_hub version. It is not the root cause here. The root cause is the season-based repository layout.

We will consider adding a flattened LeRobot-compatible release in the future. For the current release, please load the data season by season as shown above.

Sign up or log in to comment