Download load_multimodal.py from LV-Robotics-Lab/pi-embodied-rd-interactions: direct link, hf CLI and curl.
- Browser
- Download file 1.08 kB
-
https://huggingface.co/datasets/LV-Robotics-Lab/pi-embodied-rd-interactions/resolve/main/load_multimodal.py
- Command line
-
hf download hf://datasets/LV-Robotics-Lab/pi-embodied-rd-interactions/load_multimodal.py
-
curl -L -o load_multimodal.py https://huggingface.co/datasets/LV-Robotics-Lab/pi-embodied-rd-interactions/resolve/main/load_multimodal.py
1.08 kB
| #!/usr/bin/env python3 | |
| """Load normalized interactions and individual LeRobot exports from the Hub.""" | |
| import json | |
| import pathlib | |
| from datasets import load_dataset | |
| from huggingface_hub import snapshot_download | |
| def load_interactions(stream='policy', split='train'): | |
| return load_dataset(f'LV-Robotics-Lab/pi-embodied-{stream}-interactions', split=split) | |
| def as_chat(row): | |
| """OpenAI-style messages, including tool calls and remote image URLs.""" | |
| return json.loads(row['messages_json']) | |
| def load_execution_export(name, revision='main'): | |
| from lerobot.datasets.lerobot_dataset import LeRobotDataset | |
| repo = 'LV-Robotics-Lab/pi-embodied-policy-interactions' | |
| snapshot = pathlib.Path(snapshot_download(repo, repo_type='dataset', revision=revision, | |
| allow_patterns=[f'lerobot/{name}/**'])) | |
| root = snapshot/'lerobot'/name | |
| if not (root/'meta/info.json').exists(): | |
| raise FileNotFoundError(f'Unknown execution export: {name}') | |
| return LeRobotDataset(repo_id=repo, root=root, download_videos=False) | |