Skip to main content

A system for parallel and distributed Python that unifies the ML ecosystem.

Project description

https://github.com/ray-project/ray/raw/master/doc/source/images/ray_header_logo.png https://travis-ci.com/ray-project/ray.svg?branch=master https://readthedocs.org/projects/ray/badge/?version=latest

Ray is a fast and simple framework for building and running distributed applications.

Ray is packaged with the following libraries for accelerating machine learning workloads:

  • Tune: Scalable Hyperparameter Tuning

  • RLlib: Scalable Reinforcement Learning

  • RaySGD: Distributed Training Wrappers

Install Ray with: pip install ray. For nightly wheels, see the Installation page.

NOTE: As of Ray 0.8.1, Python 2 is no longer supported.

Quick Start

Execute Python functions in parallel.

import ray
ray.init()

@ray.remote
def f(x):
    return x * x

futures = [f.remote(i) for i in range(4)]
print(ray.get(futures))

To use Ray’s actor model:

import ray
ray.init()

@ray.remote
class Counter(object):
    def __init__(self):
        self.n = 0

    def increment(self):
        self.n += 1

    def read(self):
        return self.n

counters = [Counter.remote() for i in range(4)]
[c.increment.remote() for c in counters]
futures = [c.read.remote() for c in counters]
print(ray.get(futures))

Ray programs can run on a single machine, and can also seamlessly scale to large clusters. To execute the above Ray script in the cloud, just download this configuration file, and run:

ray submit [CLUSTER.YAML] example.py --start

Read more about launching clusters.

Tune Quick Start

https://github.com/ray-project/ray/raw/master/doc/source/images/tune-wide.png

Tune is a library for hyperparameter tuning at any scale.

To run this example, you will need to install the following:

$ pip install ray[tune] torch torchvision filelock

This example runs a parallel grid search to train a Convolutional Neural Network using PyTorch.

import torch.optim as optim
from ray import tune
from ray.tune.examples.mnist_pytorch import (
    get_data_loaders, ConvNet, train, test)


def train_mnist(config):
    train_loader, test_loader = get_data_loaders()
    model = ConvNet()
    optimizer = optim.SGD(model.parameters(), lr=config["lr"])
    for i in range(10):
        train(model, optimizer, train_loader)
        acc = test(model, test_loader)
        tune.track.log(mean_accuracy=acc)


analysis = tune.run(
    train_mnist, config={"lr": tune.grid_search([0.001, 0.01, 0.1])})

print("Best config: ", analysis.get_best_config(metric="mean_accuracy"))

# Get a dataframe for analyzing trial results.
df = analysis.dataframe()

If TensorBoard is installed, automatically visualize all trial results:

tensorboard --logdir ~/ray_results

RLlib Quick Start

https://github.com/ray-project/ray/raw/master/doc/source/images/rllib-wide.jpg

RLlib is an open-source library for reinforcement learning built on top of Ray that offers both high scalability and a unified API for a variety of applications.

pip install tensorflow  # or tensorflow-gpu
pip install ray[rllib]  # also recommended: ray[debug]
import gym
from gym.spaces import Discrete, Box
from ray import tune

class SimpleCorridor(gym.Env):
    def __init__(self, config):
        self.end_pos = config["corridor_length"]
        self.cur_pos = 0
        self.action_space = Discrete(2)
        self.observation_space = Box(0.0, self.end_pos, shape=(1, ))

    def reset(self):
        self.cur_pos = 0
        return [self.cur_pos]

    def step(self, action):
        if action == 0 and self.cur_pos > 0:
            self.cur_pos -= 1
        elif action == 1:
            self.cur_pos += 1
        done = self.cur_pos >= self.end_pos
        return [self.cur_pos], 1 if done else 0, done, {}

tune.run(
    "PPO",
    config={
        "env": SimpleCorridor,
        "num_workers": 4,
        "env_config": {"corridor_length": 5}})

More Information

Getting Involved

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ray-0.8.6-cp38-cp38-win_amd64.whl (16.0 MB view details)

Uploaded CPython 3.8Windows x86-64

