Questions tagged [ray]

Ray is a library for writing parallel and distributed Python applications. It scales from your laptop to a large cluster, has a simple yet flexible API, and provides high performance out of the box.

At its core, Ray is a library for writing parallel and distributed Python applications. Its API provides a simple way to take arbitrary Python functions and classes and execute them in the distributed setting.

Learn more about Ray:

Ray also includes a number of powerful libraries:

  • Cluster Autoscaling: Automatically configure, launch, and manage clusters and experiments on AWS or GCP.
  • Hyperparameter Tuning: Automatically run experiments, tune hyperparameters, and visualize results with Ray Tune.
  • Reinforcement Learning: RLlib is a state-of-the-art platform for reinforcement learning research as well as reinforcement learning in practice.
  • Distributed Pandas: Modin provides a faster dataframe library with the same API as Pandas.
702 questions
3
votes
1 answer

Change the max. #of simultaneous actors allowed inside python script

I have a remote class like (using ray API) @ray.remote class className .... And I want to start 60 or more instances of this class and let them do some work simultaneously. However, I can't start more than 50 instances of this class at the same…
Our
  • 986
  • 12
  • 22
3
votes
1 answer

Implementing cache for Ray actor function

My goal is to make the code below execute in roughly 0.3 instead of 0.5 seconds. I've tried using the decorators from functools.lru_cache, toolz.functoolz.memoize and kids.cache.cache on foo but none of those has worked (either error message or…
Daniel
  • 172
  • 1
  • 11
3
votes
2 answers

How to use global variables with Ray

I have a script that looks like a more complicated version of this: import ray var1 = 0 var2 = 0 @ray.remote def create(n): global var1 global var2 for i in range(10): var1 += 1 var2 += 1 def create2(): tasks =…
11thal11thal
  • 333
  • 3
  • 13
3
votes
1 answer

Ray RLllib: Export policy for external use

I have a PPO policy based model that I train with RLLib using the Ray Tune API on some standard gym environments (with no fancy preprocessing). I have model checkpoints saved which I can load from and restore for further training. Now, I want to…
deepmindz
  • 598
  • 1
  • 6
  • 14
3
votes
1 answer

How to use ray with celery tasks?

Is there a way to use ray with celery. Which executor to use. I've tried a toy implementation and ran into following error: [2020-05-25 00:21:07,473: ERROR/ForkPoolWorker-5] Task mytasks.add[4a2f6fba-4f1b-4a77-95a0-0ee3c488a927] raised unexpected:…
3
votes
1 answer

Using Ray in Python to parallelize task, get "Aborted (core dumped)"

I've a Python program like this if __name__ == "__main__": .. for t in th: .. And I'm trying to parallelize it using Ray library that seems to be faster than multiprocessing, so I wrote import ray ray.init() @ray.remote def func(t): …
Lota18-
  • 113
  • 1
  • 5
3
votes
0 answers

Share scipy.sparse arrays with zero-copy in Python's Ray

I pass large scipy.sparse arrays to a parallel processes on shared memory of one computing node. In each round of parallel jobs, the passed array will not be modified. I want to pass the array with zero-copy. While this is possible with…
Sia
  • 207
  • 2
  • 9
3
votes
1 answer

Running ray serve in a docker container in foreground, not daemon mode

I'm running Ray Serve to host a HTTP API of a ray remote function. Is there a better way than below to run Ray Serve in foreground (i.e not daemon mode). Code is taken pretty straight from ray serve example: import os import time import…
Niklas B
  • 1,839
  • 18
  • 36
3
votes
1 answer

What does "num_envs_per_worker" in rllib do?

For the life of me I don't get what "num_envs_per_worker" does. If the limiting factor is policy evaluation why would we need to create multiple environments? Wouldn't we need to create multiple policies? ELI5 please? The docs say: Vectorization…
Andriy Drozdyuk
  • 58,435
  • 50
  • 171
  • 272
3
votes
0 answers

python ray - pyarrow.lib.ArrowInvalid: Maximum size exceeded (2GB)

I am trying to load and process large files using ray. I am using ray for the purpose of multiprocessing the files and improving the speed of the solution. I keep running into this pyarrow error: pyarrow.lib.ArrowInvalid: Maximum size exceeded…
3
votes
0 answers

How to write into numpy arrays in shared memory with Ray?

I am attempting to rewrite Python multiprocessing code using Ray since it appears to be able to abstract shared memory management issues and perform parallel computation faster than straight multiprocessing (based on this article). My goal is to…
James Adams
  • 8,448
  • 21
  • 89
  • 148
3
votes
2 answers

How I can change learning rate of RLlib training agent in dynamic

I'm using ray RLlib library to train multi-agent Trainer on the 5-in-a-row game. This is zero-sum environment so I have a problem of agents behavior degeneration (always win for 1'st agent, 5 moves to win). I have an idea to change learning rate of…
3
votes
1 answer

How to specify conv_filters when using a custom obs shape?

I'm using a custom environment to run a Ray's run_experiment function. My observation_space is spaces.Box(low=-np.finfo(np.float32).max, high=np.finfo(np.float32).max, shape=(3, 76), dtype=np.float16) The input is…
3
votes
0 answers

how can I specify the checkpoint directory in ray.tune.run_experiments

ray.tune.run_experiments checkpoints the model at some path like "/ray_results/test/DDPG_VAV-v0_0_2019-04-17_21-43-43ak0121vf/", it is too lengthy, how can I change this checkpoint path run_experiments({ 'test': { …
mlee
  • 51
  • 8
3
votes
1 answer

Ray - RLlib - Error with Custom env - continuous action space - DDPG - offline experience training?

Error while using offline experiences for DDPG. custom environment dimensions (action space and state space) seem to be inconsistent with what is expected in DDPG RLLIB trainer. Ubuntu, Ray 0.7 version (latest ray), DDPG example, offline dataset.…