Compare commits

..

137 Commits

Author SHA1 Message Date
KeWang
5ae5dcb30f Port SAC WIP (#581)
Co-authored-by: KeWang1017 <ke.wang@helloleap.ai>
2024-12-17 14:26:17 +01:00
Michel Aractingi
972bac98b4 completed losses 2024-12-12 11:45:30 +01:00
Michel Aractingi
458c427e0c adding sac implementation 2024-12-11 00:34:43 +01:00
Michel Aractingi
3d7e74d162 nit in control_robot.py 2024-12-11 00:30:33 +01:00
Michel Aractingi
e9ef46f134 Update lerobot/scripts/train_hilserl_classifier.py
Co-authored-by: Yoel <yoel.chornton@gmail.com>
2024-12-11 00:22:10 +01:00
Michel Aractingi
d26a9b1363 fixed merge conflicts 2024-12-10 16:59:43 +01:00
Michel Aractingi
ceda66e2bc incomplete merge 2024-12-10 16:55:55 +01:00
Michel Aractingi
839dac9cd4 Merge branch 'main' into user/michel-aractingi/2024-11-27-port-hil-serl 2024-12-10 16:02:49 +01:00
Michel Aractingi
abcf17a070 Add human intervention mechanism and eval_robot script to evaluate policy on the robot (#541)
Co-authored-by: Yoel <yoel.chornton@gmail.com>
2024-12-09 19:17:47 +01:00
Yoel
6490927b3d Reward classifier and training (#528)
Co-authored-by: Daniel Ritchie <daniel@brainwavecollective.ai>
Co-authored-by: resolver101757 <kelster101757@hotmail.com>
Co-authored-by: Jannik Grothusen <56967823+J4nn1K@users.noreply.github.com>
Co-authored-by: Remi <re.cadene@gmail.com>
Co-authored-by: Michel Aractingi <michel.aractingi@huggingface.co>
2024-12-09 10:21:50 +01:00
Michel Aractingi
44d96a0811 nit 2024-11-27 15:19:20 +01:00
Michel Aractingi
4488e55e94 first commit 2024-11-27 15:01:06 +01:00
Simon Alibert
2945dca65b Comment 2024-11-26 10:38:11 +01:00
Simon Alibert
691d39aa32 Merge remote-tracking branch 'origin/main' into user/aliberts/2024_09_25_reshape_dataset 2024-11-26 10:37:17 +01:00
Simon Alibert
56c01a2944 Activate end-to-end tests 2024-11-26 10:35:10 +01:00
Simon Alibert
49bdcc094c Remove comment 2024-11-26 10:34:14 +01:00
Simon Alibert
6ad84a6561 Refactor pusht_zarr 2024-11-25 18:23:04 +01:00
Simon Alibert
3b5af7eb38 Merge remote-tracking branch 'origin/main' into user/aliberts/2024_09_25_reshape_dataset 2024-11-25 17:43:58 +01:00
Simon Alibert
23f6c875b5 Apply suggestions from code review 2024-11-25 12:44:12 +01:00
Simon Alibert
f56d769dfb Remove todos 2024-11-20 21:10:02 +01:00
Simon Alibert
36b9b60a0e Update example 1 2024-11-20 18:22:46 +01:00
Simon Alibert
93d9bf83c2 Add open X datasets 2024-11-20 14:42:08 +01:00
Simon Alibert
37da50b573 Fix conversion script 2024-11-20 12:16:27 +01:00
Simon Alibert
c6ad495176 Enhance dataset cards 2024-11-20 11:57:27 +01:00
Simon Alibert
f43e5d07f5 Fix tests 2024-11-20 00:26:31 +01:00
Simon Alibert
9ee8711504 Update example 1 2024-11-19 18:49:35 +01:00
Simon Alibert
6203641710 Use HWC for images 2024-11-19 18:48:17 +01:00
Remi
1f13bda25b Improve dataset v2 (#498) 2024-11-19 12:31:47 +01:00
Simon Alibert
acae4b49d2 Add comment on license 2024-11-18 18:54:13 +01:00
Simon Alibert
c72ad49c9b Skip test_examples 2024-11-18 18:46:00 +01:00
Simon Alibert
eda02fade5 Skip test_visualize_local_dataset 2024-11-18 18:06:18 +01:00
Simon Alibert
8546358bc5 Fix test_visualize_dataset_html 2024-11-18 17:54:15 +01:00
Simon Alibert
a91b7c6163 Add extra info to dataset card, various fixes from Remi's review 2024-11-18 17:50:13 +01:00
Simon Alibert
4d15861872 Merge remote-tracking branch 'origin/main' into user/aliberts/2024_09_25_reshape_dataset 2024-11-05 19:10:38 +01:00
Simon Alibert
f3630ad910 Fix tests 2024-11-05 19:09:12 +01:00
Simon Alibert
aed9f4036a Refactor dataset features 2024-11-05 13:10:43 +01:00
Simon Alibert
757ea175d3 Fix test_examples 2024-11-03 19:41:50 +01:00
Simon Alibert
b69a132737 Fix test_examples 2024-11-03 19:30:56 +01:00
Simon Alibert
7b159a6b22 Move calculate_episode_data_index 2024-11-03 19:13:00 +01:00
Simon Alibert
74270c8c91 Remove reset_episode_index 2024-11-03 19:07:43 +01:00
Simon Alibert
a6762ec316 Fix advanced example 2 2024-11-03 19:03:15 +01:00
Simon Alibert
fde29e0167 Merge remote-tracking branch 'origin/main' into user/aliberts/2024_09_25_reshape_dataset 2024-11-03 18:32:14 +01:00
Simon Alibert
56e4603d5b Deactivate policies backward compatibility test 2024-11-03 18:30:50 +01:00
Simon Alibert
f6c90ca35f Remove end-to-end tests 2024-11-03 18:28:54 +01:00
Simon Alibert
c2d6fb6119 Fix werkzeug alert 2024-11-03 18:23:38 +01:00
Simon Alibert
95a4b59b5b Fix vizualize 2024-11-03 18:18:23 +01:00
Simon Alibert
16103cb8b7 Fix hanging 2024-11-03 18:07:55 +01:00
Simon Alibert
e4ba084e25 Add LeRobotDatasetMetadata 2024-11-03 18:07:37 +01:00
Simon Alibert
ac79e8cb36 Fix test_online_buffer.py 2024-11-03 13:15:01 +01:00
Simon Alibert
df2cb51364 Add todo in skipped test 2024-11-02 20:01:34 +01:00
Simon Alibert
7a342db9c4 Add more options to img factories 2024-11-02 20:01:02 +01:00
Simon Alibert
6b2ec1ed77 Add test_image_writer, accept PIL images, improve ImageWriter perf in main process 2024-11-02 20:00:07 +01:00
Simon Alibert
375abd3020 Add img and img_tensor factories 2024-11-02 13:06:38 +01:00
Simon Alibert
293bdc7f67 Simplify, add test content, add todo 2024-11-01 19:55:28 +01:00
Simon Alibert
79d114cc1f Rename num_samples -> num_frames for consistency 2024-11-01 19:47:16 +01:00
Simon Alibert
2650872b76 Add tasks and episodes factories 2024-11-01 13:37:17 +01:00
Simon Alibert
cd1509d805 Mock snapshot_download 2024-11-01 10:58:09 +01:00
Simon Alibert
5ea7c78237 Remove obsolete code 2024-10-31 21:43:57 +01:00
Simon Alibert
443a9eec88 Remove/comment obsolete tests 2024-10-31 21:43:29 +01:00
Simon Alibert
ab23a4fd27 Add fixtures in test_datasets 2024-10-31 21:32:09 +01:00
Simon Alibert
1267c3e955 Split fixtures into factories and files 2024-10-31 21:29:50 +01:00
Simon Alibert
c70b8d0abc Update doc 2024-10-31 14:08:13 +01:00
Simon Alibert
e1845d4dcc Update doc 2024-10-31 14:06:54 +01:00
Simon Alibert
e69f0c5059 Add test_delta_timestamps.py 2024-10-31 13:48:40 +01:00
Simon Alibert
ff84024ee9 Add dataset fixtures 2024-10-31 13:46:46 +01:00
Simon Alibert
ee51f54cb5 Remove dataset from image_transform tests 2024-10-29 16:08:01 +01:00
Simon Alibert
fee5fa5c2e Remove image_writer arg 2024-10-29 16:07:10 +01:00
Simon Alibert
8d57093ce7 Merge remote-tracking branch 'origin/main' into user/aliberts/2024_09_25_reshape_dataset 2024-10-29 15:25:25 +01:00
Simon Alibert
4c22de20a6 Add sanity check 2024-10-28 12:26:07 +01:00
Simon Alibert
51e87f6f97 Fix image writer 2024-10-28 12:01:32 +01:00
Simon Alibert
df3d2ec5df Speedup test 2024-10-26 10:59:06 +02:00
Simon Alibert
e210d795de Add video_info, fix image_writer 2024-10-25 16:55:33 +02:00
Simon Alibert
18ffa4248b Add json/jsonl io functions 2024-10-24 11:49:53 +02:00
Simon Alibert
8bcf81fa24 Add todo 2024-10-24 11:38:32 +02:00
Simon Alibert
615894d3fb Add test_same_attributes_defined 2024-10-24 11:37:44 +02:00
Simon Alibert
450eae310b Add error msg 2024-10-24 00:13:53 +02:00
Simon Alibert
60865e8980 Allow dataset creation without robot 2024-10-24 00:13:21 +02:00
Simon Alibert
0d77be90ee Move ImageWriter creation inside the dataset 2024-10-23 23:12:44 +02:00
Simon Alibert
0098bd264e Nits 2024-10-23 20:55:54 +02:00
Simon Alibert
1aba80d93f Fix consolidate 2024-10-23 18:45:59 +02:00
Simon Alibert
07570f867f Fix _query_videos return shapes 2024-10-23 18:18:28 +02:00
Simon Alibert
b8bdbc1c5b Fix check_delta_timestamps 2024-10-23 18:17:56 +02:00
Simon Alibert
7ae8d05326 Fix visualization 2024-10-23 14:20:27 +02:00
Simon Alibert
a2a8538ac9 add write_stats, changes names, add some typing 2024-10-23 11:38:07 +02:00
Simon Alibert
fb73cdb9a4 Update dataset doc 2024-10-23 00:32:28 +02:00
Simon Alibert
9dca233d7e Fix episode chunk 2024-10-23 00:27:14 +02:00
Simon Alibert
c3c0141738 Update & fix conversion script 2024-10-23 00:05:31 +02:00
Simon Alibert
c72dc23c43 Remove total_episodes from default parquet path 2024-10-23 00:03:30 +02:00
Simon Alibert
237a484be0 Fix paths & add add_frame doc 2024-10-22 22:46:34 +02:00
Simon Alibert
6c2cb6e107 Remove populate dataset 2024-10-22 20:21:26 +02:00
Simon Alibert
b46db7ea73 Fix tests 2024-10-22 20:14:06 +02:00
Simon Alibert
ee52b8b782 Add channels to intelrealsense 2024-10-22 20:07:11 +02:00
Simon Alibert
a805458c7e Add local_files_only, encode_videos, fix bugs to pass tests (WIP) 2024-10-22 19:57:52 +02:00
Simon Alibert
e991a31061 Improve consistency between __init__() and create(), WIP on consolidate 2024-10-22 00:19:25 +02:00
Simon Alibert
c4c0a43de7 add delete_episode, WIP on consolidate 2024-10-21 20:10:13 +02:00
Simon Alibert
299451af81 Add add_episode & task logic 2024-10-21 19:30:20 +02:00
Simon Alibert
9ebf8b88ec Merge remote-tracking branch 'origin/main' into user/aliberts/2024_09_25_reshape_dataset 2024-10-21 00:22:30 +02:00
Simon Alibert
c1232a01e2 Add add_frame, empty dataset creation 2024-10-21 00:16:52 +02:00
Simon Alibert
3b925c3dce Add ImageWriter 2024-10-21 00:15:09 +02:00
Simon Alibert
e46bdb9d30 Change card creation 2024-10-20 14:01:10 +02:00
Simon Alibert
9316cf46ef Add file paths 2024-10-20 14:00:19 +02:00
Simon Alibert
ac3798bd62 Move default paths, use jsonlines for tasks 2024-10-18 17:53:25 +02:00
Simon Alibert
bce3dc3bfa Add load_metadata 2024-10-18 14:59:09 +02:00
Simon Alibert
1a51505ec6 Add download_metadata, move default paths 2024-10-18 14:48:34 +02:00
Simon Alibert
e7355ba595 Fix episodes.jsonl 2024-10-18 12:03:29 +02:00
Simon Alibert
91e8ce772b Remove caret requirement 2024-10-18 09:48:38 +02:00
Simon Alibert
3a9f964429 Add copyrights 2024-10-18 00:31:21 +02:00
Simon Alibert
beacb7e957 Cleanup 2024-10-18 00:30:16 +02:00
Simon Alibert
be64d54bd9 Update doc 2024-10-18 00:29:50 +02:00
Simon Alibert
354f37aed3 Merge remote-tracking branch 'origin/main' into user/aliberts/2024_09_25_reshape_dataset 2024-10-17 23:34:00 +02:00
Simon Alibert
d0d8193625 Add unitreeh and umi 2024-10-17 23:33:51 +02:00
Simon Alibert
7242c57400 Cleanup 2024-10-17 16:08:37 +02:00
Simon Alibert
3ee3739edc Add batch conversion log 2024-10-17 13:08:58 +02:00
Simon Alibert
ad3f112d16 Add fixes for lfs tracking 2024-10-17 12:58:48 +02:00
Simon Alibert
50a75ad3fe Write episodes as jsonlines 2024-10-17 10:17:27 +02:00
Simon Alibert
c146ba936f Add episode chunks logic, move_videos & lfs tracking fix 2024-10-16 23:34:54 +02:00
Simon Alibert
110264000f Add fixes for batch convert 2024-10-15 19:03:11 +02:00
Simon Alibert
9433ac52ec WIP add batch convert 2024-10-15 13:08:31 +02:00
Simon Alibert
da78bbfd16 Update load_tasks doc 2024-10-15 11:06:28 +02:00
Simon Alibert
835ab5a81b Cleanup, fix load_tasks 2024-10-15 11:05:16 +02:00
Simon Alibert
f96773de10 Fix safe_version 2024-10-14 13:51:40 +02:00
Simon Alibert
cbc51e1341 Extend v1 compatibility 2024-10-14 10:14:27 +02:00
Simon Alibert
cf633344be Add multitask support, refactor conversion script 2024-10-13 21:21:40 +02:00
Simon Alibert
8bd406e607 Add suggestions from code review 2024-10-11 18:52:11 +02:00
Simon Alibert
3ea53124e0 Add padding keys and download_data option 2024-10-11 17:38:47 +02:00
Simon Alibert
7f680886b0 Add huggingface-hub patch for offline snapshot_download with local_dir 2024-10-11 11:03:11 +02:00
Simon Alibert
6d2bc11365 Add doc, scrap video_frame_keys attribute 2024-10-11 10:59:38 +02:00
Simon Alibert
b417cebc4e Update LeRobotDataset.__get_item__ 2024-10-10 21:32:14 +02:00
Simon Alibert
3113038beb Merge remote-tracking branch 'origin/main' into user/aliberts/2024_09_25_reshape_dataset 2024-10-09 14:33:58 +02:00
Simon Alibert
096824b5ff Rework LeRobotDataset.__init__ 2024-10-09 14:33:26 +02:00
Simon Alibert
2d75b93ba0 Update info.json format 2024-10-08 15:31:37 +02:00
Simon Alibert
21ba4b5263 Add pixel channels 2024-10-06 11:16:49 +02:00
Simon Alibert
028c17fd48 Merge remote-tracking branch 'origin/main' into user/aliberts/2024_09_25_reshape_dataset 2024-10-04 18:59:41 +02:00
Simon Alibert
07e113ce21 Add info.json link 2024-10-04 14:36:11 +02:00
Simon Alibert
1016a983a1 Add upload folders 2024-10-04 14:26:50 +02:00
Simon Alibert
17a1214e25 Merge remote-tracking branch 'origin/main' into user/aliberts/2024_09_25_reshape_dataset 2024-10-04 11:22:22 +02:00
Simon Alibert
ad115b6c27 WIP 2024-10-03 20:00:44 +02:00
7 changed files with 16 additions and 19 deletions

View File

@@ -3,7 +3,7 @@ default_language_version:
python: python3.10
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: debug-statements
@@ -14,11 +14,11 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.0
rev: v3.16.0
hooks:
- id: pyupgrade
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.2
rev: v0.5.2
hooks:
- id: ruff
args: [--fix]
@@ -32,6 +32,6 @@ repos:
- "--check"
- "--no-update"
- repo: https://github.com/gitleaks/gitleaks
rev: v8.21.2
rev: v8.18.4
hooks:
- id: gitleaks

View File

@@ -10,10 +10,10 @@ from torchvision.transforms import ToPILImage, v2
from lerobot.common.datasets.lerobot_dataset import LeRobotDataset
dataset_repo_id = "lerobot/aloha_static_screw_driver"
dataset_repo_id = "lerobot/aloha_static_tape"
# Create a LeRobotDataset with no transformations
dataset = LeRobotDataset(dataset_repo_id, episodes=[0])
dataset = LeRobotDataset(dataset_repo_id)
# This is equivalent to `dataset = LeRobotDataset(dataset_repo_id, image_transforms=None)`
# Get the index of the first observation in the first episode
@@ -28,13 +28,12 @@ transforms = v2.Compose(
[
v2.ColorJitter(brightness=(0.5, 1.5)),
v2.ColorJitter(contrast=(0.5, 1.5)),
v2.ColorJitter(hue=(-0.1, 0.1)),
v2.RandomAdjustSharpness(sharpness_factor=2, p=1),
]
)
# Create another LeRobotDataset with the defined transformations
transformed_dataset = LeRobotDataset(dataset_repo_id, episodes=[0], image_transforms=transforms)
transformed_dataset = LeRobotDataset(dataset_repo_id, image_transforms=transforms)
# Get a frame from the transformed dataset
transformed_frame = transformed_dataset[first_idx][transformed_dataset.meta.camera_keys[0]]

View File

@@ -56,7 +56,7 @@ python lerobot/scripts/control_robot.py teleoperate \
--robot-overrides max_relative_target=5
```
By adding `--robot-overrides max_relative_target=5`, we override the default value for `max_relative_target` defined in `lerobot/configs/robot/aloha.yaml`. It is expected to be `5` to limit the magnitude of the movement for more safety, but the teleoperation won't be smooth. When you feel confident, you can disable this limit by adding `--robot-overrides max_relative_target=null` to the command line:
By adding `--robot-overrides max_relative_target=5`, we override the default value for `max_relative_target` defined in `lerobot/configs/robot/aloha.yaml`. It is expected to be `5` to limit the magnitude of the movement for more safety, but the teloperation won't be smooth. When you feel confident, you can disable this limit by adding `--robot-overrides max_relative_target=null` to the command line:
```bash
python lerobot/scripts/control_robot.py teleoperate \
--robot-path lerobot/configs/robot/aloha.yaml \

View File

@@ -298,7 +298,7 @@ class LeRobotDatasetMetadata:
f"Some cameras in your {robot.robot_type} robot don't have an fps matching the fps of your dataset."
"In this case, frames from lower fps cameras will be repeated to fill in the blanks."
)
elif features is None:
elif robot_type is None or features is None:
raise ValueError(
"Dataset features must either come from a Robot or explicitly passed upon creation."
)

View File

@@ -122,12 +122,12 @@ def predict_action(observation, policy, device, use_amp):
def init_keyboard_listener(assign_rewards=False):
"""
Initializes a keyboard listener to enable early termination of an episode
or environment reset by pressing the right arrow key ('->'). This may require
Initializes a keyboard listener to enable early termination of an episode
or environment reset by pressing the right arrow key ('->'). This may require
sudo permissions to allow the terminal to monitor keyboard events.
Args:
assign_rewards (bool): If True, allows annotating the collected trajectory
assign_rewards (bool): If True, allows annotating the collected trajectory
with a binary reward at the end of the episode to indicate success.
"""
events = {}
@@ -199,7 +199,7 @@ def init_policy(pretrained_policy_name_or_path, policy_overrides):
def warmup_record(
robot,
events,
enable_teleoperation,
enable_teloperation,
warmup_time_s,
display_cameras,
fps,
@@ -210,7 +210,7 @@ def warmup_record(
display_cameras=display_cameras,
events=events,
fps=fps,
teleoperate=enable_teleoperation,
teleoperate=enable_teloperation,
)
@@ -287,8 +287,6 @@ def control_loop(
if dataset is not None:
frame = {**observation, **action}
if "next.reward" in events:
frame["next.reward"] = events["next.reward"]
dataset.add_frame(frame)
if display_cameras and not is_headless():

View File

@@ -224,7 +224,7 @@ def record(
else:
raise NotImplementedError("Only single-task recording is supported for now")
# Load pretrained policy
# Load pretrained policy
if pretrained_policy_name_or_path is not None:
policy, policy_fps, device, use_amp = init_policy(pretrained_policy_name_or_path, policy_overrides)

View File

@@ -35,7 +35,7 @@ python lerobot/scripts/visualize_dataset.py \
--episode-index 0
```
- Replay a sequence of test episodes:
- Replay a sequence of test episodes:
```bash
python lerobot/scripts/control_sim_robot.py replay \
--robot-path lerobot/configs/robot/your_robot_config.yaml \