Skip to content

french-ai/reinforcement

Repository files navigation

BlobRL : Reinforcement Learning library with Pytorch

Pypi Read the Docs Build Status CodeFactor Codecov Discord License

BlobRl is a modular library for reinforcement learning which works on pytorch.

Installation

Pytorch

For installing pytorch follow Quick Start Locally for your config.

BlobRL

Install blobrl

  • to use it:
pip install blobrl
  • to use it on notebook:
pip install blobrl[notebook]
  • to help development:
pip install blobrl[dev]

Get Started

Initialize environment

import gym
env = gym.make("CartPole-v1")

Initialize agent

from blobrl.agents import AgentRandom
action_space = env.action_space
observation_space = env.observation_space
agent = AgentRandom(observation_space=observation_space, action_space=action_space)

Train

Create Trainer

from blobrl import Trainer
trainer = Trainer(environment=env, agent=agent, log_dir="./logs")

Start training:

trainer.train(max_episode=100, nb_evaluation=4, render=True)

Watch metrics

Visualize training and evaluation metrics:

tensorboard --logdir logs

Environments

We will use GYM environments for moments.

Watch TODO for environments in coming.

Agents

Agent implemented:

  • AgentConstant, this agent choice one random action on start and will take her all next time
  • AgentRandom, this agent choice one random action each time
  • DQN, Deep Q Learning (Mnih et al., 2013)
  • DoubleDQN, (van Hasselt et al., 2016)
  • DuelingDQN, (Wang et al., 2016)
  • CategoricalDQN, (Bellamare et al., 2017)

Examples

You can find all examples here

Results

CartPoleExemple.gif

You can see more results and analysis