Code Monkey home page Code Monkey logo

academy's Introduction

Anyscale Academy - Tutorials on Ray and Ray-based Libraries

© 2018-2022, Anyscale. All Rights Reserved

Welcome to the Anyscale Academy tutorials on Ray, the system for scaling your Python and ML applications from a laptop to a cluster.

This README tells you how to set up the tutorials and decide which content is best for your interests.

IMPORTANT NOTE: Modules and materials in this Academy have been updated and tested with Ray release 1.11 and supported Python 3.8. Older modules and tutorials have been retired into their respective retired directories. Hence, current material content will not match the Ray Summit 2020 tutorial.

Also, the setup process has been streamlined and Python dependencies and packages reduced.

Tips:

  1. How to Contact us for more information.
  2. Please report any issues or suggestions:
  3. If you are attending a live tutorial event, please follow the setup instructions provided in advance. It will take too long to do these instructions during the event.
  4. For troubleshooting help, see the Troubleshooting, Tips, and Tricks notebook.

Tutorial Setup

Read the appropriate setup section that follows, then jump to Launching the Tutorials.

Setup for Anyscale Academy Hosted Sessions

There is nothing you need to setup, as the hosted environment will provide everything.

However, consider cloning or downloading a release of the tutorial notebooks and supporting software from the Academy repo, so you have a local copy of everything.

Tip: If you modify any notebooks during the hosted session, make sure you download them to save those changes.

Setup for a Local Machine

Note: Ray support for Windows is new. See these release notes for details.

Follow these instructions to use the tutorials. Note that some commands can take a while to finish.

Clone the Academy GitHub repo or download the latest release.

Now install the dependencies using either Anaconda or pip in your Python environment. We recommend using Anaconda.

Which Python Version?

Python 3.7+ is recommended. While Ray supports Python 3.8, some dependencies used in RLlib (the Ray reinforcement library) are not yet supported for 3.8, at the time of this writing.

Using Anaconda

If you need to install Anaconda, follow the instructions here. If you already have Anaconda installed, consider running conda upgrade --all.

Run the following commands in the root directory of this project. First, use conda to install the other dependencies, including Ray. Then activate the newly-created environment, named anyscale-academy. Finally, run the provided tools/fix-jupyter.sh script to install a graphing library extension in Jupyter Lab and perform other tasks.

conda create -n anyscale-academy python=3.8
conda activate anyscale-academy
python3 -m pip install -r requirements.txt
python3 -m pip install typing-extensions --upgrade
tools/fix-jupyter.sh

If you are using Windows, see the Fixing Jupyter Lab on Windows below for an alternative to using tools/fix-jupyter.sh.

Note that Python 3.8.is used. Ignore the similar-looking environment-docker.yml file. It is used to build Docker images.

You can delete the environment later with the following command:

conda env remove --name anyscale-academy

Using Pip

If you don't use Anaconda, you'll have to install these prerequisites first:

  • Python 3.7:
    • See notes above about problems with 3.6 and 3.8. Don't use 3.8, but 3.6 may work for you.
    • The version of Python that comes with your operating system is probably too old. Try python --version to see what you have.
    • Installation instructions are at python.org.
  • Pip: A recent version - consider upgrading if it's not the latest version.
  • Node.js: Required for some of the Jupyter Lab graphics extensions we use.
    • Installation instructions are here.
  • SWIG: Required for building dependencies.
    • Use the package manager of your system (e.g. apt on Ubuntu, brew on MacOS) to install, or download here.

Next, run the following commands in the root directory of this project to complete the setup. First, run the pip command to install the rest of the libraries required for these tutorials, including Ray. Then, run the provided script to install a graphing library extension in Jupyter Lab and perform other tasks.

python3 -m pip install -r requirements.txt
python3 -m pip install typing-extensions --upgrade
tools/fix-jupyter.sh

If you are using Windows, see the Fixing Jupyter Lab on Windows below for an alternative to using tools/fix-jupyter.sh.

Fixing Jupyter Lab on Windows

The tools/fix-jupyter.sh shell script runs the following commands. If you are using Windows, run them yourself as shown here.

First, see if the following pyviz extension is installed:

jupyter labextension check --installed "@pyviz/jupyterlab_pyviz"

If not, run this command:

jupyter labextension install "@pyviz/jupyterlab_pyviz"

Finally, run these commands:

jupyter labextension update --all
jupyter lab build
jupyter labextension list

