Giter Site home page Giter Site logo

tutorial's Introduction

Ray Tutorial

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.
  2. Install Jupyter with pip install jupyter. Verify that you can start a Jupyter notebook with the command jupyter-notebook.
  3. Install Ray by running pip install ray. Verify that you can run

    import ray
    ray.init()

    in a Python interpreter.

  4. Clone the tutorial repository with

    git clone https://github.com/ray-project/tutorial.git
  5. Install the following additional dependencies.

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

    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.

Exercises

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

cd tutorial/exercises
jupyter-notebook

Instructions are written in each file. To do each exercise, first run all of the cells in the Jupyter notebook. 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: Pass object IDs into tasks to construct dependencies between tasks.

Exercise 4: Call remote functions from within remote functions.

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

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

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

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: 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.

RL Exercises

Each file in rl_exercises/rl_exercise*.ipynb is a separate Jupyter notebook. These exercises should be done in order. They can be opened in a Jupyter notebook by running the following commands.

cd tutorial/rl_exercises
jupyter-notebook

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.