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

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:

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

Why Ray?

For Distrubuted computation over clusters for AI Applications (especially for Reinforacement learning)

Evoluation of ML Applications

1> Supervised Learning

No alt text provided for this image

2> RL Applications

No alt text provided for this image

Supervised v/s RL Application

No alt text provided for this image

RL Application Pattern

Process inputs from sensors in parallel & Real time and execute large # of simulations in range of 100's of millions and rollout outcomes are used to update policy

No alt text provided for this image

Policy is managed by a DNN (Deep Neural Network)

No alt text provided for this image

RL Application Requirments

1 Handle dynamic task graph {Hetrogenous durations & Hetrogenous compuations }

2. Schedule Millions of tasks/sec

3.Easy to parallelize ML algorithms

Ray API (Remote Functions):

It doesnot allyou user to share multable state between tasks which is an important tasks as most of tasks as stateful

import ray
import numpy as np

ray.init()
@ray.remote
def zeros(shape):
    return np.zeros(shape)
    
@ray.remote
def dot(a,b):
    return np.dot(a,b)


id1=zeros.remote([5,5])
id2=zeros.remote([5,5])
id3=dot.remote(id1,id2)
ray.get(id3)


No alt text provided for this image

To achive stateful we use Ray API (actors)

@ray.remote
class Counter(object):
    def __init__(self):
        self.value=0
    def postinc(self):
        self.value +=1
        return self.value


c=Counter.remote()
id1=c.postinc.remote()
id2=c.postinc.remote()
id3=c.postinc.remote()
ray.get([id1,id2,id3])

State is shared b/w actor methods and Actor method return object ids

No alt text provided for this image

Also Supports GPU

@ray.remote(num_gpus=3)

Ray Archiecture

  1. Bottom up distributed scheduler
  2. Can be thaught off as spark drivers and workers
  3. Shared Object Store using apche arrow data layout which brings down data for deseralization
  4. In contract to spark workers can also submit tasks which can be assigned to other worker
  5. Global control store takes meta data out of rest of system and centralize in single sharded database ( Easy to replicate , build profiling tools , serves as message bus )
No alt text provided for this image

Ray's performance

No alt text provided for this image
No alt text provided for this image

If you on Windows platform as of today it's not available It's Only available on Linux and Mac

Evolution Strategies

Try lot of different policies and see which one works best

No alt text provided for this image
class Worker(onkect):
  def do_dimulation(policy,seed):
    #perform simulation return reward

workers= [Worker() for i in range(50)]
policy=intital_policy()

for i in range(200):
  seeds=generate_seeds(i)
  rewards=[workers[j].do_simulation(policy,seed[j] for j in range(50)]
  policy=compute_update(policy,rewards,seeds) 

Using Ray

@ray.remote

class Worker(onkect):
  def do_dimulation(policy,seed):
  
    #perform simulation return reward

workers= [Worker.remote() for i in range(50)]
policy=intital_policy()

for i in range(200):
  seeds=generate_seeds(i)
  rewards=[workers[j].do_simulation.remote(policy,seed[j] for j in range(50)]
  policy=compute_update(policy,rewards,seeds) 
No alt text provided for this image

RaY + Spark:

Complemenary : Spark handles data processing and classic ML Algos while Ray is for RL

Interoperability: via Object Store ( Apache Arrow)


要查看或添加评论,请登录

Avinash A.的更多文章

  • AI & Startups December 16th - December 22nd

    AI & Startups December 16th - December 22nd

    AI Product News ?? Microsoft Releases Small, Powerful Phi-4 Image source: Microsoft Microsoft has unveiled Phi-4, a 14B…

    2 条评论
  • AI & Startups November 25th - December 1st

    AI & Startups November 25th - December 1st

    AI Product News ?? H Company Unveils Runner H: A Game-Changing AI Automation Assistant Image source: H Company H…

  • AI & Startups November 18th - November 24th

    AI & Startups November 18th - November 24th

    AI Product News ?? Arc Institute Releases ‘ChatGPT for DNA’ Image source: ScienceAdvisor Scientists at the Arc Research…

    1 条评论
  • AI & Startups November 11th - November 17rd

    AI & Startups November 11th - November 17rd

    AI Product News ?? TikTok Launches Symphony Creative Studio Image source: TikTok TikTok has unveiled Symphony Creative…

  • AI & Startups October 28th - November 3rd

    AI & Startups October 28th - November 3rd

    AI Product News ?? Google ’s ‘Jarvis’ Browser Assistant is Coming Image source: Midjourney Google is reportedly…

  • AI & Startups October 21th - October 27th

    AI & Startups October 21th - October 27th

    AI Product News ?? Midjourney Launches New Image Editor Image source: Midjourney Midjourney has debuted a new…

  • AI & Startups October 14th - October 20th

    AI & Startups October 14th - October 20th

    AI Product News ?? Adobe Unveils Firefly Video Model at MAX Image source: Adobe Adobe just announced the addition of…

    1 条评论
  • AI & Startups September 23rd - September 29th

    AI & Startups September 23rd - September 29th

    AI Product News ??? Electronic Arts (EA) Reveals AI-Powered Video Game Creation Image source: Electronic Arts…

  • AI & Startups September 16th - September 22nd

    AI & Startups September 16th - September 22nd

    AI Product News ?? Microsoft 365 Adds Faster Copilot to Excel and Word Image source: Microsoft Microsoft has unveiled a…

  • AI & Startups September 9th - September 15th

    AI & Startups September 9th - September 15th

    AI Product News ?? Weave New Robot Butler Does Your Chores Image source: Weave Weave has just announced Isaac, a…

    1 条评论

社区洞察

其他会员也浏览了