Note: A Windows and Mac M1 version are experimental in Ray 1.8.

Launching the Tutorials

The previous steps installed Jupyter Lab, the notebook-based environment we'll use for all the lessons. To start run the following command in the project root directory:

jupyter lab

It should automatically open a browser window with the lab environment, but if not, the console output will show the URL you should use.

Tip: If you get an error that jupyter can't be found and you are using the Anaconda setup, make sure you activated the anyscale-academy environment, as shown above.

Which Tutorials Are Right for Me?

Here is a recommended reading list, based on your interests:

You Are... Best Tutorials
A developer who is new to Ray First, Ray Crash Course, then Advanced Ray
A developer who is experienced with Ray Advanced Ray
A developer or data scientist interested in Reinforcement Learning Ray RLlib
A developer or data scientist interested in Hyperparameter Tuning Ray Tune
A developer or data scientist interested in distributed training models in PyTorch or TensorFlow Ray Train(renamed from Ray SGD)
A developer or data scientist interested in model serving Ray Serve
A DevOps engineer interested in managing Ray clusters Ray Cluster Launcher (forthcoming)

See the Overview notebook for detailed, up-to-date descriptions for each tutorial and the lessons it contains.

Troubleshooting and Further Information

See the Troubleshooting, Tips, and Tricks notebook.

For details on the Ray API and the ML libraries, see the Ray Docs. For other information, see ray.io, including the Ray blog.

Ray started at U.C. Berkeley RISELab. It is now developed in artisanal, small batches at Anyscale.

academy's People

Contributors

aksakalli avatar anthony0727 avatar apaleyes avatar ceteri avatar christy avatar deanwampler avatar desktable avatar dioptre avatar dmatrix avatar japsonzbz avatar katarinaslama avatar kouroshhakha avatar mgalarnyk avatar mwtian avatar richardliaw avatar robertnishihara avatar shrekris-anyscale avatar simon-mo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

academy's Issues

Inquiries about translated file locations

Hello, Anyscale.
Ray is a popular library in Korea, too. So I will contribute by translating Korean users so that they can easily study through this tutorial. Where should I put the translated notebook file?

Thank you!

May I ask why ray remote can not send dict?

I have a gather Actor which takes all outputs of previous Actor:

@ray.remote
class GatherAll:

    def __init__(self) -> None:
        pass

    # def infer(self, hands, kpts):
    #     if hands.shape[0] > kpts.shape[0]:
    #         out = hands.copy()
    #         out[:kpts.shape[0], :] += kpts[..., :4]
    #         return out
    #     else:
    #         out = kpts.copy()[..., :4]
    #         out[:hands.shape[0], :] += hands
    #         return out

    def infer(self, datas):
        hands = datas['a']
        kpts = datas['b']
        if hands.shape[0] > kpts.shape[0]:
            out = hands.copy()
            out[:kpts.shape[0], :] += kpts[..., :4]
            return out
        else:
            out = kpts.copy()[..., :4]
            out[:hands.shape[0], :] += hands
            return out

the uncommented parts not work, which I call it in dict:

# out = G.infer.remote(hands, kpts)
out = G.infer.remote({'a': hands, 'b': kpts})

Get error:

AttributeError: 'ray._raylet.ObjectRef' object has no attribute 'shape'

Why using separated is OK, but dictionary is not ? Very confused here.

Ray CLUSTER HA

I am very sure this is not the right place to ask this question, but still,

can anyone tell me whether RAY CLUSTER works in HA or not?

What I mean is, what is the ray head node is down, whether the next leader selection happens ?

IndexError on calling ppo.PPOTrainer(config, env = SELECT_ENV) 01-Application-Cart-Pole.ipynb

I follow the suggestion ,
config["framework"] = "torch"
config["num_gpus"] = 0.001 # can't work
config["num_gpus_per_worker"] = (1 - 0.001) / 4
but I get the error,

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-33-c1627876193e> in <module>
----> 1 agent = ppo.PPOTrainer(config, env=SELECT_ENV)
      2 
      3 results = []
      4 episode_data = []
      5 episode_json = []

~/anaconda3/envs/anyscale-academy/lib/python3.7/site-packages/ray/rllib/agents/trainer_template.py in __init__(self, config, env, logger_creator)
    121 
    122         def __init__(self, config=None, env=None, logger_creator=None):
