Repository navigation
Add skrl as a second RL backend behind a backend abstraction - #77
Merged
Merged
Conversation
GeneLab was hard-wired to RSL-RL (PPO only). Introduce a generic RL backend abstraction so RSL-RL and skrl are both selectable behind train_task / play_task, chosen by the type of TaskCfg.agent. - genelab.rl.backends: Backend protocol + Train/PlayContext, a registry keyed by agent-cfg type, RslRlBackend (existing path moved verbatim), and SkrlBackend (PPO, A2C, SAC, TD3, DDPG). - skrl glue: SkrlAgentCfg (one dataclass for all algorithms), GenelabSkrlWrapper, and an MLP model factory on skrl's mixin API. - runner.py train_task/play_task become backend-agnostic dispatchers; shared helpers (bridges, play loop, log dirs) stay shared. - CLI _dispatch_train routes via select_backend; multi-GPU stays RSL-RL only. skrl is an optional extra (skrl>=1.4.0,<2). - Franka example gains a GeneLab-Franka-Pick-And-Place-skrl-v0 task; docs (EN/ZH) updated. New test_skrl_pipeline.py. RSL-RL behavior is unchanged; existing tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
KraHsu
added a commit
that referenced
this pull request
Jun 5, 2026
Add skrl as a second RL backend behind a backend abstraction
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.
Context
GeneLab was hard-wired to a single RL library — RSL-RL (PPO only). This PR adds skrl as a second RL backend behind a generic backend abstraction: RSL-RL and skrl are both selectable behind
train_task/play_task, chosen automatically by the type ofTaskCfg.agent. RSL-RL stays the default and its behavior is unchanged.Changes
Backend abstraction (
src/genelab/rl/backends/)base.py—Backendprotocol +TrainContext/PlayContext/ProfileArgs.__init__.py— registry keyed by agent-cfg type;select_backend(agent_cfg).rsl_rl.py— the existing RSL-RL /OnPolicyRunnerpath, moved intoRslRlBackendverbatim.skrl.py—SkrlBackend: PPO, A2C, SAC, TD3, DDPG via skrl agents +SequentialTrainer.skrl glue
skrl_config.py— oneSkrlAgentCfgdataclass covering all five algorithms.skrl_wrapper.py—GenelabSkrlWrapperadaptsManagerBasedRlEnvto skrl (guarded import).skrl_models.py— per-algorithm MLP model factory on skrl's mixin API.Wiring
runner.py—train_task/play_taskbecome thin, backend-agnostic dispatchers; shared helpers stay shared.cli/__init__.py—_dispatch_trainroutes viaselect_backend; multi-GPU stays RSL-RL only.pyproject.toml— optionalskrlextra (skrl>=1.4.0,<2).GeneLab-Franka-Pick-And-Place-skrl-v0task; docs updated (EN/ZH).Note: skrl trains in timesteps, so
--max-iterationsmaps to the skrl timestep budget.Verification
test_skrl_pipeline.py(9 tests) passes.ruff checkandpyright(strict) both clean.🤖 Generated with Claude Code