资源算法baby-a3c

baby-a3c

2020-01-10 | |  53 |   0 |   0

Baby A3C: solving Atari environments in 180 lines

Sam Greydanus | October 2017 | MIT License

Results after training on 40M frames:

breakout-v4.gifpong-v4.gifspaceinvaders-v4.gif

Usage

If you're working on OpenAI's Breakout-v4 environment:

  • To train: python baby-a3c.py --env Breakout-v4

  • To test: python baby-a3c.py --env Breakout-v4 --test True

  • To render: python baby-a3c.py --env Breakout-v4 --render True

About

Make things as simple as possible, but not simpler.

Frustrated by the number of deep RL implementations that are clunky and opaque? In this repo, I've stripped a high-performance A3C model down to its bare essentials. Everything you'll need is contained in 180 lines...

  • If you are trying to learn deep RL, the code is compact, readable, and commented

  • If you want quick results, I've included pretrained models

  • If something goes wrong, there's not a mountain of code to debug

  • If you want to try something new, this is a simple and strong baseline

  • Here's a quick intro to A3C that I wrote


Breakout-v4Pong-v4SpaceInvaders-v4
*Mean episode rewards @ 40M frames140 ± 2018.2 ± 1470 ± 30
*Mean episode rewards @ 80M frames190 ± 2017.9 ± 1550 ± 30

*same (default) hyperparameters across all environments

Architecture

self.conv1 = nn.Conv2d(channels, 32, 3, stride=2, padding=1)self.conv2 = nn.Conv2d(32, 32, 3, stride=2, padding=1)self.conv3 = nn.Conv2d(32, 32, 3, stride=2, padding=1)self.conv4 = nn.Conv2d(32, 32, 3, stride=2, padding=1)self.gru = nn.GRUCell(32 * 5 * 5, memsize) # *see belowself.critic_linear, self.actor_linear = nn.Linear(memsize, 1), nn.Linear(memsize, num_actions)

*we use a GRU cell because it has fewer params, uses one memory vector instead of two, and attains the same performance as an LSTM cell.

Environments that work

(Use pip freeze to check your environment settings)

  • Mac OSX (test mode only) or Linux (train and test)

  • Python 3.6

  • NumPy 1.13.1+

  • Gym 0.9.4+

  • SciPy 0.19.1 (just on two lines -> workarounds possible)

  • PyTorch 0.4.0

Known issues

  • I recently ported this code to Python 3.6 / PyTorch 0.4. If you want to run on Python 2.7 / PyTorch 0.2, then look at one of my earlier commits to this repo (there are different pretrained models as well)


上一篇:a3c_continuous

下一篇:NoisyNet-A3C

用户评价
全部评价

热门资源

  • Keras-ResNeXt

    Keras ResNeXt Implementation of ResNeXt models...

  • seetafaceJNI

    项目介绍 基于中科院seetaface2进行封装的JAVA...

  • spark-corenlp

    This package wraps Stanford CoreNLP annotators ...

  • capsnet-with-caps...

    CapsNet with capsule-wise convolution Project ...

  • inferno-boilerplate

    This is a very basic boilerplate example for pe...