ray-0.8.6-cp38-cp38-manylinux1_x86_64.whl (21.9 MB view details)

Uploaded CPython 3.8

ray-0.8.6-cp38-cp38-macosx_10_13_x86_64.whl (53.2 MB view details)

Uploaded CPython 3.8macOS 10.13+ x86-64

ray-0.8.6-cp37-cp37m-win_amd64.whl (16.1 MB view details)

Uploaded CPython 3.7mWindows x86-64

ray-0.8.6-cp37-cp37m-manylinux1_x86_64.whl (21.9 MB view details)

Uploaded CPython 3.7m

ray-0.8.6-cp37-cp37m-macosx_10_13_intel.whl (53.4 MB view details)

Uploaded CPython 3.7mmacOS 10.13+ Intel (x86-64, i386)

ray-0.8.6-cp36-cp36m-win_amd64.whl (16.1 MB view details)

Uploaded CPython 3.6mWindows x86-64

ray-0.8.6-cp36-cp36m-manylinux1_x86_64.whl (21.9 MB view details)

Uploaded CPython 3.6m

ray-0.8.6-cp36-cp36m-macosx_10_13_intel.whl (53.4 MB view details)

Uploaded CPython 3.6mmacOS 10.13+ Intel (x86-64, i386)

ray-0.8.6-cp35-cp35m-manylinux1_x86_64.whl (21.9 MB view details)

Uploaded CPython 3.5m

ray-0.8.6-cp35-cp35m-macosx_10_13_intel.whl (53.4 MB view details)

Uploaded CPython 3.5mmacOS 10.13+ Intel (x86-64, i386)

File details

Details for the file ray-0.8.6-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: ray-0.8.6-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 16.0 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.6

File hashes

Hashes for ray-0.8.6-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 dbf79b7c4d7834bc5c506c397b8f03ecfe9b03e3e4611fe37d725a6e6ccb5649
MD5 d0a66bc50373b29d79375a4d732fd9fa
BLAKE2b-256 f61dd7bf317f6317571ad63cadd350daef584de290d235bf57488ef22d91e226

See more details on using hashes here.

File details

Details for the file ray-0.8.6-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: ray-0.8.6-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 21.9 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.6

File hashes

Hashes for ray-0.8.6-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 efaf70097d6e61d0f3d05acb59b6f3a627a3d8a326f1c5d212c93a7231e41d67
MD5 5dc8fdf82504ee794369b6b2c7297238
BLAKE2b-256 9c25d06efc414db3a95e89a52732b6dd07d502d9a0bd52061fd4344a421dc5a8

See more details on using hashes here.

File details

Details for the file ray-0.8.6-cp38-cp38-macosx_10_13_x86_64.whl.

File metadata

  • Download URL: ray-0.8.6-cp38-cp38-macosx_10_13_x86_64.whl
  • Upload date:
  • Size: 53.2 MB
  • Tags: CPython 3.8, macOS 10.13+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.6

File hashes

Hashes for ray-0.8.6-cp38-cp38-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 9124994117fe26d12c0873737b19fdf6d80b7d283d53d85d1662bb6c98a0b418
MD5 e721d5053f48c1acf621a60812aaf86e
BLAKE2b-256 6849de5d45e32d09187f89e32554ded7ed5a361eaedfd37368caeb72123d8c12

See more details on using hashes here.

File details

Details for the file ray-0.8.6-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: ray-0.8.6-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 16.1 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.6

File hashes

Hashes for ray-0.8.6-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 402ed1be4363cc4494b7022524158f862f3e052d249497ac1145b4452ff08ebe
MD5 e469ec21d86f61db36202d4dd3c08fd9
BLAKE2b-256 dc745831501456b7ee96ccf0ca844d65bd62176a3ca74be4b619e286ec5c7d31

See more details on using hashes here.

File details

Details for the file ray-0.8.6-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: ray-0.8.6-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 21.9 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.6

File hashes

Hashes for ray-0.8.6-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c007b1e87ef6af7ac684ecb9c2be27bcc5cd881b89ebdc3ea2d99047ffc1eeee
MD5 f1eb1098b59c5c2959d55e9ef0f20062
BLAKE2b-256 08456d66cf6edcb9005884448b22d8dac762ceb4d425f8bdba9129b4117b182d

