All Projects → Omegastick → Pytorch Cpp Rl

Omegastick / Pytorch Cpp Rl

Licence: mit
PyTorch C++ Reinforcement Learning

Programming Languages

cpp
1120 projects
cplusplus
227 projects

Projects that are alternatives of or similar to Pytorch Cpp Rl

Deeprl Tutorials
Contains high quality implementations of Deep Reinforcement Learning algorithms written in PyTorch
Stars: ✭ 748 (+111.9%)
Mutual labels:  reinforcement-learning, ppo, actor-critic
Pytorch A2c Ppo Acktr Gail
PyTorch implementation of Advantage Actor Critic (A2C), Proximal Policy Optimization (PPO), Scalable trust-region method for deep reinforcement learning using Kronecker-factored approximation (ACKTR) and Generative Adversarial Imitation Learning (GAIL).
Stars: ✭ 2,632 (+645.61%)
Mutual labels:  reinforcement-learning, ppo, actor-critic
Torch Ac
Recurrent and multi-process PyTorch implementation of deep reinforcement Actor-Critic algorithms A2C and PPO
Stars: ✭ 70 (-80.17%)
Mutual labels:  reinforcement-learning, ppo, actor-critic
Pytorch Drl
PyTorch implementations of various Deep Reinforcement Learning (DRL) algorithms for both single agent and multi-agent.
Stars: ✭ 233 (-33.99%)
Mutual labels:  reinforcement-learning, ppo, actor-critic
Reinforcement Learning With Tensorflow
Simple Reinforcement learning tutorials, 莫烦Python 中文AI教学
Stars: ✭ 6,948 (+1868.27%)
Mutual labels:  reinforcement-learning, ppo, actor-critic
Mario rl
Stars: ✭ 60 (-83%)
Mutual labels:  reinforcement-learning, ppo, actor-critic
Run Skeleton Run
Reason8.ai PyTorch solution for NIPS RL 2017 challenge
Stars: ✭ 83 (-76.49%)
Mutual labels:  reinforcement-learning, ppo, actor-critic
Pytorch sac
PyTorch implementation of Soft Actor-Critic (SAC)
Stars: ✭ 174 (-50.71%)
Mutual labels:  reinforcement-learning, actor-critic
Machin
Reinforcement learning library(framework) designed for PyTorch, implements DQN, DDPG, A2C, PPO, SAC, MADDPG, A3C, APEX, IMPALA ...
Stars: ✭ 145 (-58.92%)
Mutual labels:  reinforcement-learning, ppo
Adeptrl
Reinforcement learning framework to accelerate research
Stars: ✭ 173 (-50.99%)
Mutual labels:  reinforcement-learning, actor-critic
Explorer
Explorer is a PyTorch reinforcement learning framework for exploring new ideas.
Stars: ✭ 54 (-84.7%)
Mutual labels:  actor-critic, ppo
A2c
A Clearer and Simpler Synchronous Advantage Actor Critic (A2C) Implementation in TensorFlow
Stars: ✭ 169 (-52.12%)
Mutual labels:  reinforcement-learning, actor-critic
Minimalrl
Implementations of basic RL algorithms with minimal lines of codes! (pytorch based)
Stars: ✭ 2,051 (+481.02%)
Mutual labels:  reinforcement-learning, ppo
Rl Collision Avoidance
Implementation of the paper "Towards Optimally Decentralized Multi-Robot Collision Avoidance via Deep Reinforcement Learning"
Stars: ✭ 125 (-64.59%)
Mutual labels:  reinforcement-learning, ppo
Reinforcement Learning
Minimal and Clean Reinforcement Learning Examples
Stars: ✭ 2,863 (+711.05%)
Mutual labels:  reinforcement-learning, actor-critic
Reinforcement Learning
Deep Reinforcement Learning Algorithms implemented with Tensorflow 2.3
Stars: ✭ 61 (-82.72%)
Mutual labels:  actor-critic, ppo
Deep-Reinforcement-Learning-With-Python
Master classic RL, deep RL, distributional RL, inverse RL, and more using OpenAI Gym and TensorFlow with extensive Math
Stars: ✭ 222 (-37.11%)
Mutual labels:  actor-critic, ppo
Rlgraph
RLgraph: Modular computation graphs for deep reinforcement learning
Stars: ✭ 272 (-22.95%)
Mutual labels:  reinforcement-learning, ppo
Drq
DrQ: Data regularized Q
Stars: ✭ 268 (-24.08%)
Mutual labels:  reinforcement-learning, actor-critic
Deep reinforcement learning course
Implementations from the free course Deep Reinforcement Learning with Tensorflow and PyTorch
Stars: ✭ 3,232 (+815.58%)
Mutual labels:  ppo, actor-critic

CppRl - PyTorch C++ Reinforcement Learning

Linux build status Windows build status

LunarLander-v2 Above: results on LunarLander-v2 after 60 seconds of training on my laptop

CppRl is a reinforcement learning framework, written using the PyTorch C++ frontend.

It is very heavily based on Ikostrikov's wonderful pytorch-a2c-ppo-acktr-gail. You could even consider this a port. The API and underlying algorithms are almost identical (with the necessary changes involved in the move to C++).

It also contains an implementation of a simple OpenAI Gym server that communicates via ZeroMQ to test the framework on Gym environments.

CppRl aims to be an extensible, reasonably optimized, production-ready framework for using reinforcement learning in projects where Python isn't viable. It should be ready to use in desktop applications on user's computers with minimal setup required on the user's side.

Motivation

At the time of writing, there are no general-use reinforcement learning frameworks for C++. I needed one for a personal project, and the PyTorch C++ frontend had recently been released, so I figured I should make one.

Features

  • Implemented algorithms:
    • A2C
    • PPO
  • Recurrent policies (GRU based)
  • Continuous control
  • Discrete control
  • Cross-platform compatibility (tested on Windows 10, Ubuntu 16.04, and Ubuntu 18.04)
  • Solid test coverage
  • Decently optimized (always open to pull requests improving optimization though)

Example

An example that uses the included OpenAI Gym server is provided in example. It can be run as follows: Terminal 1:

./launch_gym_server.py

Terminal 2:

build/example/gym_server

It takes about 60 seconds to train an agent to 200 average reward on my laptop (i7-8550U processor).

The environment and hyperparameters can be set in example/gym_client.cpp.

Note: The Gym server and client aren't very well optimized, especially when it comes to environments with image observations. There are a few extra copies necessitated by using an inter-process communication system, and then gym_client.cpp has an extra copy or two to turn the observations into PyTorch tensors. This is why the performance isn't that good when compared with Python libraries running Gym environments.

Building

CMake is used for the build system. Most dependencies are included as submodules (run git submodule update --init --recursive to get them). Libtorch has to be installed seperately.

Linux

cd pytorch-cpp-rl
mkdir build && cd build
cmake ..
make -j4

Windows

cd pytorch-cpp-rl
mkdir build && cd build
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_PREFIX_PATH=C:/path/to/libtorch ..
cmake --build . --config Release

Before running, make sure to add libtorch/lib to your PATH environment variable.

Windows performance is about 75% that of Linux's at the moment. I'm looking into how to speed things up.

Testing

You can run the tests with build/cpprl_tests (build/Release/cpprl_tests.exe on Windows).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].