Skip to content
No description, website, or topics provided.
Jupyter Notebook JavaScript Python HTML CSS
Branch: master
Clone or download

Latest commit

holdenk [MINOR] Update jupyter command reference to match (#173)
* With a pip installed jupyter in py3 I don't get the jupyter-lab command, I get the jupyter-notebook command, jupyter==1.0.0

* 2nd place we assume jupyter-lab
Latest commit 924b04c Feb 9, 2020


Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Make it possible to run tutorial examples with projects (#142) Oct 6, 2019
exercises Wrong argument in ray.wait API (#137) Jan 20, 2020
rllib_exercises Close: #168 (#170) Dec 2, 2019
solutions Add answer keys (#155) Oct 13, 2019
tune_exercises Add colab links. Dec 2, 2019
utilities Integrate model into news reader serving (#113) Apr 14, 2019
.gitignore Install requests library in exercise02-Task_Dependencies (#169) Oct 23, 2019
README.rst [MINOR] Update jupyter command reference to match (#173) Feb 9, 2020
environment.yml Update global state and Ray version. (#138) Sep 10, 2019
postBuild install pong_py by default Apr 16, 2019 Fix timeline and various fixes (#116) Apr 16, 2019


Ray Tutorial

Try Ray on Google Colab

Try the Ray tutorials online using Google Colab:

Try Tune on Google Colab

Tuning hyperparameters is often the most expensive part of the machine learning workflow. Ray Tune is built to address this, demonstrating an efficient and scalable solution for this pain point.

Exercise 1 covers basics of using Tune - creating your first training function and using Tune. This tutorial uses Keras.

Tune Tutorial

Exercise 2 covers Search algorithms and Trial Schedulers. This tutorial uses PyTorch.

Tune Tutorial

Exercise 3 covers using Population-Based Training (PBT) and uses the advanced Trainable API with save and restore functions and checkpointing.

Tune Tutorial

Try Ray on Binder

Try the Ray tutorials online on Binder. Note that Binder will use very small machines, so the degree of parallelism will be limited.

Local Setup

  1. Make sure you have Python installed (we recommend using the Anaconda Python distribution). Ray works with both Python 2 and Python 3. If you are unsure which to use, then use Python 3.

    If not using conda, continue to step 2.

    If using conda, you can then run the following commands and skip the next 4 steps:

    git clone
    cd tutorial
    conda env create -f environment.yml
    conda activate ray-tutorial
  2. Install Jupyter with pip install jupyter. Verify that you can start Jupyter lab with the command jupyter-lab or jupyter-notebook.

  3. Install Ray by running pip install -U ray. Verify that you can run

    import ray

    in a Python interpreter.

  4. Clone the tutorial repository with

    git clone
  5. Install the following additional dependencies.

    pip install modin
    pip install tensorflow
    pip install gym
    pip install scipy
    pip install opencv-python
    pip install bokeh
    pip install ipywidgets==6.0.0
    pip install keras

    Verify that you can run import tensorflow and import gym in a Python interpreter.

    Note: If you have trouble installing these Python modules, note that almost all of the exercises can be done without them.

  6. If you want to run the pong exercise (in rl_exercises/rl_exercise05.ipynb), you will need to do pip install utilities/pong_py.


Each file exercises/exercise*.ipynb is a separate exercise. They can be opened in Jupyter lab by running the following commands.

cd tutorial/exercises

If you don't have jupyter-lab, try jupyter-notebook. If it asks for a password, just hit enter.

Instructions are written in each file. To do each exercise, first run all of the cells in Jupyter lab. Then modify the ones that need to be modified in order to prevent any exceptions from being raised. Throughout these exercises, you may find the Ray documentation helpful.

Exercise 1: Define a remote function, and execute multiple remote functions in parallel.

Exercise 2: Execute remote functions in parallel with some dependencies.

Exercise 3: Call remote functions from within remote functions.

Exercise 4: Use actors to share state between tasks. See the documentation on using actors.

Exercise 5: Pass actor handles to tasks so that multiple tasks can invoke methods on the same actor.

Exercise 6: Use ray.wait to ignore stragglers. See the documentation for wait.

Exercise 7: Use ray.wait to process tasks in the order that they finish. See the documentation for wait.

Exercise 8: Use ray.put to avoid serializing and copying the same object into shared memory multiple times.

Exercise 9: Specify that an actor requires some GPUs. For a complete example that does something similar, you may want to see the ResNet example.

Exercise 10: Specify that a remote function requires certain custom resources. See the documentation on custom resources.

Exercise 11: Extract neural network weights from an actor on one process, and set them in another actor. You may want to read the documentation on using Ray with TensorFlow.

Exercise 12: Pass object IDs into tasks to construct dependencies between tasks and perform a tree reduce.

More In-Depth Examples

Sharded Parameter Server: This exercise involves implementing a parameter server as a Ray actor, implementing a simple asynchronous distributed training algorithm, and sharding the parameter server to improve throughput.

Speed Up Pandas: This exercise involves using Modin to speed up your pandas workloads.

MapReduce: This exercise shows how to implement a toy version of the MapReduce system on top of Ray.

RL Exercises

The exercises in rl_exercises/rl_exercise*.ipynb should be done in order. They can be opened in Jupyter lab by running the following commands.

cd tutorial/rl_exercises

Exercise 1: Introduction to Markov Decision Processes.

Exercise 2: Derivative free optimization.

Exercise 3: Introduction to proximal policy optimization (PPO).

Exercise 4: Introduction to asynchronous advantage actor-critic (A3C).

Exercise 5: Train a policy to play pong using RLlib. Deploy it using actors, and play against the trained policy.

You can’t perform that action at this time.