--> 123             Trainer.__init__(self, config, env, logger_creator)
    124 
    125         def _init(self, config: TrainerConfigDict,

~/anaconda3/envs/anyscale-academy/lib/python3.7/site-packages/ray/rllib/agents/trainer.py in __init__(self, config, env, logger_creator)
    546             logger_creator = default_logger_creator
    547 
--> 548         super().__init__(config, logger_creator)
    549 
    550     @classmethod

~/anaconda3/envs/anyscale-academy/lib/python3.7/site-packages/ray/tune/trainable.py in __init__(self, config, logger_creator)
     96 
     97         start_time = time.time()
---> 98         self.setup(copy.deepcopy(self.config))
     99         setup_time = time.time() - start_time
    100         if setup_time > SETUP_TIME_THRESHOLD:

~/anaconda3/envs/anyscale-academy/lib/python3.7/site-packages/ray/rllib/agents/trainer.py in setup(self, config)
    707 
    708         with get_scope():
--> 709             self._init(self.config, self.env_creator)
    710 
    711             # Evaluation setup.

~/anaconda3/envs/anyscale-academy/lib/python3.7/site-packages/ray/rllib/agents/trainer_template.py in _init(self, config, env_creator)
    153                 policy_class=self._policy_class,
    154                 config=config,
--> 155                 num_workers=self.config["num_workers"])
    156             self.execution_plan = execution_plan
    157             self.train_exec_impl = execution_plan(self.workers, config)

~/anaconda3/envs/anyscale-academy/lib/python3.7/site-packages/ray/rllib/agents/trainer.py in _make_workers(self, env_creator, validate_env, policy_class, config, num_workers)
    795             trainer_config=config,
    796             num_workers=num_workers,
--> 797             logdir=self.logdir)
    798 
    799     @DeveloperAPI

~/anaconda3/envs/anyscale-academy/lib/python3.7/site-packages/ray/rllib/evaluation/worker_set.py in __init__(self, env_creator, validate_env, policy_class, trainer_config, num_workers, logdir, _setup)
     98                 num_workers=num_workers,
     99                 config=self._local_config,
--> 100                 spaces=spaces,
    101             )
    102 

~/anaconda3/envs/anyscale-academy/lib/python3.7/site-packages/ray/rllib/evaluation/worker_set.py in _make_worker(self, cls, env_creator, validate_env, policy_cls, worker_index, num_workers, config, spaces)
    405             fake_sampler=config["fake_sampler"],
    406             extra_python_environs=extra_python_environs,
--> 407             spaces=spaces,
    408         )
    409 

~/anaconda3/envs/anyscale-academy/lib/python3.7/site-packages/ray/rllib/evaluation/rollout_worker.py in __init__(self, env_creator, validate_env, policy_spec, policy_mapping_fn, policies_to_train, tf_session_creator, rollout_fragment_length, count_steps_by, batch_mode, episode_horizon, preprocessor_pref, sample_async, compress_observations, num_envs, observation_fn, observation_filter, clip_rewards, clip_actions, env_config, model_config, policy_config, worker_index, num_workers, record_env, log_dir, log_level, callbacks, input_creator, input_evaluation, output_creator, remote_worker_envs, remote_env_batch_wait_ms, soft_horizon, no_done_at_end, seed, extra_python_environs, fake_sampler, spaces, policy, monitor_path)
    535         else:
    536             self.policy_map, self.preprocessors = self._build_policy_map(
--> 537                 policy_dict, policy_config)
    538 
    539         # Update Policy's view requirements from Model, only if Policy directly

~/anaconda3/envs/anyscale-academy/lib/python3.7/site-packages/ray/rllib/evaluation/rollout_worker.py in _build_policy_map(self, policy_dict, policy_config)
   1194             # non-tf.
   1195             else:
-> 1196                 policy_map[name] = cls(obs_space, act_space, merged_conf)
   1197 
   1198         if self.worker_index == 0:

~/anaconda3/envs/anyscale-academy/lib/python3.7/site-packages/ray/rllib/policy/policy_template.py in __init__(self, obs_space, action_space, config)
    265                 action_distribution_fn=action_distribution_fn,
    266                 max_seq_len=config["model"]["max_seq_len"],
--> 267                 get_batch_divisibility_req=get_batch_divisibility_req,
    268             )
    269 

