Customizable and modular RL algorithms implemented in PyTorch
Project description
CusRL: Customizable Reinforcement Learning
CusRL is a flexible and modular reinforcement-learning framework designed for customization. By breaking down complex algorithms into minimal components, it allows users to easily modify or integrate components instead of rebuilding the entire algorithm from scratch, making it particularly well-suited for advancing robotics learning.
Note: This project is under active development, which means the interface is unstable and breaking changes are likely to occur frequently.
Setup
CusRL requires Python 3.10 or later. It can be installed via PyPI with:
# Choose one of the following:
# 1. Minimal installation
pip install cusrl
# 2. Install with export and logging utilities
pip install cusrl[all]
or by cloning this repository and installing it with:
git clone https://github.com/chengruiz/cusrl.git
# Choose one of the following:
# 1. Minimal installation
pip install -e . --config-settings editable_mode=strict
# 2. Install with optional dependencies
pip install -e .[all] --config-settings editable_mode=strict
# 3. Install dependencies for development
pip install -e .[dev] --config-settings editable_mode=strict
pre-commit install
Quick Start
List all available experiments:
python -m cusrl list-experiments
Train a PPO agent and evaluate it:
python -m cusrl train -env MountainCar-v0 -alg ppo --logger tensorboard --seed 42
python -m cusrl play --checkpoint logs/MountainCar-v0:ppo
Or if you have IssacLab installed:
python -m cusrl train -env Isaac-Velocity-Rough-Anymal-C-v0 -alg ppo \
--logger tensorboard --environment-args="--headless"
python -m cusrl play --checkpoint logs/Isaac-Velocity-Rough-Anymal-C-v0:ppo
Try distributed training:
torchrun --nproc-per-node=2 -m cusrl train -env Isaac-Velocity-Rough-Anymal-C-v0 \
-alg ppo --logger tensorboard --environment-args="--headless"
Highlights
CusRL provides a modular and extensible framework for RL with the following key features:
- Modular Design: Components are highly decoupled, allowing for free combination and customization
- Diverse Network Architectures: Support for MLP, CNN, RNNs, Transformer and custom architectures
- Modern Training Techniques: Built-in support for distributed and mixed-precision training
Implemented Algorithms
- Adversarial Motion Prior (AMP)
- Generalized Advantage Estimation (GAE) with distinct lambda values
- Preserving Outputs Precisely, while Adaptively Rescaling Targets (Pop-Art)
- Proximal Policy Optimization (PPO) with recurrent policy support
- Random Network Distillation (RND)
- Symmetry Augmentations: Symmetric Architecture, Symmetric Data Augmentation, Symmetry Loss
Cite
If you find this framework useful for your research, please consider citing our work on legged locomotion:
- Efficient Learning of A Unified Policy For Whole-body Manipulation and Locomotion Skills, IROS 2025
- Learning Accurate and Robust Velocity Tracking for Quadrupedal Robots, JFR 2025
- Learning Safe Locomotion for Quadrupedal Robots by Derived-Action Optimization, IROS 2024
Acknowledgement
CusRL is based on or inspired by these projects:
- Stable Baselines3: Reliable implementations of reinforcement learning algorithms
- RSL RL: Fast and simple implementation of RL algorithms
- IsaacLab: GPU-accelerated simulation environments for robot research
- robot_lab: RL extension library for robots, based on IsaacLab
- OnnxSlim: Library for performing optimizations on ONNX models
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cusrl-1.1.4.tar.gz.
File metadata
- Download URL: cusrl-1.1.4.tar.gz
- Upload date:
- Size: 131.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30d2e6a4d90333ead61c5a9a26c072d5baa0f1921ba219fad934b1a1a709d05a
|
|
| MD5 |
18c69f9a9ab6baed4dc9477de69ff514
|
|
| BLAKE2b-256 |
25b70257c56fd72d28c7ad8f6db910eae49b25cc1a9a1afca9eba3a6d1b4baeb
|
File details
Details for the file cusrl-1.1.4-py3-none-any.whl.
File metadata
- Download URL: cusrl-1.1.4-py3-none-any.whl
- Upload date:
- Size: 150.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1e8e39bafec54a88407d365ae9a7cea8c46bd9516e9f64395efe5761b38afaf
|
|
| MD5 |
0338e81904b75c782292388e885b98d9
|
|
| BLAKE2b-256 |
59b837b435b5678d371ea6ea82edd5a48a11ccce1677a8a3ed7a85016698decb
|