/ Machine Learning

Generic reinforcement learning codebase in TensorFlow

Generic reinforcement learning codebase in TensorFlow

Reinforcement Learning Codebase

Modular codebase for reinforcement learning models training, testing and visualization.

Example for recorded envrionment on various RL agents.

MountainCar-v0 Pendulum-v0 VideoPinball-v0 Tennis-v0
mountaincar pendulum pinball tennis


  • Run setup scripts to install all dependencies and environments

Quick Start

# start training
python train.py --sys ... --hparams ... --output_dir ...
# run tensorboard
tensorboard --logdir ...
# test agnet
python train.py --sys ... --hparams ... --output_dir ... --training False --render True


Check init_flags(), defaults.py for default hyper-parameters, and check https://github.com/for-ai/rl/blob/master/rl/hparams/dqn.py agent specific hyper-parameters examples.

  • hparams: Which hparams to use, defined under rl/hparams
  • sys: Which system environment to use.
  • env: Which RL environment to use.
  • output_dir: The directory for model checkpoints and TensorBoard summary.
  • train_steps:, Number of steps to train the agent.
  • test_episodes: Number of episodes to test the agent.
  • eval_episodes: Number of episodes to evaluate the agent.
  • training: train or test agent.
  • copies: Number of independent training/testing runs to do.
  • render: Render game play.
  • record_video: Record game play.
  • num_workers, number of workers.