~/anaconda3/envs/anyscale-academy/lib/python3.7/site-packages/ray/rllib/policy/torch_policy.py in __init__(self, observation_space, action_space, config, model, loss, action_distribution_class, action_sampler_fn, action_distribution_fn, max_seq_len, get_batch_divisibility_req)
    153                 for i, id_ in enumerate(gpu_ids) if i < config["num_gpus"]
    154             ]
--> 155             self.device = self.devices[0]
    156             ids = [
    157                 id_ for i, id_ in enumerate(gpu_ids) if i < config["num_gpus"]

IndexError: list index out of range

And after I debug, i found that ray/rllib/policy/torch_policy.py#L150 ray.get_gpu_ids()will return a empty list, how can i use gpu for training?

Typos in ray-crash-course

Hello
I spotted small typos in the ray-crash-course.

00-Ray-Crash-Course-Overview.ipynb

The naming and the link of item 03 are incorrect.

"| 00 | [Overview](00-Ray-Crash-Course-Overview.ipynb) | A _table of contents_ for this tutorial. |\n",
"| 01 | [Ray Tasks](01-Ray-Tasks.ipynb) | Understanding how Ray converts normal Python functions into distributed _stateless tasks_. |\n",
"| 02 | [Ray Actors](02-Ray-Actors.ipynb) | Understanding how Ray converts normal Python classes into distributed, _stateful actors_. |\n",
"| 03 | [Ray Actors](02-Ray-Objects.ipynb) | Understanding Ray's distributed obect store |\n",
"| 04 | [Exploring Ray API Calls](04-Exploring-Ray-API-Calls.ipynb) | The Ray API has other API calls for more advanced scenarios, which are surveyed in this optional lesson. Keyword arguments you can pass to the API calls already learned are explored. |\n",

I would suggest changing to
"| 03 | [Ray Objects](03-Ray-Objects.ipynb)

01-Ray-Tasks.ipynb

in Example 2: Adding two np arrays section. I assume this should be return np.add(arr1, arr2)

"def add_array(arr1: np.array, arr2: np.array) -> np.array:\n",
" return np.add(arr1, arr1)"

Question about update coord in JokeRec/step in rayrllib/recsys/01-Recsys.ipynb

centers dimension is like [clusters, users], c dimension will become [users], why do we get c[item]?
For example, if we have cluster =7, users=2000, items=101, shouldn't we get c[user] instead of c[item]?

class JokeRec (gym.Env):
def step(self):
...
# update the coords history: agent observes its distance to each cluster "evolve"
for i in range(len(self.coords)):
c = self.centers[i]
scaled_diff = abs(c[item] - rating) / 2.0
self.coords[i] += scaled_diff ** 2.0

AssertionError on calling `run_simulations(dmaps)` 01-Ray-Tasks.ipynb

I get an AssertionError when calling run_simulations(dmaps) in the 01-Ray-Tasks.ipynb:

I am running locally from a conda env (followed exactly the Setup section of the README). The simulation seems to run though unaffected by the exception...

Here is the output of the traceback including a related warnings:

WARNING:param.dynamic_operation: Callable raised "AssertionError('New option id 2951106455928858 does not match any option trees in Store.custom_options.')".
Invoked as dynamic_operation(counter=0)
WARNING:param.dynamic_operation: Callable raised "AssertionError('New option id 2951106455928858 does not match any option trees in Store.custom_options.')".
Invoked as dynamic_operation(counter=0)
Traceback (most recent call last):
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/plotting/util.py", line 275, in get_plot_frame
    return map_obj[key]
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/spaces.py", line 1341, in __getitem__
    val = self._execute_callback(*tuple_key)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/spaces.py", line 1110, in _execute_callback
    retval = self.callback(*args, **kwargs)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/spaces.py", line 714, in __call__
    ret = self.callable(*args, **kwargs)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/util/__init__.py", line 1042, in dynamic_operation
    key, obj = resolve(key, kwargs)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/util/__init__.py", line 1031, in resolve
    return key, map_obj[key]
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/spaces.py", line 1341, in __getitem__
    val = self._execute_callback(*tuple_key)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/spaces.py", line 1110, in _execute_callback
    retval = self.callback(*args, **kwargs)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/spaces.py", line 714, in __call__
    ret = self.callable(*args, **kwargs)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/util/__init__.py", line 1043, in dynamic_operation
    return apply(obj, *key, **kwargs)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/util/__init__.py", line 1035, in apply
    processed = self._process(element, key, kwargs)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/util/__init__.py", line 1019, in _process
    return self.p.operation(element, **kwargs)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/accessors.py", line 625, in <lambda>
    dmap = Dynamic(obj, operation=lambda obj, **dynkwargs: obj.opts(*args, **kwargs),
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/accessors.py", line 37, in pipelined_call
    return __call__(*args, **kwargs)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/accessors.py", line 573, in __call__
    return self._dispatch_opts( *args, **kwargs)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/accessors.py", line 577, in _dispatch_opts
    return self._base_opts(*args, **kwargs)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/accessors.py", line 656, in _base_opts
    return self._obj.options(*new_args, **kwargs)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/dimension.py", line 1307, in options
    obj = obj.opts._dispatch_opts(expanded, backend=backend, clone=clone)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/accessors.py", line 577, in _dispatch_opts
    return self._base_opts(*args, **kwargs)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/accessors.py", line 653, in _base_opts
    return opts.apply_groups(self._obj, **dict(kwargs, **new_kwargs))
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/util/__init__.py", line 244, in apply_groups
    obj = cls._apply_groups_to_backend(obj, backend_opts, backend, clone)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/util/__init__.py", line 169, in _apply_groups_to_backend
    return StoreOptions.set_options(obj_handle, options, backend=backend)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/options.py", line 1843, in set_options
    applied = cls.propagate_ids(obj, match_id, new_id, compositor_applied+list(spec.keys()), backend=backend)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/options.py", line 1511, in propagate_ids
    % new_id)
AssertionError: New option id 2951106455928858 does not match any option trees in Store.custom_options.

WARNING:param.dynamic_operation: Callable raised "AssertionError('New option id 4286036670735367693583064832671926448157 does not match any option trees in Store.custom_options.')".
Invoked as dynamic_operation(counter=0)
WARNING:param.dynamic_operation: Callable raised "AssertionError('New option id 4286036670735367693583064832671926448157 does not match any option trees in Store.custom_options.')".
Invoked as dynamic_operation(counter=0)
Traceback (most recent call last):
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/plotting/util.py", line 275, in get_plot_frame
    return map_obj[key]
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/spaces.py", line 1341, in __getitem__
    val = self._execute_callback(*tuple_key)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/spaces.py", line 1110, in _execute_callback
    retval = self.callback(*args, **kwargs)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/spaces.py", line 714, in __call__
    ret = self.callable(*args, **kwargs)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/util/__init__.py", line 1042, in dynamic_operation
    key, obj = resolve(key, kwargs)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/util/__init__.py", line 1031, in resolve
    return key, map_obj[key]
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/spaces.py", line 1341, in __getitem__
    val = self._execute_callback(*tuple_key)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/spaces.py", line 1110, in _execute_callback
    retval = self.callback(*args, **kwargs)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/spaces.py", line 714, in __call__
    ret = self.callable(*args, **kwargs)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/util/__init__.py", line 1043, in dynamic_operation
    return apply(obj, *key, **kwargs)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/util/__init__.py", line 1035, in apply
    processed = self._process(element, key, kwargs)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/util/__init__.py", line 1019, in _process
    return self.p.operation(element, **kwargs)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/accessors.py", line 625, in <lambda>
    dmap = Dynamic(obj, operation=lambda obj, **dynkwargs: obj.opts(*args, **kwargs),
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/accessors.py", line 37, in pipelined_call
    return __call__(*args, **kwargs)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/accessors.py", line 573, in __call__
    return self._dispatch_opts( *args, **kwargs)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/accessors.py", line 577, in _dispatch_opts
    return self._base_opts(*args, **kwargs)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/accessors.py", line 656, in _base_opts
    return self._obj.options(*new_args, **kwargs)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/dimension.py", line 1307, in options
    obj = obj.opts._dispatch_opts(expanded, backend=backend, clone=clone)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/accessors.py", line 577, in _dispatch_opts
    return self._base_opts(*args, **kwargs)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/accessors.py", line 653, in _base_opts
    return opts.apply_groups(self._obj, **dict(kwargs, **new_kwargs))
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/util/__init__.py", line 244, in apply_groups
    obj = cls._apply_groups_to_backend(obj, backend_opts, backend, clone)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/util/__init__.py", line 169, in _apply_groups_to_backend
    return StoreOptions.set_options(obj_handle, options, backend=backend)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/options.py", line 1843, in set_options
    applied = cls.propagate_ids(obj, match_id, new_id, compositor_applied+list(spec.keys()), backend=backend)
  File "/Users/matus/miniconda3/envs/anyscale-academy/lib/python3.7/site-packages/holoviews/core/options.py", line 1511, in propagate_ids
    % new_id)
AssertionError: New option id 4286036670735367693583064832671926448157 does not match any option trees in Store.custom_options.

[04-Ray-Multiprocessing] 'BatchedCalls' object has no attribute '_reducer_callback'

image

Running the function ('with joblib.parallel_backend('ray'):') causes following error.

error message :
/usr/local/lib/python3.6/dist-packages/ray/util/multiprocessing/pool.py in _convert_to_ray_batched_calls_if_needed(self, func)
621 if isinstance(func, BatchedCalls):
622 func = RayBatchedCalls(func.items, (func._backend, func._n_jobs),
--> 623 func._reducer_callback, func._pickle_cache)
624 # go through all the items and replace args and kwargs with
625 # ObjectRefs, caching them in registries

AttributeError: 'BatchedCalls' object has no attribute '_reducer_callback'

AssertionError when run 01-Ray-Tasks.ipynb

When I run first cell:

from task_lesson_util import make_dmaps, run_simulations, stop_simulations
from pi_calc import str_large_n

It appears following error:

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-1-9c851064aaf9> in <module>
----> 1 from task_lesson_util import make_dmaps, run_simulations, stop_simulations
      2 from pi_calc import str_large_n

~/code/ray/academy/ray-crash-course/task_lesson_util.py in <module>
     15 from bokeh.plotting import figure, output_file, show
     16 
---> 17 from pi_calc import MonteCarloPi, compute_pi_for
     18 
     19 

~/code/ray/academy/ray-crash-course/pi_calc.py in <module>
    104 
    105 @ray.remote
--> 106 class RayMonteCarloPi(MonteCarloPi):
    107     @ray.method(num_returns=5)
    108     def sample(self, num_samples):

~/code/ray/academy/ray-crash-course/pi_calc.py in RayMonteCarloPi()
    105 @ray.remote
    106 class RayMonteCarloPi(MonteCarloPi):
--> 107     @ray.method(num_returns=5)
    108     def sample(self, num_samples):
    109         return super().sample(num_samples)

~/anaconda3/envs/anyscale-academy/lib/python3.7/site-packages/ray/actor.py in method(*args, **kwargs)
     37     assert len(args) == 0
     38     assert len(kwargs) == 1
---> 39     assert "num_return_vals" in kwargs
     40     num_return_vals = kwargs["num_return_vals"]
     41 

AssertionError: 

What's the problem? Could you please help!

Support running in a Docker image on a local machine

The current Docker image support only runs on the Anyscale platform. All the pieces are in place for local use, but properly configuring the image for Jupyter Lab execution, including exposing the correct ports, needs to be done.

ray-crash-course/06-Exploring-Ray-API-Calls.ipynb there is an incorrect API parameter

In part @ray.remote(),the argument named num_return_vals is different from that in the Ray Docs.

When I execute the sample code given in notebook:

@ray.remote(num_return_vals=3)
def tuple3(one, two, three):
    return (one, two, three)
...

The following error will appear:

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-9-05124ba20d56> in <module>
----> 1 @ray.remote(num_return_vals=3)
      2 def tuple3(one, two, three):
      3     return (one, two, three)
      4 
      5 x_ref, y_ref, z_ref = tuple3.remote("a", 1, 2.2)

~/opt/anaconda3/envs/anyscale-academy/lib/python3.7/site-packages/ray/worker.py in remote(*args, **kwargs)
   1926             "max_task_retries",
   1927             "max_retries",
-> 1928         ], error_string
   1929 
   1930     num_cpus = kwargs["num_cpus"] if "num_cpus" in kwargs else None

