Git Product home page Git Product logo

practical_rllib_tutorial's Introduction

RLlib documentation: https://docs.ray.io/en/latest/index.html

We are working with Ray 1.10.0

Tutorial Steps

1. Installation

As described in the RLlib documentation https://docs.ray.io/en/master/rllib/index.html

conda create -n rllib python=3.8
conda activate rllib
pip install "ray[rllib]" tensorflow torch

Also

pip install pygame  # so we can visualize what is going on, 2.1.2

2. Setup

Set YOUR_ROOT in your_constants.py

3. Test the Environment

Run demo/demo_your_rllib_env.py You should see your robots running around until they bump into a chicken.

4. Train Your Agent

Run your_rllib_train.py (set NUM_ITERATIONS to 500 for about an hour of training to match the results in the blog post)

Results at your_home_dir/ray_results/YourTrainer

Go into directory

cd your_home_dir/ray_results/YourTrainer
cd YourTrainer_YourEnvironment_?????_00000_0_2022-MM-DD_SS-NN-NN  # fill in with what is there

Run TensorBoard to see the results

tensorboard --logdir ./  

then go to http://localhost:6006/

5. Load and Use the Learned Policy

Put in your run and checkpoint number in demo/demo_after_training.py and run it.

The learned policy doesn't work great. It's just an example, and I haven't played around with the hyperparemeters, but you can tune it for your needs. Hyperparameter tuning is what you spend most of your time on anyway, see https://www.youtube.com/watch?v=yuTkgi7scKo&ab_channel=TheOnion for further understanding.

Note: there is currently a bug in RLlib as of Aug 19, 2022 ray-project/ray#22976; see workaround instructions in demo/demo_after_training.py

6. Look at Your Learned Policy

Put in your run and checkpoint number in demo/demo_look_at_policies.py and run it.

Note: there is currently a bug in RLlib as of Aug 19, 2022 ray-project/ray#22976; see workaround instructions in demo/demo_after_training.py

Credits

Icons from publicdomainvectors.org https://publicdomainvectors.org/

robot https://publicdomainvectors.org/en/free-clipart/Yellow-robot/81372.html

chicken https://publicdomainvectors.org/en/free-clipart/Vector-illustration-of-cartoon-chicken-confused/24675.htm

practical_rllib_tutorial's People

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.