Giter VIP home page Giter VIP logo

a2c_gvgai's Introduction

A2C for GVG-AI

Install

  1. Install gym
  2. Install gvgai-gym
  3. Install baselines
  4. Run sh lib/gvgai_generator/install.sh to install the level generator.
  5. Run pip install brewer2mpl

How to Train

usage: a2c.py [-h] [--policy {cnn,lstm,lnlstm}]
              [--lrschedule {constant,linear}] [--num-envs NUM_ENVS]
              [--num-timesteps NUM_TIMESTEPS] [--game GAME] [--seed SEED]
              [--save-interval SAVE_INTERVAL] [--level LEVEL] [--fixed]
              [--selector {None,random-all,random-0123,random-0,random-1,random-2,random-3,random-4,random-5,random-6,random-7,random-8,random-9,random-10,pcg-random,pcg-random-0,pcg-random-1,pcg-random-2,pcg-random-3,pcg-random-4,pcg-random-5,pcg-random-6,pcg-random-7,pcg-random-8,pcg-random-9,pcg-random-10,pcg-progressive}]

optional arguments:
  -h, --help            show this help message and exit
  --policy {cnn,lstm,lnlstm}
                        Policy architecture (default: cnn)
  --lrschedule {constant,linear}
                        Learning rate schedule (default: constant)
  --num-envs NUM_ENVS   Number of environments/workers to run in parallel
                        (default=12) (default: 12)
  --num-timesteps NUM_TIMESTEPS  
                        Number of timesteps to train the model
  --game GAME           Game name (default=zelda) (default: zelda)
  --seed SEED           RNG seed (default: 0)
  --save-interval SAVE_INTERVAL
  --resume EXP_ID       The experiment id to resume (default: None)
                        Model saving interval in steps (default: 1000000)
  --level LEVEL         Id of existing GVG-AI level (integer) to train on (default: 0)
  --fixed               A hack to enable a selector to always use the first generated level. Should be removed asap (default: False)
  --selector {
      None,                       Will use a fixed level determined by the level argument
      random-all,                 Samples levels from the existing GVG-AI levels
      random-0123,                Samples levels from the existing GVG-AI levels, except level 4
      random-<difficulty>,        Samples levels from a pre-generated set of 10 levels with a difficulty level of <difficulty> from 0 to 10
      pcg-random,                 Generates levels with random parameters
      pcg-random-<difficulty>,    Generates levels with a difficulty level of <difficulty> from 0 to 10
      pcg-progressive             Generates levels with increasing or decreasing difficulty level if games are won or lost.
    }
                        Level selector to use in training - will ignore the
                        level argument if set (default: None) (default: None)

Examples:

python a2c.py --game aliens --level 4
python a2c.py --game boulderdash --selector pcg-random-3
python a2c.py --game zelda --selector pcg-random-3 --resume 90fe9d4c-56e4-11e8-a58c-6c4008b68262 --num-timesteps 40000000

How to evaluate

eval.py will evaluate all models in an experiment folder.

usage: eval.py [-h] [--policy {cnn,lstm,lnlstm}] [--runs RUNS]
               [--num-envs NUM_ENVS] [--game GAME] [--seed SEED]
               [--experiment-name EXPERIMENT_NAME] [--level LEVEL]
               [--level-selector {None,random-all,random-0123,random-0,random-1,random-2,random-3,random-4,random-5,random-6,random-7,random-8,random-9,random-10,pcg-random,pcg-random-0,pcg-random-1,pcg-random-2,pcg-random-3,pcg-random-4,pcg-random-5,pcg-random-6,pcg-random-7,pcg-random-8,pcg-random-9,pcg-random-10,pcg-progressive}]
               [--render]

optional arguments:
  -h, --help            show this help message and exit
  --policy {cnn,lstm,lnlstm}
                        Policy architecture (default: cnn)
  --runs RUNS           Number of runs for each model (default: 100)
  --num-envs NUM_ENVS   Number of environments/workers to run in parallel (default: 12)
  --game GAME           Game name (default=zelda) (default: zelda)
  --seed SEED           RNG seed (default: 0)
  --experiment-name EXPERIMENT_NAME
                        Name of the experiments to evaluate (name of subfolder in .results/) e.g. zelda-ls-pcg-random (default: zelda-lvl-0)
  --level LEVEL         Fixed existing GVG-AI level to test on (default: 0)
  --selector {...}      Same as a2c.py. Will evaluate on levels selected by the selector. Will ignore the level argument.
  --render              Render screen (default: False) (default: False)

Examples:

python eval.py --game aliens --experiment-name zelda-lvl-0 --level 2
python eval.py --game aliens --experiment-name zelda-lvl-0 --selector pcg-random

Plot

Simply run the following to produce plots for all experiments in .results/

python plot.py

List experiments

python list.py

Transfer Experiments between Servers

You can either:

  1. Move a subfolder within .results/ from server A to .resuts/ on server B. This will copy all experiments of that type.
  2. Move individual folders within ./results/<experiments-name>/models/ and ./results/<experiments-name>/logs/ from A to B.

a2c_gvgai's People

Contributors

njustesen avatar pbontrager avatar rubenrtorrado avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.