AssertionError: The @ray.remote decorator must be applied either with no arguments and no parentheses, for example '@ray.remote', or it must be applied using some of the arguments 'num_returns', 'num_cpus', 'num_gpus', 'memory', 'object_store_memory', 'resources', 'max_calls', or 'max_restarts', like '@ray.remote(num_returns=2, resources={"CustomResource": 1})'.

I checked the documentation Ray v2.0.0.dev0 and the correct parameters should be as follows:

@ray.remote(num_returns=3)
...

checkpoint for Tune's PBT

For Tune's PopulationBasedTraining, Ray doc says checkpoint is needed (to load and save weights etc), but academy pbt example given doesn't have it. Why?

TuneError: ('Trials did not complete', [contrib_LinUCB_SimpleContextualBandit_65d05_00000])

Hey there,

Just having issues with Cell 9 of the 03-Simple-Multi-Armed-Bandit notebook. Everything else runs fine except until that point. In particular, I have ray intialized correctly and the following

ray.init(address='auto', ignore_reinit_error=True)

generates:

{'node_ip_address': '192.168.1.105', 'raylet_ip_address': '192.168.1.105', 'redis_address': '192.168.1.105:6379', 'object_store_address': '/tmp/ray/session_2020-07-18_20-05-29_369775_4270/sockets/plasma_store', 'raylet_socket_name': '/tmp/ray/session_2020-07-18_20-05-29_369775_4270/sockets/raylet', 'webui_url': 'localhost:8265', 'session_dir': '/tmp/ray/session_2020-07-18_20-05-29_369775_4270'}

