robocandywrapper 0.2.14__tar.gz → 0.2.16__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {robocandywrapper-0.2.14/robocandywrapper.egg-info → robocandywrapper-0.2.16}/PKG-INFO +4 -3
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/pyproject.toml +5 -3
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper/__init__.py +1 -1
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper/constants.py +1 -0
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper/dataformats/lerobot_21/convert_v20_to_v21.py +1 -1
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper/dataformats/lerobot_21/dataset.py +21 -11
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper/factory.py +3 -3
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper/plugins/__init__.py +6 -0
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper/plugins/control_mode.py +3 -0
- robocandywrapper-0.2.16/robocandywrapper/plugins/molmopoint.py +163 -0
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper/wrapper.py +1 -1
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16/robocandywrapper.egg-info}/PKG-INFO +4 -3
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper.egg-info/SOURCES.txt +1 -0
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper.egg-info/requires.txt +3 -2
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/setup.py +1 -1
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/LICENSE +0 -0
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/MANIFEST.in +0 -0
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/README.md +0 -0
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper/dataformats/__init__.py +0 -0
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper/dataformats/lerobot_21/__init__.py +0 -0
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper/dataformats/lerobot_21/utils.py +0 -0
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper/metadata_view.py +0 -0
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper/plugin.py +0 -0
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper/plugins/affordance.py +0 -0
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper/plugins/episode_outcome.py +0 -0
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper/plugins/subtask.py +0 -0
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper/samplers/__init__.py +0 -0
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper/samplers/config.py +0 -0
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper/samplers/factory.py +0 -0
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper/samplers/weighted.py +0 -0
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper/utils.py +0 -0
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper.egg-info/dependency_links.txt +0 -0
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper.egg-info/top_level.txt +0 -0
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/setup.cfg +0 -0
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/tests/test_dataset_weights_integration.py +0 -0
- {robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/tests/test_key_rename_stats.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: robocandywrapper
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.16
|
|
4
4
|
Summary: Sweet wrappers for extending and remixing LeRobot Datasets
|
|
5
5
|
Author: RoboCandyWrapper Contributors
|
|
6
6
|
License: MIT License
|
|
@@ -43,13 +43,14 @@ Requires-Dist: torch>=2.0.0
|
|
|
43
43
|
Requires-Dist: lerobot<0.5,>=0.4
|
|
44
44
|
Requires-Dist: pandas>=1.3.0
|
|
45
45
|
Requires-Dist: rewact_tools
|
|
46
|
+
Requires-Dist: motion-primitives
|
|
47
|
+
Requires-Dist: lerobot-policy-diffusion-motion-primitives
|
|
48
|
+
Requires-Dist: lerobot-policy-diffusion-pointing
|
|
46
49
|
Provides-Extra: dev
|
|
47
50
|
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
48
51
|
Requires-Dist: black>=22.0.0; extra == "dev"
|
|
49
52
|
Requires-Dist: isort>=5.10.0; extra == "dev"
|
|
50
53
|
Requires-Dist: flake8>=4.0.0; extra == "dev"
|
|
51
|
-
Requires-Dist: motion-primitives; extra == "dev"
|
|
52
|
-
Requires-Dist: lerobot-policy-diffusion-motion-primitives; extra == "dev"
|
|
53
54
|
Dynamic: license-file
|
|
54
55
|
Dynamic: requires-python
|
|
55
56
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "robocandywrapper"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.16"
|
|
8
8
|
description = "Sweet wrappers for extending and remixing LeRobot Datasets"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10,<3.11"
|
|
@@ -28,6 +28,9 @@ dependencies = [
|
|
|
28
28
|
"lerobot>=0.4,<0.5",
|
|
29
29
|
"pandas>=1.3.0",
|
|
30
30
|
"rewact_tools",
|
|
31
|
+
"motion-primitives",
|
|
32
|
+
"lerobot-policy-diffusion-motion-primitives",
|
|
33
|
+
"lerobot-policy-diffusion-pointing",
|
|
31
34
|
]
|
|
32
35
|
|
|
33
36
|
[project.optional-dependencies]
|
|
@@ -36,8 +39,6 @@ dev = [
|
|
|
36
39
|
"black>=22.0.0",
|
|
37
40
|
"isort>=5.10.0",
|
|
38
41
|
"flake8>=4.0.0",
|
|
39
|
-
"motion-primitives",
|
|
40
|
-
"lerobot-policy-diffusion-motion-primitives"
|
|
41
42
|
]
|
|
42
43
|
|
|
43
44
|
[project.urls]
|
|
@@ -57,6 +58,7 @@ override-dependencies = [
|
|
|
57
58
|
|
|
58
59
|
[tool.uv.sources]
|
|
59
60
|
lerobot-policy-diffusion-motion-primitives = { path = "../../experimental/lerobot_policy_diffusion_motion_primitives", editable = true }
|
|
61
|
+
lerobot-policy-diffusion-pointing = { path = "../../experimental/lerobot_policy_diffusion_pointing", editable = true }
|
|
60
62
|
motion-primitives = { path = "../../experimental/motion_primitives", editable = true }
|
|
61
63
|
rewact-tools = { path = "../rewACT/rewact_tools", editable = true }
|
|
62
64
|
|
|
@@ -10,5 +10,6 @@ AFFORDANCE_PLUGIN_NAME = "affordance"
|
|
|
10
10
|
CONTROL_MODE_PLUGIN_NAME = "control_mode"
|
|
11
11
|
EPISODE_OUTCOME_PLUGIN_NAME = "episode_outcome"
|
|
12
12
|
SUBTASK_PLUGIN_NAME = "subtask"
|
|
13
|
+
MOLMOPOINT_PLUGIN_NAME = "molmopoint"
|
|
13
14
|
MOTION_PRIMITIVE_PLUGIN_NAME = "motion_primitives"
|
|
14
15
|
|
|
@@ -34,7 +34,7 @@ from huggingface_hub import HfApi
|
|
|
34
34
|
from tqdm import tqdm
|
|
35
35
|
|
|
36
36
|
from lerobot.datasets.compute_stats import aggregate_stats, get_feature_stats, sample_indices
|
|
37
|
-
from lerobot.datasets.
|
|
37
|
+
from lerobot.datasets.io_utils import load_stats, write_info
|
|
38
38
|
|
|
39
39
|
from robocandywrapper.dataformats.lerobot_21.dataset import LeRobot21Dataset
|
|
40
40
|
from robocandywrapper.dataformats.lerobot_21.utils import (
|
|
@@ -38,24 +38,34 @@ from lerobot.datasets.utils import (
|
|
|
38
38
|
DEFAULT_IMAGE_PATH,
|
|
39
39
|
INFO_PATH,
|
|
40
40
|
LEGACY_TASKS_PATH as TASKS_PATH,
|
|
41
|
+
check_version_compatibility,
|
|
42
|
+
create_lerobot_dataset_card,
|
|
43
|
+
get_safe_version,
|
|
44
|
+
is_valid_version,
|
|
45
|
+
)
|
|
46
|
+
from lerobot.datasets.feature_utils import (
|
|
41
47
|
_validate_feature_names,
|
|
42
48
|
check_delta_timestamps,
|
|
43
|
-
check_version_compatibility,
|
|
44
49
|
create_empty_dataset_info,
|
|
45
|
-
create_lerobot_dataset_card,
|
|
46
|
-
embed_images,
|
|
47
50
|
get_delta_indices,
|
|
48
51
|
get_hf_features_from_features,
|
|
49
|
-
get_safe_version,
|
|
50
|
-
hf_transform_to_torch,
|
|
51
|
-
is_valid_version,
|
|
52
|
-
load_info,
|
|
53
|
-
load_stats,
|
|
54
52
|
validate_episode_buffer,
|
|
55
53
|
validate_frame,
|
|
54
|
+
)
|
|
55
|
+
from lerobot.datasets.io_utils import (
|
|
56
|
+
embed_images,
|
|
57
|
+
load_info,
|
|
58
|
+
load_stats,
|
|
56
59
|
write_info,
|
|
57
60
|
write_json,
|
|
58
61
|
)
|
|
62
|
+
|
|
63
|
+
def hf_transform_to_torch(item):
|
|
64
|
+
"""Compat shim: transforms HF dataset items to torch tensors."""
|
|
65
|
+
for key in item:
|
|
66
|
+
if isinstance(item[key], np.ndarray):
|
|
67
|
+
item[key] = torch.from_numpy(item[key])
|
|
68
|
+
return item
|
|
59
69
|
# Import legacy v2.1-specific functions that were removed in lerobot 0.4.1
|
|
60
70
|
from robocandywrapper.dataformats.lerobot_21.utils import (
|
|
61
71
|
append_jsonlines,
|
|
@@ -749,7 +759,7 @@ class LeRobot21Dataset(torch.utils.data.Dataset):
|
|
|
749
759
|
|
|
750
760
|
def __getitem__(self, idx) -> dict:
|
|
751
761
|
item = self.hf_dataset[idx]
|
|
752
|
-
ep_idx = item["episode_index"].item()
|
|
762
|
+
ep_idx = item["episode_index"].item() if isinstance(item["episode_index"], torch.Tensor) else item["episode_index"]
|
|
753
763
|
|
|
754
764
|
query_indices = None
|
|
755
765
|
if self.delta_indices is not None:
|
|
@@ -760,7 +770,7 @@ class LeRobot21Dataset(torch.utils.data.Dataset):
|
|
|
760
770
|
item[key] = val
|
|
761
771
|
|
|
762
772
|
if len(self.meta.video_keys) > 0:
|
|
763
|
-
current_ts = item["timestamp"].item()
|
|
773
|
+
current_ts = item["timestamp"].item() if isinstance(item["timestamp"], torch.Tensor) else item["timestamp"]
|
|
764
774
|
query_timestamps = self._get_query_timestamps(current_ts, query_indices)
|
|
765
775
|
video_frames = self._query_videos(query_timestamps, ep_idx)
|
|
766
776
|
item = {**video_frames, **item}
|
|
@@ -771,7 +781,7 @@ class LeRobot21Dataset(torch.utils.data.Dataset):
|
|
|
771
781
|
item[cam] = self.image_transforms(item[cam])
|
|
772
782
|
|
|
773
783
|
# Add task as a string
|
|
774
|
-
task_idx = item["task_index"].item()
|
|
784
|
+
task_idx = item["task_index"].item() if isinstance(item["task_index"], torch.Tensor) else item["task_index"]
|
|
775
785
|
item["task"] = self.meta.tasks[task_idx]
|
|
776
786
|
|
|
777
787
|
# Hack - add gripper position to end
|
|
@@ -10,7 +10,7 @@ from lerobot.datasets.lerobot_dataset import (
|
|
|
10
10
|
LeRobotDataset,
|
|
11
11
|
LeRobotDatasetMetadata,
|
|
12
12
|
)
|
|
13
|
-
from lerobot.datasets.
|
|
13
|
+
from lerobot.datasets.utils import BackwardCompatibilityError
|
|
14
14
|
from lerobot.datasets.transforms import ImageTransforms
|
|
15
15
|
from lerobot.datasets.factory import IMAGENET_STATS
|
|
16
16
|
from lerobot.utils.constants import ACTION, REWARD
|
|
@@ -71,7 +71,7 @@ def _create_datasets(
|
|
|
71
71
|
root: Optional[str],
|
|
72
72
|
revision: Optional[str],
|
|
73
73
|
episodes: Optional[list[int] | dict[str, list[int]]],
|
|
74
|
-
video_backend: str,
|
|
74
|
+
video_backend: str | None,
|
|
75
75
|
action_delta_indices: Optional[List] = None,
|
|
76
76
|
observation_delta_indices: Optional[List] = None,
|
|
77
77
|
reward_delta_indices: Optional[List] = None,
|
|
@@ -250,7 +250,7 @@ def make_dataset_without_config(
|
|
|
250
250
|
action_delta_indices: List = None,
|
|
251
251
|
observation_delta_indices: List = None,
|
|
252
252
|
root: str = None,
|
|
253
|
-
video_backend: str =
|
|
253
|
+
video_backend: str | None = None,
|
|
254
254
|
episodes: list[int] | dict[str, list[int]] | None = None,
|
|
255
255
|
revision: str | None = None,
|
|
256
256
|
use_imagenet_stats: bool = True,
|
|
@@ -12,6 +12,10 @@ from robocandywrapper.plugins.episode_outcome import (
|
|
|
12
12
|
EpisodeOutcomePlugin,
|
|
13
13
|
EpisodeOutcomeInstance,
|
|
14
14
|
)
|
|
15
|
+
from robocandywrapper.plugins.molmopoint import (
|
|
16
|
+
MolmoPointPlugin,
|
|
17
|
+
MolmoPointInstance,
|
|
18
|
+
)
|
|
15
19
|
|
|
16
20
|
__all__ = [
|
|
17
21
|
"ControlModePlugin",
|
|
@@ -20,5 +24,7 @@ __all__ = [
|
|
|
20
24
|
"AffordanceInstance",
|
|
21
25
|
"EpisodeOutcomePlugin",
|
|
22
26
|
"EpisodeOutcomeInstance",
|
|
27
|
+
"MolmoPointPlugin",
|
|
28
|
+
"MolmoPointInstance",
|
|
23
29
|
]
|
|
24
30
|
|
{robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper/plugins/control_mode.py
RENAMED
|
@@ -197,9 +197,12 @@ class ControlModeInstance(PluginInstance):
|
|
|
197
197
|
"""Find the episode_modes.json file for a dataset root, or None."""
|
|
198
198
|
cw = dataset_root / CANDYWRAPPER_PLUGINS_DIR
|
|
199
199
|
legacy = cw / "dagger_data_source" / "episode_modes.json"
|
|
200
|
+
legacy_2 = dataset_root / "dagger_data_source" / "episode_modes.json"
|
|
200
201
|
current = cw / CONTROL_MODE_PLUGIN_NAME / "episode_modes.json"
|
|
201
202
|
if legacy.exists():
|
|
202
203
|
return legacy
|
|
204
|
+
if legacy_2.exists():
|
|
205
|
+
return legacy_2
|
|
203
206
|
if current.exists():
|
|
204
207
|
return current
|
|
205
208
|
return None
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"""
|
|
2
|
+
MolmoPoint Plugin for per-frame visual affordance point labels.
|
|
3
|
+
|
|
4
|
+
Storage: {dataset_root}/candywrapper_plugins/molmopoint/episode_{idx:06d}.parquet
|
|
5
|
+
|
|
6
|
+
Parquet schema per episode:
|
|
7
|
+
frame_index : int — episode-relative frame index (0-based)
|
|
8
|
+
camera : str — camera key, e.g. "observation.images.front"
|
|
9
|
+
point_x : float — normalised x coordinate (-1 to 1, left to right)
|
|
10
|
+
point_y : float — normalised y coordinate (-1 to 1, top to bottom)
|
|
11
|
+
is_keyframe : bool — True for raw MolmoPoint predictions, False for interpolated
|
|
12
|
+
|
|
13
|
+
Coordinates are in [-1, 1] where (-1,-1) is top-left and (1,1) is bottom-right.
|
|
14
|
+
"""
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import warnings
|
|
18
|
+
from pathlib import Path
|
|
19
|
+
from typing import Any, Dict, Optional
|
|
20
|
+
|
|
21
|
+
import torch
|
|
22
|
+
from lerobot.datasets.lerobot_dataset import LeRobotDataset
|
|
23
|
+
|
|
24
|
+
from robocandywrapper.constants import CANDYWRAPPER_PLUGINS_DIR, MOLMOPOINT_PLUGIN_NAME
|
|
25
|
+
from robocandywrapper.plugin import DatasetPlugin, PluginInstance
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _calculate_episode_data_index(hf_dataset) -> dict[str, torch.Tensor]:
|
|
29
|
+
episode_data_index: dict[str, list[int]] = {"from": [], "to": []}
|
|
30
|
+
if len(hf_dataset) == 0:
|
|
31
|
+
return {"from": torch.tensor([]), "to": torch.tensor([])}
|
|
32
|
+
current_episode = None
|
|
33
|
+
for idx, episode_idx in enumerate(hf_dataset["episode_index"]):
|
|
34
|
+
if episode_idx != current_episode:
|
|
35
|
+
episode_data_index["from"].append(idx)
|
|
36
|
+
if current_episode is not None:
|
|
37
|
+
episode_data_index["to"].append(idx)
|
|
38
|
+
current_episode = episode_idx
|
|
39
|
+
episode_data_index["to"].append(idx + 1)
|
|
40
|
+
return {k: torch.tensor(v) for k, v in episode_data_index.items()}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class MolmoPointPlugin(DatasetPlugin):
|
|
44
|
+
"""Plugin that provides per-frame MolmoPoint affordance labels."""
|
|
45
|
+
|
|
46
|
+
def attach(self, dataset: "LeRobotDataset") -> "MolmoPointInstance":
|
|
47
|
+
return MolmoPointInstance(dataset, self)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class MolmoPointInstance(PluginInstance):
|
|
51
|
+
"""Dataset-specific MolmoPoint label data."""
|
|
52
|
+
|
|
53
|
+
def __init__(self, dataset: "LeRobotDataset", config: MolmoPointPlugin):
|
|
54
|
+
super().__init__(dataset)
|
|
55
|
+
self.config = config
|
|
56
|
+
self._data: Dict[int, "pd.DataFrame"] = {}
|
|
57
|
+
self._cached_episode_data_index: dict[str, torch.Tensor] | None = None
|
|
58
|
+
|
|
59
|
+
self._camera_keys: list[str] = list(dataset.meta.video_keys)
|
|
60
|
+
self._camera_to_idx: dict[str, int] = {
|
|
61
|
+
k: i for i, k in enumerate(self._camera_keys)
|
|
62
|
+
}
|
|
63
|
+
self._load()
|
|
64
|
+
|
|
65
|
+
def _get_episode_data_index(self) -> dict[str, torch.Tensor]:
|
|
66
|
+
if hasattr(self.dataset, "episode_data_index"):
|
|
67
|
+
return self.dataset.episode_data_index
|
|
68
|
+
if self._cached_episode_data_index is None:
|
|
69
|
+
self._cached_episode_data_index = _calculate_episode_data_index(
|
|
70
|
+
self.dataset.hf_dataset
|
|
71
|
+
)
|
|
72
|
+
return self._cached_episode_data_index
|
|
73
|
+
|
|
74
|
+
def get_data_keys(self) -> list[str]:
|
|
75
|
+
return ["pointing", "pointing_mask"]
|
|
76
|
+
|
|
77
|
+
def get_item_data(
|
|
78
|
+
self,
|
|
79
|
+
idx: int,
|
|
80
|
+
episode_idx: int,
|
|
81
|
+
accumulated_data: Optional[Dict[str, Any]] = None,
|
|
82
|
+
) -> dict[str, Any]:
|
|
83
|
+
"""Return per-camera pointing vector and mask for this frame.
|
|
84
|
+
|
|
85
|
+
Returns:
|
|
86
|
+
pointing: tensor of shape (num_cameras * 2,) with [x0, y0, x1, y1, ...]
|
|
87
|
+
in [-1, 1]. One (x, y) pair per camera in dataset.meta.video_keys
|
|
88
|
+
order. Unlabelled cameras get (0, 0).
|
|
89
|
+
pointing_mask: bool tensor of shape (num_cameras,), True where
|
|
90
|
+
a real label exists for that camera.
|
|
91
|
+
"""
|
|
92
|
+
num_cameras = len(self._camera_keys)
|
|
93
|
+
pointing = torch.zeros(num_cameras * 2)
|
|
94
|
+
pointing_mask = torch.zeros(num_cameras, dtype=torch.bool)
|
|
95
|
+
|
|
96
|
+
if episode_idx not in self._data:
|
|
97
|
+
return {"pointing": pointing, "pointing_mask": pointing_mask}
|
|
98
|
+
|
|
99
|
+
ep_data_index = self._get_episode_data_index()
|
|
100
|
+
ep_start = ep_data_index["from"][episode_idx].item()
|
|
101
|
+
frame_in_episode = idx - ep_start
|
|
102
|
+
|
|
103
|
+
df = self._data[episode_idx]
|
|
104
|
+
rows = df[df["frame_index"] == frame_in_episode]
|
|
105
|
+
|
|
106
|
+
for _, row in rows.iterrows():
|
|
107
|
+
cam_idx = self._camera_to_idx.get(row["camera"])
|
|
108
|
+
if cam_idx is None:
|
|
109
|
+
continue
|
|
110
|
+
pointing[cam_idx * 2] = float(row["point_x"])
|
|
111
|
+
pointing[cam_idx * 2 + 1] = float(row["point_y"])
|
|
112
|
+
pointing_mask[cam_idx] = True
|
|
113
|
+
|
|
114
|
+
return {"pointing": pointing, "pointing_mask": pointing_mask}
|
|
115
|
+
|
|
116
|
+
def _get_plugin_dir(self) -> Path:
|
|
117
|
+
plugin_dir = (
|
|
118
|
+
Path(self.dataset.root) / CANDYWRAPPER_PLUGINS_DIR / MOLMOPOINT_PLUGIN_NAME
|
|
119
|
+
)
|
|
120
|
+
plugin_dir.mkdir(parents=True, exist_ok=True)
|
|
121
|
+
return plugin_dir
|
|
122
|
+
|
|
123
|
+
def _episode_path(self, episode_idx: int) -> Path:
|
|
124
|
+
return self._get_plugin_dir() / f"episode_{episode_idx:06d}.parquet"
|
|
125
|
+
|
|
126
|
+
def _load(self) -> None:
|
|
127
|
+
plugin_dir = self._get_plugin_dir()
|
|
128
|
+
import pandas as pd
|
|
129
|
+
|
|
130
|
+
loaded = 0
|
|
131
|
+
for pq_file in sorted(plugin_dir.glob("episode_*.parquet")):
|
|
132
|
+
try:
|
|
133
|
+
ep_idx = int(pq_file.stem.split("_")[1])
|
|
134
|
+
self._data[ep_idx] = pd.read_parquet(pq_file)
|
|
135
|
+
loaded += 1
|
|
136
|
+
except Exception as e:
|
|
137
|
+
warnings.warn(f"Could not load {pq_file}: {e}")
|
|
138
|
+
|
|
139
|
+
if loaded:
|
|
140
|
+
print(f"Loaded MolmoPoint labels for {loaded} episodes from {plugin_dir}")
|
|
141
|
+
|
|
142
|
+
def save_episode(self, episode_idx: int, df: "pd.DataFrame") -> Path:
|
|
143
|
+
"""Save MolmoPoint labels for one episode. Returns the saved path."""
|
|
144
|
+
self._data[episode_idx] = df
|
|
145
|
+
path = self._episode_path(episode_idx)
|
|
146
|
+
df.to_parquet(path, index=False)
|
|
147
|
+
return path
|
|
148
|
+
|
|
149
|
+
def get_episode_labels(self, episode_idx: int) -> "pd.DataFrame | None":
|
|
150
|
+
return self._data.get(episode_idx)
|
|
151
|
+
|
|
152
|
+
def get_episode_labels_by_camera(
|
|
153
|
+
self, episode_idx: int, camera: str,
|
|
154
|
+
) -> "pd.DataFrame | None":
|
|
155
|
+
df = self._data.get(episode_idx)
|
|
156
|
+
if df is None:
|
|
157
|
+
return None
|
|
158
|
+
filtered = df[df["camera"] == camera]
|
|
159
|
+
return filtered if not filtered.empty else None
|
|
160
|
+
|
|
161
|
+
@property
|
|
162
|
+
def labeled_episodes(self) -> list[int]:
|
|
163
|
+
return sorted(self._data.keys())
|
|
@@ -627,7 +627,7 @@ class WrappedRobotDataset(torch.utils.data.Dataset):
|
|
|
627
627
|
else:
|
|
628
628
|
item = dataset[local_idx]
|
|
629
629
|
|
|
630
|
-
episode_idx = item["episode_index"].item()
|
|
630
|
+
episode_idx = item["episode_index"].item() if isinstance(item["episode_index"], torch.Tensor) else item["episode_index"]
|
|
631
631
|
|
|
632
632
|
# Add dataset index
|
|
633
633
|
item["dataset_index"] = torch.tensor(dataset_idx)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: robocandywrapper
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.16
|
|
4
4
|
Summary: Sweet wrappers for extending and remixing LeRobot Datasets
|
|
5
5
|
Author: RoboCandyWrapper Contributors
|
|
6
6
|
License: MIT License
|
|
@@ -43,13 +43,14 @@ Requires-Dist: torch>=2.0.0
|
|
|
43
43
|
Requires-Dist: lerobot<0.5,>=0.4
|
|
44
44
|
Requires-Dist: pandas>=1.3.0
|
|
45
45
|
Requires-Dist: rewact_tools
|
|
46
|
+
Requires-Dist: motion-primitives
|
|
47
|
+
Requires-Dist: lerobot-policy-diffusion-motion-primitives
|
|
48
|
+
Requires-Dist: lerobot-policy-diffusion-pointing
|
|
46
49
|
Provides-Extra: dev
|
|
47
50
|
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
48
51
|
Requires-Dist: black>=22.0.0; extra == "dev"
|
|
49
52
|
Requires-Dist: isort>=5.10.0; extra == "dev"
|
|
50
53
|
Requires-Dist: flake8>=4.0.0; extra == "dev"
|
|
51
|
-
Requires-Dist: motion-primitives; extra == "dev"
|
|
52
|
-
Requires-Dist: lerobot-policy-diffusion-motion-primitives; extra == "dev"
|
|
53
54
|
Dynamic: license-file
|
|
54
55
|
Dynamic: requires-python
|
|
55
56
|
|
|
@@ -24,6 +24,7 @@ robocandywrapper/plugins/__init__.py
|
|
|
24
24
|
robocandywrapper/plugins/affordance.py
|
|
25
25
|
robocandywrapper/plugins/control_mode.py
|
|
26
26
|
robocandywrapper/plugins/episode_outcome.py
|
|
27
|
+
robocandywrapper/plugins/molmopoint.py
|
|
27
28
|
robocandywrapper/plugins/subtask.py
|
|
28
29
|
robocandywrapper/samplers/__init__.py
|
|
29
30
|
robocandywrapper/samplers/config.py
|
|
@@ -3,11 +3,12 @@ torch>=2.0.0
|
|
|
3
3
|
lerobot<0.5,>=0.4
|
|
4
4
|
pandas>=1.3.0
|
|
5
5
|
rewact_tools
|
|
6
|
+
motion-primitives
|
|
7
|
+
lerobot-policy-diffusion-motion-primitives
|
|
8
|
+
lerobot-policy-diffusion-pointing
|
|
6
9
|
|
|
7
10
|
[dev]
|
|
8
11
|
pytest>=7.0.0
|
|
9
12
|
black>=22.0.0
|
|
10
13
|
isort>=5.10.0
|
|
11
14
|
flake8>=4.0.0
|
|
12
|
-
motion-primitives
|
|
13
|
-
lerobot-policy-diffusion-motion-primitives
|
|
@@ -9,7 +9,7 @@ long_description = readme_file.read_text(encoding="utf-8") if readme_file.exists
|
|
|
9
9
|
|
|
10
10
|
setup(
|
|
11
11
|
name="robocandywrapper",
|
|
12
|
-
version="0.2.
|
|
12
|
+
version="0.2.16",
|
|
13
13
|
description="Sweet wrappers for extending and remixing LeRobot Datasets",
|
|
14
14
|
long_description=long_description,
|
|
15
15
|
long_description_content_type="text/markdown",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper/dataformats/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper/dataformats/lerobot_21/utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper/plugins/episode_outcome.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/robocandywrapper.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{robocandywrapper-0.2.14 → robocandywrapper-0.2.16}/tests/test_dataset_weights_integration.py
RENAMED
|
File without changes
|
|
File without changes
|