See more details on using hashes here.

File details

Details for the file ray-0.8.6-cp37-cp37m-macosx_10_13_intel.whl.

File metadata

  • Download URL: ray-0.8.6-cp37-cp37m-macosx_10_13_intel.whl
  • Upload date:
  • Size: 53.4 MB
  • Tags: CPython 3.7m, macOS 10.13+ Intel (x86-64, i386)
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.6

File hashes

Hashes for ray-0.8.6-cp37-cp37m-macosx_10_13_intel.whl
Algorithm Hash digest
SHA256 e79bb29c6d93bc24253a75196a86201471f8ca461102e957cee71ec999fb06cf
MD5 018917d87c303308a9b329e8f5680d69
BLAKE2b-256 dabd4847fcc216cb385672587c2af86afddc8ee4e20410b093f086b6f6ec97be

See more details on using hashes here.

File details

Details for the file ray-0.8.6-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: ray-0.8.6-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 16.1 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.6

File hashes

Hashes for ray-0.8.6-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 aaf43089881dc203c56c2bec499c9b425a989894bf2b39d767a5c0825a4a5af2
MD5 ac6fd5ff2487332056df6d8206edc710
BLAKE2b-256 d8452f44b7b06a7aef7523aa7cc7db9e57f2c101d8406a5fdd8bc9eab424d18a

See more details on using hashes here.

File details

Details for the file ray-0.8.6-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: ray-0.8.6-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 21.9 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.6

File hashes

Hashes for ray-0.8.6-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 dfd01dec0eddd446c1a22f979bf7ced185149f92d761d742592b4fc887dc439c
MD5 52b678134b7d40291bf1405a41ba9879
BLAKE2b-256 ea0bf253e92aee1225d9d0ef21dd15514352ce87f6dbc55de70707bc9d52477f

See more details on using hashes here.

File details

Details for the file ray-0.8.6-cp36-cp36m-macosx_10_13_intel.whl.

File metadata

  • Download URL: ray-0.8.6-cp36-cp36m-macosx_10_13_intel.whl
  • Upload date:
  • Size: 53.4 MB
  • Tags: CPython 3.6m, macOS 10.13+ Intel (x86-64, i386)
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.6

File hashes

Hashes for ray-0.8.6-cp36-cp36m-macosx_10_13_intel.whl
Algorithm Hash digest
SHA256 fdd4b994ffa894dfe582107b230d515c05ca41ecb2152f28e6c893d4edcc8369
MD5 1a05d5a5923a1f2d8f60a22fc17a6cf4
BLAKE2b-256 85add4f494c7ac008e0a13f8a2ed44f5bc97e247ac457b49845d9e7922e4b973

See more details on using hashes here.

File details

Details for the file ray-0.8.6-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: ray-0.8.6-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 21.9 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.6

File hashes

Hashes for ray-0.8.6-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 3a282f770855a56d3ede321ccb6e4a4b48eccb1daead9aa08c20c457ec186d27
MD5 13527ce4a919a565d720792c32a87472
BLAKE2b-256 68142d65d5468593ae5a6e210507777042367cba9a8ba5e6d5dcab5313653423

See more details on using hashes here.

File details

Details for the file ray-0.8.6-cp35-cp35m-macosx_10_13_intel.whl.

File metadata

  • Download URL: ray-0.8.6-cp35-cp35m-macosx_10_13_intel.whl
  • Upload date:
  • Size: 53.4 MB
  • Tags: CPython 3.5m, macOS 10.13+ Intel (x86-64, i386)
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.6

File hashes

Hashes for ray-0.8.6-cp35-cp35m-macosx_10_13_intel.whl
Algorithm Hash digest
SHA256 28bddf09debbc82ff19e1523ada131e7beaf2170f2d88cea72601ff11ff71757
MD5 3cb2107324ed78bdc2388cacdbdec1a1
BLAKE2b-256 1b87bfcb47459907a1ea59c1469a07dc1598fe3584cee4e9b236a9d10eebd02f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page