The error occurs as follows:

start_time = time.time()
analysis = ray.tune.run("contrib/LinUCB", config=config, stop=stop, progress_reporter=JupyterNotebookReporter(overwrite=False), # This is the default, actually. verbose=2, # Change to 0 or 1 to reduce the output. ray_auto_init=False, # Don't allow Tune to initialize Ray. )

Generates:

`== Status ==
Memory usage on this node: 7.5/15.6 GiB
Using FIFO scheduling algorithm.
Resources requested: 0/4 CPUs, 0/2 GPUs, 0.0/8.06 GiB heap, 0.0/2.78 GiB objects
Result logdir: /home/paul/ray_results/contrib/LinUCB
Number of trials: 1 (1 ERROR)
Trial name status loc
contrib_LinUCB_SimpleContextualBandit_65d05_00000 ERROR

Number of errored trials: 1
Trial name # failures error file
contrib_LinUCB_SimpleContextualBandit_65d05_00000 1 /home/paul/ray_results/contrib/LinUCB/contrib_LinUCB_SimpleContextualBandit_0_2020-07-19_00-46-00_376v7hp/error.txt


TuneError Traceback (most recent call last)
in
4 progress_reporter=JupyterNotebookReporter(overwrite=False), # This is the default, actually.
5 verbose=2, # Change to 0 or 1 to reduce the output.
----> 6 ray_auto_init=False, # Don't allow Tune to initialize Ray.
7 )

~/anaconda3/envs/anyscale-academy/lib/python3.7/site-packages/ray/tune/tune.py in run(run_or_experiment, name, stop, config, resources_per_trial, num_samples, local_dir, upload_dir, trial_name_creator, loggers, sync_to_cloud, sync_to_driver, checkpoint_freq, checkpoint_at_end, sync_on_checkpoint, keep_checkpoints_num, checkpoint_score_attr, global_checkpoint_period, export_formats, max_failures, fail_fast, restore, search_alg, scheduler, with_server, server_port, verbose, progress_reporter, resume, queue_trials, reuse_actors, trial_executor, raise_on_failed_trial, return_trials, ray_auto_init)
347 if incomplete_trials:
348 if raise_on_failed_trial:
--> 349 raise TuneError("Trials did not complete", incomplete_trials)
350 else:
351 logger.error("Trials did not complete: %s", incomplete_trials)

TuneError: ('Trials did not complete', [contrib_LinUCB_SimpleContextualBandit_65d05_00000])
`

Add an exercise solutions notebook for recsys

While the exercises are mostly intended to promote exploration, it would be good provide solutions to discuss what can be learned from the explorations. Follow the example of other solutions notebooks...

unsupported locale setting in `setlocale(local.getlocale())`

Set locale like locale.setlocale(locale.LC_ALL, locale.getlocale()) here fails using python3.6 from the pip installation.

Example:

import locale
import sys

print(locale.getlocale())
print(sys.version)
locale.setlocale(locale.LC_ALL, locale.getlocale())

Returns:

('en_US', 'UTF-8')
3.6.9 (default, Apr 18 2020, 01:56:04) 
[GCC 8.4.0]
---------------------------------------------------------------------------
Error                                     Traceback (most recent call last)
<ipython-input-18-e1d930bcc3dd> in <module>
      4 print(locale.getlocale())
      5 print(sys.version)
----> 6 locale.setlocale(locale.LC_ALL, locale.getlocale())

/code/venvs/venv/lib/python3.6/locale.py in setlocale(category, locale)
    596         # convert to string
    597         locale = normalize(_build_localename(locale))
--> 598     return _setlocale(category, locale)
    599 
    600 def resetlocale(category=LC_ALL):

Error: unsupported locale setting

Resolved from the docs suggestion to set like locale.setlocale(locale.LC_ALL, ''), but not sure if that has the same behavior. Could just require users not to use python3.6 in the README.

num_return_vals issue

Hello,
The argument num_return_vals is no longer valid in ray functions but tutorials still use it. I suggest updating them accordingly.
Cheers.

calculate the distance between user's ratings to cluster's centers

In ray-rllib/recsys/01-Ressys, i found there may be a problem in calculate the distance between user's ratings to cluster's centers.
It is in the step function in env class JokeRec:
  scaled_diff = abs(c[item] - rating) / 2.0
The shape for c (which is centers[i]) is 1* 24983, stands for the features in i cluster. However, item is is randomly chosen from the cluster, and the range is [0, 99]. The rest [100, 24983] in the center[i] cannot be searched. Is c[item] - rating a correct way to calculate that distance?

Invalid parameter in first Tune notebook

The very first example that Tune course runs is defined like this:

analysis = tune.run(
    "PPO",                                    # Use proximal policy optimization to train 
    stop={"episode_reward_mean": 400},        # Stopping criteria, when average reward over the episodes
                                              # of training equals 400 out of a maximum possible 500 score.
    config={
        "env": "CartPole-v1",                 # Tune can associate this string with the environment.
        "num_gpus": 0,                        # If you have GPUs, go for it!
        "num_workers": 3,                     # Number of Ray workers to use; Use one LESS than 
                                              # the number of cores you wan to use (or omit this argument)!
        "model": {                            # The NN model we'll optimize.
            'fcnet_hiddens': [                # "Fully-connected network with N hidden layers".
                tune.grid_search([20, 40]),   # Try these four values for layer one.
                tune.grid_search([20, 40])    # Try these four values for layer one.
            ]
        },
        "eager": False,                       # Flag for TensorFlow; don't use eager evaluation.
    },
    verbose=1
)

This failed for me, saying that Tensorflow doesn't recognize eager parameter. So I've removed it, and it failed again, this time there was some TF/Numpy conversion issue. Then I found this issue , and it confirms that eager should not be used anymore. Following the conversation there, I got the following working code:

analysis = tune.run(
    "PPO",                                    # Use proximal policy optimization to train 
    stop={"episode_reward_mean": 400},        # Stopping criteria, when average reward over the episodes
                                              # of training equals 400 out of a maximum possible 500 score.
    config={
        "env": "CartPole-v1",                 # Tune can associate this string with the environment.
        "num_gpus": 0,                        # If you have GPUs, go for it!
        "num_workers": 3,                     # Number of Ray workers to use; Use one LESS than 
                                              # the number of cores you wan to use (or omit this argument)!
        "model": {                            # The NN model we'll optimize.
            'fcnet_hiddens': [                # "Fully-connected network with N hidden layers".
                tune.grid_search([20, 40]),   # Try these four values for layer one.
                tune.grid_search([20, 40])    # Try these four values for layer one.
            ]
        },
        "framework": "tfe",
        #"eager": False,                       # Flag for TensorFlow; don't use eager evaluation.
    },
    verbose=1
)

Not sure if this is the proper fix, so just an issue here and not a PR. But hopefully that helps the next person going through the Tune course.

file_1 and file_2 missing from crash course

I tried to run

obj_ref_arr1 = read_array.remote("data/file_1.txt") print(f"array 1: {obj_ref_arr1}")

and received

raise IOError("%s not found." % path) OSError: data/file_1.txt not found.

Live Plots Not Updating

Thanks for the excellent tutorial! The live plots are not updating (Mac OS). Any ideas on how to get them working or how to debug it?

Unsafe command in README

In the README, we have the command

tools/cleanup.sh | while read x; do rm -rf $x; done

This seems dangerous in case the user runs it from the wrong location or something. Can we get rid of this?

Crash course, notebook 01 Tasks - unreadable text

Hi, and thanks for the course! Very nice material to work through.

The issue is about the very beginning of the first notebook in the crash course. Here is what the first section of the notebook outputs on my laptop:

unreadable_text_on_circles

At least on my laptop this is unreadable, black letters on deep dark blue background. Is this machine specific? Perhaps I didn't properly install something?

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.