Giter Site home page Giter Site logo

shivamswarnkar / mario-dqn-agent Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 5.81 MB

Implementation of DQN in Pytorch to train + play Mario Super Bros. Easily change model structures and reward functions to understand agent behavior.

License: MIT License

Python 100.00%

mario-dqn-agent's Introduction

Mario-DQN-Agent

Pytorch implementation of Deep Q-Network to play the classic Mario-Bros.

Demo for Mario Demo for Mario Demo for Mario Demo for Mario

Note: I'll add some better trained models by 15th Nov 2019

How to Use

Train

Train from scratch with default params.

$ python train.py

To resume traininng from a checkpoint, just give path to policy or target network

$ python train.py --policyNet PATH_TO_POLICY_NET

Training Parameters

- policyNet=None; 		Path to pretrained/checkpoint of Policy network file. If not provided, training will start from scratch
- targetNet=None; 		Path to pretrained/checkpoint of Target network file. If not provided, training will start from scratch.
- batch_size=128; 		Batch Size for DQN training
- gamma=0.009; 			Gamma Value for Q-learning
- eps_start=0.9; 		EPS_START Value for Q-learning
- eps_end=0.05;			EPS_END value for Q-learning
- eps_decay=200; 		EPSE_DECAY value for Q-learning
- num_episodes=50; 		Number of Episodes for training
- target_update=10; 	Sync Target and Policy net every n epoisod
- ngpu=1; 				Number of GPUs to use
- save_every=5; 		Make a checkpoint after each n epochs
- output_targetNet='checkpoints/targetNet.pth'; Path where Target model will be saved/checkpoint
- output_policyNet='checkpoints/policyNet.pth'; Path where Policy model will be saved/checkpoint

Play Mario with DQN

Play with randomly initialize DQN

$ python play.py

Play with Trained DQN

$ python play.py --targetNet PATH_TO_TARGET_NET

Parameters

- targetNet =None; Path to pretrained/checkpoint of target network file which will be used to play Mario.

Demo

Followings are different models trained with different Hyper Params playing Mario

Episode 10

Demo for Mario

Episode 30

Demo for Mario

Episode 50

Demo for Mario

Episode 60

Demo for Mario

mario-dqn-agent's People

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.