Coder Social home page Coder Social logo

ppo-pytorch's Introduction

ppo-pytorch

PPO in pytorch version.

We run multiple episodes with the same policy, and create an experience replay buffer out of trajectories in these episodes to perform on-policy policy gradient updates using PPO. We clear the replay buffer from the last run before we start another run of multiple episodes.

Set up Python environment

Run

virtualenv -p /usr/bin/python3 ppoenv
source ppoenv/bin/activate
pip install -r requirements.txt

or

virtualenv -p /usr/bin/python3 ppoenv
source ppoenv/bin/activate
pip install gym==0.18.0
pip install torch
pip install tqdm
pip install tensorboard

Train and evaluate agent in RL (cartpole).

source ppoenv/bin/activate
python train.py

Check training progress by running

source ppoenv/bin/activate
tensorboard --logdir results/

After training is complete, find [SAVED_LOG] in results/ (e.g., 20221023_172239). To evaluate without visualization, run

source ppoenv/bin/activate
python eval.py --log [SAVED_LOG]

To evaluate with visualization, run

source ppoenv/bin/activate
python eval.py --log [SAVED_LOG] --visualize

If you want to evaluate on a checkpoint at a specific episode (e.g., 1000), run

source ppoenv/bin/activate
python eval.py --log [SAVED_LOG] --visualize --training_episodes 1000

Credits

Borrowed code from ikostrikov/pytorch-a2c-ppo-acktr-gail, vita-epfl/CrowdNav, and agrimgupta92/sgan.

ppo-pytorch's People

Contributors

tedhuang96 avatar

Stargazers

 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.