Skip to main content

Yet another zoo of (Deep) Reinforcment Learning methods in Python using PyTorch

Project description

ai-traineree

DocStatus Build Status codecov

The intention is to have a zoo of Deep Reinforcment Learning methods and showcasing their application on some environments.

Read more in the doc: ReadTheDocs AI-Traineree.

Why another?

The main reason is the implemention philosophy. We strongly believe that agents should be emerged in the environment and not the other way round. Majority of the popular implementations pass environment instance to the agent as if the agent was the focus point. This might ease implementation of some algorithms but it isn't representative of the world; agents want to control the environment but that doesn't mean they can/should.

That, and using PyTorch instead of Tensorflow or JAX.

Quick start

To get started with training your RL agent you need three things: an agent, an environment and a runner. Let's say you want to train a DQN agent on OpenAI CartPole-v1:

from ai_traineree.agents.dqn import DQNAgent
from ai_traineree.env_runner import EnvRunner
from ai_traineree.tasks import GymTask

task = GymTask('CartPole-v1)
agent = DQNAgent(task.state_size, task.action_size)
env_runner = EnvRunner(task, agent)

scores = env_runner.run()

or execute one of provided examples

>  python -m examples.cart_dqn

That's it.

Installation

There isn't currently any installation mechanism. Git clone is expected if you want to play yourself. Coming updates include pip package and installation instructions.

As usual with Python, the expectation is to have own virtual environment and then pip install requirements. For example,

> python -m venv .venv
> git clone git@github.com:laszukdawid/ai-traineree.git
> source .venv/bin/activate
> python setup.py install

Current state

Playing gym

One way to improve learning speed is to simply show them how to play or, more researchy/creepy, provide a proper seed. This isn't a general rule, since some algorithms train better without any human interaction, but since you're on GitHub... that's unlikely your case. Currently there's a script interact.py which uses OpenAI Gym's play API to record moves and AI Traineree to store them in a buffer. Such buffers can be loaded by agents on initiation.

This is just a beginning and there will be more work on these interactions.

Requirement: Install pygame.

Agents

Short Progress Link Full name Doc
DQN Implemented DeepMind, Nature Deep Q-learning Network Doc
DDPG Implemented arXiv Deep Deterministic Policy Gradient Doc
D4PG Implemented arXiv Distributed Distributional Deterministic Policy Gradients Doc
TD3 Implemented arXiv Twine Delayed Deep Deterministic policy gradient Doc
PPO Implemented arXiv Proximal Policy Optimization Doc
SAC Implemented arXiv Soft Actor Critic Doc
TRPO arXiv Trust Region Policy Optimization
RAINBOW Implemented arXiv DQN with a few improvements Doc

Multi agents

We provide both Multi Agents agents entities and means to execute them against supported (below) environements. However, that doesn't mean one can be used without the other.

Short Progress Link Full name Doc
IQL Implemented Independent Q-Learners Doc
MADDPG Implemented arXiv Multi agent DDPG Doc

Loggers

Supports using Tensorboard (via PyTorch's SummaryWriter) and Neptune to display metrics. Wrappers are provided as TensorboardLogger and NeptuneLogger.

Note: In order to use Neptune one needs to install neptune-client (pip install neptune-client).

Environments

Name Progress Link
OpenAI Gym - Classic Done
OpenAI Gym - Atari Done
OpenAI Gym - MuJoCo Not interested.
PettingZoo Initial support Page / GitHub
Unity ML Somehow supported. Page
MAME Linux emulator Interested. Official page

Development

Name Progress
Pip package Not started
CD Not started
More multi agent methods Research
Test coverage > 80% Tested ~40%, Covered 85%

There are other potential things on the roadmap but haven't dedicated to them yet.

Should I focus on something specificallly? Let me know by leaving opening a feature request issue or contacting through ai-traineree@dawid.lasz.uk.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai-traineree-0.0.3.tar.gz (61.9 kB view details)

Uploaded Source

Built Distribution

ai_traineree-0.0.3-py3-none-any.whl (88.2 kB view details)

Uploaded Python 3

File details

Details for the file ai-traineree-0.0.3.tar.gz.

File metadata

  • Download URL: ai-traineree-0.0.3.tar.gz
  • Upload date:
  • Size: 61.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.5

File hashes

Hashes for ai-traineree-0.0.3.tar.gz
Algorithm Hash digest
SHA256 e77f793a6b7e7743a35365f7411936a8cf8c212e09ff15f682218a6652601453
MD5 ecafba19204802df22e8ee9a05e688fc
BLAKE2b-256 2d82e9212692e3bd3c985fa65f2ddedcc44b1ab4e1bf443a6e5d2a9c9710428e

See more details on using hashes here.

File details

Details for the file ai_traineree-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: ai_traineree-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 88.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.5

File hashes

Hashes for ai_traineree-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 88e0b9c5e89b860d3217e84866d027133de906ead27d5cb790767cf6768a1257
MD5 451c892b836e16c9ec369134d3e533c8
BLAKE2b-256 978f8c275d384fbd94e6b5551b8c3dd5c67faf77aa873d2623cc31c07a815f07

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page