Skip to content

AdamStelmaszczyk/rl-tutorial

Repository files navigation

Build Status

Solving Mountain Car environment with TensorFlow & Keras implementation of DQN.
For similar code solving some Atari games, look here.


Install

  1. Clone this repo: git clone https://github.com/AdamStelmaszczyk/rl-tutorial.git.
  2. Install conda for dependency management.
  3. Create tutorial conda environment: conda create -n tutorial python=3.6.5 -y.
  4. Activate tutorial conda environment: source activate tutorial. All the following commands should be run in the activated tutorial environment.
  5. Install basic dependencies: pip install -r requirements.txt.

There is an automatic build on Travis which does the same.

Run

python run.py --help

usage: run.py [-h] [--eval] [--model MODEL] [--name NAME] [--seed SEED]
              [--test] [--view]

optional arguments:
  -h, --help     show this help message and exit
  --eval         run evaluation with log only (default: False)
  --images       save images during evaluation (default: False)
  --model MODEL  model filename to load (default: None)
  --name NAME    name for saved files (default: 06-08-21-53)
  --seed SEED    pseudo random number generator seed (default: None)
  --test         run tests (default: False)
  --view         view the model playing the game (default: False)

Generate GIFs

  1. Generate images: python run.py --model 06-08-18-42-log/06-08-18-42-200000.h5 --images.
  2. We will use convert tool, which is part of ImageMagick, here are the installation instructions.
  3. Convert images from episode 1 to GIF: convert -layers optimize-frame 1_*.png 1.gif

Uninstall

  1. Deactivate conda environment: source deactivate.
  2. Remove tutorial conda environment: conda env remove -n tutorial -y.

Links