Commit Graph

799 Commits

Author SHA1 Message Date
Michel Aractingi 390d98cbb0 Added additional wrappers for the environment: Action repeat, keyboard interface, reset wrapper
Tested the reset mechanism and keyboard interface and the convert wrapper on the robots.

Co-authored-by: Adil Zouitine <adilzouitinegm@gmail.com>
2025-03-24 09:13:46 +00:00
Michel Aractingi ced64a03ca Added crop_dataset_roi.py that allows you to load a lerobotdataset -> crop its images -> create a new lerobot dataset with the cropped and resized images.
Co-authored-by: Adil Zouitine <adilzouitinegm@gmail.com>
2025-03-24 09:13:46 +00:00
Michel Aractingi 860a6495d8 - Added base gym env class for the real robot environment.
- Added several wrappers around the base gym env robot class.
- Including: time limit, reward classifier, crop images, preprocess observations.
- Added an interactive script crop_roi.py where the user can interactively select the roi in the observation images and return the correct crop values that will improve the policy and reward classifier performance.

Co-authored-by: Adil Zouitine <adilzouitinegm@gmail.com>
2025-03-24 09:13:46 +00:00
Michel Aractingi 97d9c54841 - Refactor observation encoder in `modeling_sac.py`
- added `torch.compile` to the actor and learner servers.
- organized imports in `train_sac.py`
- optimized the parameters push by not sending the frozen pre-trained encoder.

