JoyRL

December 19, 2024 · View on GitHub

PyPI GitHub issues GitHub stars GitHub forks GitHub license

JoyRL is a parallel reinforcement learning library based on PyTorch and Ray. Unlike existing RL libraries, JoyRL is helping users to release the burden of implementing algorithms with tough details, unfriendly APIs, and etc. JoyRL is designed for users to train and test RL algorithms with only hyperparameters configuration, which is mush easier for beginners to learn and use. Also, JoyRL supports plenties of state-of-art RL algorithms including RLHF(core of ChatGPT)(See algorithms below). JoyRL provides a modularized framework for users as well to customize their own algorithms and environments.

Install

⚠️ Note that donot install JoyRL through any mirror image!!!

# you need to install Anaconda first
conda create -n joyrl python=3.10
conda activate joyrl
pip install -U joyrl

Torch install:

# CPU
pip install torch==2.2.1 torchvision==0.17.1 torchaudio==2.2.1
# CUDA 11.8
pip install torch==2.2.1 torchvision==0.17.1 torchaudio==2.2.1 --index-url https://download.pytorch.org/whl/cu118
# CUDA 12.1
pip install torch==2.2.1 torchvision==0.17.1 torchaudio==2.2.1 --index-url https://download.pytorch.org/whl/cu121

Usage

Quick Start

the following presents a demo to use joyrl. As you can see, first create a yaml file to config hyperparameters, then run the command as below in your terminal. That's all you need to do to train a DQN agent on CartPole-v1 environment.

joyrl --yaml ./presets/ClassControl/CartPole-v1/CartPole-v1_DQN.yaml

or you can run the following code in your python file.

import joyrl
if __name__ == "__main__":
    print(joyrl.__version__)
    yaml_path = "./presets/ClassControl/CartPole-v1/CartPole-v1_DQN.yaml"
    joyrl.run(yaml_path = yaml_path)

Documentation

More tutorials and API documentation are hosted on JoyRL docs or JoyRL 中文文档.

Algorithms

NameReferenceAuthorNotes
Q-learningRL introductionjohnjim0816
SarsaRL introductionjohnjim0816
DQNDQN Paperjohnjim0816
Double DQNDoubleDQN Paperjohnjim0816
Dueling DQNDuelingDQN Paperjohnjim0816
NoisyDQNNoisyDQN Paperjohnjim0816
CategoricalDQNCategoricalDQN Paperjohnjim0816
DDPGDDPG Paperjohnjim0816
TD3TD3 Paperjohnjim0816
A2C/A3CA3C Paperjohnjim0816
PPOPPO Paperjohnjim0816
SoftQSoftQ Paperjohnjim0816

Why JoyRL?

RL PlatformGitHub Stars# of Alg. (1)Custom EnvAsync TrainingRNN SupportMulti-Head ObservationBackend
BaselinesGitHub stars9:heavy_check_mark: (gym):x::heavy_check_mark::x:TF1
Stable-BaselinesGitHub stars11:heavy_check_mark: (gym):x::heavy_check_mark::x:TF1
Stable-Baselines3GitHub stars7:heavy_check_mark: (gym):x::x::heavy_check_mark:PyTorch
Ray/RLlibGitHub stars16:heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:TF/PyTorch
SpinningUpGitHub stars6:heavy_check_mark: (gym):x::x::x:PyTorch
DopamineGitHub stars7:x::x::x::x:TF/JAX
ACMEGitHub stars14:heavy_check_mark: (dm_env):x::heavy_check_mark::heavy_check_mark:TF/JAX
keras-rlGitHub stars7:heavy_check_mark: (gym):x::x::x:Keras
cleanrlGitHub stars9:heavy_check_mark: (gym):x::x::x:poetry
rlpytGitHub stars11:x::x::heavy_check_mark::heavy_check_mark:PyTorch
ChainerRLGitHub stars18:heavy_check_mark: (gym):x::heavy_check_mark::x:Chainer
TianshouGitHub stars20:heavy_check_mark: (Gymnasium):x::heavy_check_mark::heavy_check_mark:PyTorch
JoyRLGitHub stars12:heavy_check_mark: (Gymnasium):heavy_check_mark::heavy_check_mark::heavy_check_mark:PyTorch

Here are some other highlghts of JoyRL:

  • Provide a series of Chinese courses JoyRL Book (with the English version in progress), suitable for beginners to start with a combination of theory

Contributors

pic
John Jim

Peking University

pic
Qi Wang

Shanghai Jiao Tong University

pic
Yiyuan Yang

University of Oxford