Open
Conversation
…nd SAC restructuring - Add RLAlgorithm base class and RLAlgorithmConfig with draccus.ChoiceRegistry - Add RLTrainer for unified training orchestration with iterator pattern - Add DataMixer and OnlineOfflineMixer for online/offline data mixing - Restructure SAC algorithm with batch iterator and factory pattern - Add observation normalization pre/post processors - Add comprehensive tests for all new components
13 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
refactor(rl): Introduce a modular RL stack to support future RL algorithms and VLA fine-tuning with RL
Type / Scope
src/lerobot/rl/,src/lerobot/configs/,src/lerobot/processor/Summary / Motivation
HIL-SERL is working (#504, PR #644), but training logic was coupled to the learner script. This refactor introduces
RLAlgorithm,RLTrainer, andDataMixerso that adding a new algorithm = one file + config, same pattern as policies. No breaking changes to CLI or config. Phase 1 of broader plan.Related issues
What changed
src/lerobot/rl/algorithms/base.py(NEW):RLAlgorithmABC,RLAlgorithmConfigdraccus registry,TrainingStatsdataclass.src/lerobot/rl/algorithms/sac.py(NEW): SAC logic moved from learner; batch iterator pattern.src/lerobot/rl/algorithms/__init__.py(NEW): Registry,make_algorithm()factory.src/lerobot/rl/trainer.py(NEW):RLTrainer— preprocesses batches, delegates toalgorithm.update().src/lerobot/rl/data_sources/data_mixer.py(NEW):DataMixerABC,OnlineOfflineMixer.src/lerobot/rl/data_sources/__init__.py(NEW): Exports.src/lerobot/rl/learner.py(MODIFIED): Delegates toalgorithm.update(); −305 lines.src/lerobot/rl/actor.py(MODIFIED): UsesRLAlgorithm.select_action(),load_weights().src/lerobot/configs/train.py(MODIFIED):RLAlgorithmConfiginTrainRLServerPipelineConfig.src/lerobot/processor/normalize_processor.py(MODIFIED): Pre/post processors for observation normalization.tests/rl/test_sac_algorithm.py(NEW): SAC algorithm tests.tests/rl/test_trainer.py(NEW): RLTrainer tests.tests/rl/test_data_mixer.py(NEW): DataMixer tests.tests/rl/test_actor_learner.py(MODIFIED): Integration tests for new abstractions.How was this tested
pytest -q tests/rl/pytestPandaPickCubeGamepad-v0)How to run locally (reviewer)
Checklist (required before merge)
pre-commit run -a)pytest)Reviewer notes
RLAlgorithminalgorithms/base.py— this is the contract that every future RL algorithm will implement. Feedback on the interface design is especially welcome.update(batch_iterator)pattern is intentional: algorithms own the gradient-step loop (including UTD ratio), while the trainer owns data mixing and preprocessing.