Co-authored-by: Adil Zouitine <adilzouitinegm@gmail.com>
2025-03-24 09:13:46 +00:00
Yoel e5a71108a8 [Port HIL-SERL] Add HF vision encoder option in SAC (#651)
Added support with custom pretrained vision encoder to the modeling sac implementation. Great job @ChorntonYoel !
2025-03-24 09:13:46 +00:00
Michel Aractingi 2fe497b760 Cleaned `learner_server.py`. Added several block function to improve readability.
Co-authored-by: Adil Zouitine <adilzouitinegm@gmail.com>
2025-03-24 09:13:12 +00:00
Michel Aractingi c504d23f82 Added support for checkpointing the policy. We can save and load the policy state dict, optimizers state, optimization step and interaction step
Added functions for converting the replay buffer from and to LeRobotDataset. When we want to save the replay buffer, we convert it first to LeRobotDataset format and save it locally and vice-versa.

Co-authored-by: Adil Zouitine <adilzouitinegm@gmail.com>
2025-03-24 09:13:12 +00:00
Michel Aractingi 2c643f43a6 Removed unnecessary time.sleep in the streaming server on the learner side
Co-authored-by: Adil Zouitine <adilzouitinegm@gmail.com>
2025-03-24 09:12:56 +00:00
Michel Aractingi d800957d53 Added missing config files `env/maniskill_example.yaml` and `policy/sac_maniskill.yaml` that are necessary to run the lerobot implementation of sac with the maniskill baselines.
Co-authored-by: Adil Zouitine <adilzouitinegm@gmail.com>
2025-03-24 09:12:56 +00:00
Michel Aractingi be367f1787 - Added additional logging information in wandb around the timings of the policy loop and optimization loop.
- Optimized critic design that improves the performance of the learner loop by a factor of 2
- Cleaned the code and fixed style issues

- Completed the config with actor_learner_config field that contains host-ip and port elemnts that are necessary for the actor-learner servers.

Co-authored-by: Adil Zouitine <adilzouitinegm@gmail.com>
2025-03-24 09:12:56 +00:00
Michel Aractingi 4169a5659d FREEDOM, added back the optimization loop code in `learner_server.py`
Ran experiment with pushcube env from maniskill. The learning seem to work.

Co-authored-by: Adil Zouitine <adilzouitinegm@gmail.com>
2025-03-24 09:12:56 +00:00
Michel Aractingi d347ad6c60 Added server directory in `lerobot/scripts` that contains scripts and the protobuf message types to split training into two processes, acting and learning. The actor rollouts the policy and collects interaction data while the learner recieves the data, trains the policy and sends the updated parameters to the actor. The two scripts are ran simultaneously
Co-authored-by: Adil Zouitine <adilzouitinegm@gmail.com>
2025-03-24 09:12:56 +00:00
AdilZouitine 67723d93f1 Stable version of rlpd + drq 2025-03-24 09:12:26 +00:00
AdilZouitine c948cde530 Add type annotations and restructure SACConfig class fields 2025-03-24 09:11:14 +00:00
Adil Zouitine de93d1e9f8 Change SAC policy implementation with configuration and modeling classes 2025-03-24 09:11:14 +00:00
Adil Zouitine 7d9ba3d8ba SAC works 2025-03-24 09:10:38 +00:00
Adil Zouitine f73d76e050 [WIP] correct sac implementation 2025-03-24 09:10:38 +00:00
Adil Zouitine e468774d9a Add rlpd tricks 2025-03-24 09:10:38 +00:00
Adil Zouitine b69eac0810 SAC works 2025-03-24 09:10:38 +00:00
Adil Zouitine fb515799e6 remove breakpoint 2025-03-24 09:10:38 +00:00
Adil Zouitine 7aeae0d06d [WIP] correct sac implementation 2025-03-24 09:10:38 +00:00
Pradeep Kadubandi 212b12cf82 Fix for the issue https://github.com/huggingface/lerobot/issues/638 (#639) 2025-03-24 09:10:38 +00:00
Michel Aractingi 5ac79d5b2b Extend reward classifier for multiple camera views (#626) 2025-03-24 09:10:18 +00:00
Eugene Mironov 55c414da09 [Port HIL_SERL] Final fixes for the Reward Classifier (#598) 2025-03-24 09:09:38 +00:00
Michel Aractingi 9e9285190d added temporary fix for missing task_index key in online environment 2025-03-24 09:08:44 +00:00
Michel Aractingi 4e5fcd5d23 split encoder for critic and actor 2025-03-24 09:08:17 +00:00
Michel Aractingi 3b86ed79db style fixes 2025-03-24 09:08:17 +00:00
KeWang1017 9968dd06e0 Refactor SAC configuration and policy for improved action sampling and stability
- Updated SACConfig to replace standard deviation parameterization with log_std_min and log_std_max for better control over action distributions.
- Modified SACPolicy to streamline action selection and log probability calculations, enhancing stochastic behavior.
- Removed deprecated TanhMultivariateNormalDiag class to simplify the codebase and improve maintainability.

These changes aim to enhance the robustness and performance of the SAC implementation during training and inference.
2025-03-24 09:08:17 +00:00
KeWang1017 9e9e49ea53 Refine SAC configuration and policy for enhanced performance
- Updated standard deviation parameterization in SACConfig to 'softplus' with defined min and max values for improved stability.
- Modified action sampling in SACPolicy to use reparameterized sampling, ensuring better gradient flow and log probability calculations.
- Cleaned up log probability calculations in TanhMultivariateNormalDiag for clarity and efficiency.
- Increased evaluation frequency in YAML configuration to 50000 for more efficient training cycles.

These changes aim to enhance the robustness and performance of the SAC implementation during training and inference.
2025-03-24 09:08:17 +00:00
KeWang1017 68896c9e44 Refactor SACPolicy for improved action sampling and standard deviation handling
- Updated action selection to use distribution sampling and log probabilities for better stochastic behavior.
- Enhanced standard deviation clamping to prevent extreme values, ensuring stability in policy outputs.
- Cleaned up code by removing unnecessary comments and improving readability.

These changes aim to refine the SAC implementation, enhancing its robustness and performance during training and inference.
2025-03-24 09:08:17 +00:00
KeWang1017 76516128a4 trying to get sac running 2025-03-24 09:08:17 +00:00
Michel Aractingi 167eee34dd Added normalization schemes and style checks 2025-03-24 09:08:17 +00:00
Michel Aractingi 325406cdc5 added optimizer and sac to factory.py 2025-03-24 09:08:17 +00:00
Eugene Mironov dc89e53d8d [HIL-SERL PORT] Fix linter issues (#588) 2025-03-24 09:07:18 +00:00
Eugene Mironov 0ce97c8061 [Port Hil-SERL] Add unit tests for the reward classifier & fix imports & check script (#578) 2025-03-24 09:07:18 +00:00
Michel Aractingi 93b8ced3c8 added comments from kewang 2025-03-24 09:05:08 +00:00
KeWang1017 aafc73eb57 Enhance SAC configuration and policy with new parameters and subsampling logic
- Added `num_subsample_critics`, `critic_target_update_weight`, and `utd_ratio` to SACConfig.
- Implemented target entropy calculation in SACPolicy if not provided.
- Introduced subsampling of critics to prevent overfitting during updates.
- Updated temperature loss calculation to use the new target entropy.
- Added comments for future UTD update implementation.

These changes improve the flexibility and performance of the SAC implementation.
2025-03-24 09:05:08 +00:00
KeWang 7efa1d6231 Port SAC WIP (#581)
Co-authored-by: KeWang1017 <ke.wang@helloleap.ai>
2025-03-24 09:05:08 +00:00
Michel Aractingi 2638b1a94a completed losses 2025-03-24 09:05:08 +00:00
Michel Aractingi b4d2604a8e nit in control_robot.py 2025-03-24 09:05:08 +00:00
Michel Aractingi 7e0cddb1c8 Update lerobot/scripts/train_hilserl_classifier.py
Co-authored-by: Yoel <yoel.chornton@gmail.com>
2025-03-24 09:05:08 +00:00
Eugene Mironov 4a5212d0e7 Fixup 2025-03-24 09:05:08 +00:00
Michel Aractingi 3b595bfd9b Add human intervention mechanism and eval_robot script to evaluate policy on the robot (#541)
Co-authored-by: Yoel <yoel.chornton@gmail.com>
2025-03-24 09:04:36 +00:00
Yoel 97b8214cd2 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>
2025-03-24 09:04:12 +00:00
Simon Alibert fe483b1d0d
Remove `poetry.lock` (#737)
Co-authored-by: Remi <remi.cadene@huggingface.co>
2025-02-17 12:03:16 +01:00
Simon Alibert ddeade077e
Conform pyproject to PEP 621 (#621) 2025-02-16 14:28:03 +01:00
Simon Alibert c4c2ce04e7
Update pre-commits (#733) 2025-02-15 15:51:17 +01:00
Simon Alibert 2cb0bf5d41
Add zizmor pre-commit (#732) 2025-02-15 15:50:10 +01:00
Simon Alibert b86a2c0b47
Fix wandb logging (#730) 2025-02-14 18:00:12 +01:00
Ilia Larchenko c574eb4984
Fixed eval.py on MPS (#702) 2025-02-14 00:03:55 +01:00