unilab-rl
English | 简体中文
Reinforcement learning algorithms and asynchronous runtimes extracted from UniLab, packaged as a standalone, simulator-agnostic library.
- Distribution name:
unilab-rl - Import namespace:
uni_rl - Repository: unilabsim/unilab_rl
Relationship with UniLab
uni_rl is the RL algorithm and async-runtime layer of the UniLab project,
split out into its own package. UniLab
remains the consumer side: it owns the physics backends, task suites, and
training entrypoints, and injects environments into uni_rl through
uni_rl.env_contract.EnvFactory. uni_rl never imports unilab / unisim
and never constructs environments itself, so any vectorized environment
satisfying the contract — including simulators outside UniLab — can drive the
algorithms in this package.
If you train with UniLab you already get uni_rl transitively. Install
unilab-rl directly when you want to reuse its algorithms and async runtime
with your own environment stack.
Naming note: the originally intended distribution name
uni-rlis unregistrable on PyPI because it ultranormalizes to the existingunirlproject. The distribution is therefore published asunilab-rl; the import namespace remainsuni_rlas designed.
Contents
- On-policy: PPO via rsl_rl
(
FinalObservationAwarePPO,RslRlVecEnvWrapper), HIM-PPO, and the HORA teacher-policy suite (incl. distillation trainer) - Async PPO (APPO): native collector/learner multiprocess implementation
- Off-policy: FastSAC, FastTD3, and FlashSAC with double-buffer async runners
- Runtime infrastructure: shared-memory rollout/replay buffers, replay pipelines, data-parallel gradient sync, memory budgeting, tensorboard/wandb training loggers, and a trace recorder
Layout
uni_rl.algos.*— the algorithm layer: on-policy (rsl_rlPPO wrappers,him_ppo,horateacher/distillation suite), async on-policy (appo), off-policy learners (fast_sac,fast_td3,flash_sac), and shared algorithm helpers (common)uni_rl.ipc— runtime infrastructure: async runner, shared-memory rollout/replay buffers, replay pipelines, DP gradient sync, memory budgetuni_rl.offpolicy— the generic off-policy double-buffer runner scaffoldinguni_rl.logging— tensorboard/wandb training loggers, trace recorderuni_rl.utils— device, seed, nan-guard, observation helpersuni_rl.env_contract— the injected env factory/protocol contract
Installation
pip install unilab-rl
# or, with uv:
uv add unilab-rl
Requires Python 3.10–3.13 and PyTorch ≥ 2.7.
Usage
uni_rl does not construct environments. Inject a picklable env factory
(EnvFactory = Callable[[int, Mapping | None], EnvProtocol]) into the runner
of your chosen algorithm:
from collections.abc import Mapping
from uni_rl.env_contract import EnvProtocol
def make_env(num_envs: int, cfg: Mapping | None) -> EnvProtocol:
"""Top-level factory (picklable by reference; no closures/lambdas)."""
...
The env contract is a minimal numpy-based, autoresetting vectorized-env
protocol: dict observations keyed by observation group (obs_groups_spec),
step() with final-observation semantics, and reset() returning
(obs, info). See the module docstring in
src/uni_rl/env_contract.py for the full
contract, and the new algorithm recipe section in
AGENTS.md for how to plug in a custom algorithm via
runtime_resolver without forking.
Design contract
uni_rl does not depend on any simulator or environment library.
Algorithm behavior is owned by the algo modules under uni_rl.algos.*;
runtime infrastructure (ipc, logging, offpolicy, utils,
env_contract) lives at the top level and never depends on the algorithm
layer. See UniLab's training entrypoints for reference env integrations.
Development
make sync # install dependencies (uv)
make test # pytest
make format # ruff check --fix + ruff format
uv run mypy src/uni_rl && uv run pyright # type gates
Citation
If you use unilab-rl in your research, please cite the UniLab paper:
@article{jia2026unilab,
title = {UniLab: A Heterogeneous Architecture for Robot RL Beyond GPU-Dominant Paradigms},
author = {Yufei Jia and Zhanxiang Cao and Mingrui Yu and Heng Zhang and Shenyu Chen and Dixuan Jiang and Meng Li and Xiaofan Li and Yiyang Liu and Junzhe Wu and Zheng Li and XiLin Fang and Tingyu Cui and Shengcheng Fu and Haoyang Li and Anqi Wang and Zifan Wang and Dongjie Zhu and Chenyu Cao and Zhenbiao Huang and Ziang Zheng and Jie Lu and Xin Ma and Zhengyang Wei and Xiang Zhao and Tianyue Zhan and Ye He and Yuxiang Chen and Yizhou Jiang and Yue Li and Haizhou Ge and Yuhang Dong and Fan Jia and Ziheng Zhang and Meng Zhang and Xiwa Deng and Zhixing Chen and Hanyang Shao and Chenxin Dong and Yixuan Li and Yizhi Chen and Bokui Chen and Kaifeng Zhang and Hanqing Cui and Yusen Qin and Ruqi Huang and Lei Han and Tiancai Wang and Xiang Li and Yue Gao and Guyue Zhou},
journal = {arXiv preprint arXiv:2605.30313},
year = {2026},
url = {https://arxiv.org/abs/2605.30313}
}
License
Apache-2.0, same as UniLab.
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 unilab_rl-1.0.0.tar.gz.
File metadata
- Download URL: unilab_rl-1.0.0.tar.gz
- Upload date:
- Size: 176.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2ab788a99054b2a75183b08c76c9cb5e70af5a6ed749316106a082ded9fbe16
|
|
| MD5 |
37cf8a88f8b3bf43944e906d9651986d
|
|
| BLAKE2b-256 |
24bad924223d8bccd9714bbe28152a51a12f0ea7f6390584d15fee43f4087a5a
|
File details
Details for the file unilab_rl-1.0.0-py3-none-any.whl.
File metadata
- Download URL: unilab_rl-1.0.0-py3-none-any.whl
- Upload date:
- Size: 221.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6405df72e66c0e3f2d20bf92020ef343f0047e63235088ec36151a4a8e0963f9
|
|
| MD5 |
8724a489be2bc107ec3ffa7f52cdcf04
|
|
| BLAKE2b-256 |
6cb9f6a5e7772ca8f17c458627657eb1c05564b9abeefdce67afea6a9f044e53
|