Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 53 additions & 32 deletions doc/source/cluster/vms/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,43 +29,50 @@ Setup

Before we start, you will need to install some Python dependencies as follows:

.. tabs::
.. tab-set::

.. tab:: Ray Team Supported
.. tab-item:: Ray Team Supported
:sync: Ray Team Supported

.. tabs::
.. tab-set::

.. tab:: AWS
.. tab-item:: AWS
:sync: AWS

.. code-block:: shell

$ pip install -U "ray[default]" boto3

.. tab:: GCP
.. tab-item:: GCP
:sync: GCP

.. code-block:: shell

$ pip install -U "ray[default]" google-api-python-client

.. tab:: Community Supported
.. tab-item:: Community Supported
:sync: Community Supported

.. tabs::
.. tab-set::

.. tab:: Azure
.. tab-item:: Azure
:sync: Azure

.. code-block:: shell

$ pip install -U "ray[default]" azure-cli azure-core

.. tab:: Aliyun
.. tab-item:: Aliyun
:sync: Aliyun

.. code-block:: shell

$ pip install -U "ray[default]" aliyun-python-sdk-core aliyun-python-sdk-ecs

Aliyun Cluster Launcher Maintainers (GitHub handles): @zhuangzhuang131419, @chenk008

.. tab:: vSphere
.. tab-item:: vSphere
:sync: vSphere

.. code-block:: shell

Expand All @@ -76,36 +83,43 @@ Before we start, you will need to install some Python dependencies as follows:

Next, if you're not set up to use your cloud provider from the command line, you'll have to configure your credentials:

.. tabs::
.. tab-set::

.. tab:: Ray Team Supported
.. tab-item:: Ray Team Supported
:sync: Ray Team Supported

.. tabs::
.. tab-set::

.. tab:: AWS
.. tab-item:: AWS
:sync: AWS

Configure your credentials in ``~/.aws/credentials`` as described in `the AWS docs <https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html>`_.

.. tab:: GCP
.. tab-item:: GCP
:sync: GCP

Set the ``GOOGLE_APPLICATION_CREDENTIALS`` environment variable as described in `the GCP docs <https://cloud.google.com/docs/authentication/getting-started>`_.

.. tab:: Community Supported
.. tab-item:: Community Supported
:sync: Community Supported

.. tabs::
.. tab-set::

.. tab:: Azure
.. tab-item:: Azure
:sync: Azure

Log in using ``az login``, then configure your credentials with ``az account set -s <subscription_id>``.

.. tab:: Aliyun
.. tab-item:: Aliyun
:sync: Aliyun

Obtain and set the AccessKey pair of the Aliyun account as described in `the docs <https://www.alibabacloud.com/help/en/doc-detail/175967.htm>`__.

Make sure to grant the necessary permissions to the RAM user and set the AccessKey pair in your cluster config file.
Refer to the provided `aliyun/example-full.yaml </ray/python/ray/autoscaler/aliyun/example-full.yaml>`__ for a sample cluster config.

.. tab:: vSphere
.. tab-item:: vSphere
:sync: vSphere

.. code-block:: shell

Expand Down Expand Up @@ -205,18 +219,21 @@ To start a Ray Cluster, first we need to define the cluster configuration. The c

A minimal sample cluster configuration file looks as follows:

.. tabs::
.. tab-set::

.. tab:: Ray Team Supported
.. tab-item:: Ray Team Supported
:sync: Ray Team Supported

.. tabs::
.. tab-set::

.. tab:: AWS
.. tab-item:: AWS
:sync: AWS

.. literalinclude:: ../../../../python/ray/autoscaler/aws/example-minimal.yaml
:language: yaml

.. tab:: GCP
.. tab-item:: GCP
:sync: GCP

.. code-block:: yaml

Expand All @@ -228,11 +245,13 @@ A minimal sample cluster configuration file looks as follows:
type: gcp
region: us-west1

.. tab:: Community Supported
.. tab-item:: Community Supported
:sync: Community Supported

.. tabs::
.. tab-set::

.. tab:: Azure
.. tab-item:: Azure
:sync: Azure

.. code-block:: yaml

Expand All @@ -254,13 +273,15 @@ A minimal sample cluster configuration file looks as follows:
# changes to this should match what is specified in file_mounts
ssh_public_key: ~/.ssh/id_rsa.pub

.. tab:: Aliyun
.. tab-item:: Aliyun
:sync: Aliyun

Please refer to `example-full.yaml </ray/python/ray/autoscaler/aliyun/example-full.yaml>`__.
Please refer to `example-full.yaml </ray/python/ray/autoscaler/aliyun/example-full.yaml>`__.

Make sure your account balance is not less than 100 RMB, otherwise you will receive the error `InvalidAccountStatus.NotEnoughBalance`.

.. tab:: vSphere
.. tab-item:: vSphere
:sync: vSphere

.. literalinclude:: ../../../../python/ray/autoscaler/vsphere/example-minimal.yaml
:language: yaml
Expand Down
32 changes: 19 additions & 13 deletions doc/source/data/batch_inference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ Using Ray Data for offline inference involves four basic steps:
For more in-depth examples for your use case, see :ref:`the batch inference examples<batch_inference_examples>`.
For how to configure batch inference, see :ref:`the configuration guide<batch_inference_configuration>`.

.. tabs::
.. tab-set::

.. group-tab:: HuggingFace
.. tab-item:: HuggingFace
:sync: HuggingFace

.. testcode::

Expand Down Expand Up @@ -84,7 +85,8 @@ For how to configure batch inference, see :ref:`the configuration guide<batch_in
{'data': 'Complete this', 'output': 'Complete this information or purchase any item from this site.\n\nAll purchases are final and non-'}


.. group-tab:: PyTorch
.. tab-item:: PyTorch
:sync: PyTorch

.. testcode::

Expand Down Expand Up @@ -133,7 +135,8 @@ For how to configure batch inference, see :ref:`the configuration guide<batch_in

{'output': array([0.5590901], dtype=float32)}

.. group-tab:: TensorFlow
.. tab-item:: TensorFlow
:sync: TensorFlow

.. testcode::

Expand Down Expand Up @@ -204,9 +207,10 @@ To use GPUs for inference, make the following changes to your code:

The remaining is the same as the :ref:`Quickstart <batch_inference_quickstart>`.

.. tabs::
.. tab-set::

.. group-tab:: HuggingFace
.. tab-item:: HuggingFace
:sync: HuggingFace

.. testcode::

Expand Down Expand Up @@ -246,7 +250,8 @@ The remaining is the same as the :ref:`Quickstart <batch_inference_quickstart>`.
{'data': 'Complete this', 'output': 'Complete this poll. Which one do you think holds the most promise for you?\n\nThank you'}


.. group-tab:: PyTorch
.. tab-item:: PyTorch
:sync: PyTorch

.. testcode::

Expand Down Expand Up @@ -292,7 +297,8 @@ The remaining is the same as the :ref:`Quickstart <batch_inference_quickstart>`.

{'output': array([0.5590901], dtype=float32)}

.. group-tab:: TensorFlow
.. tab-item:: TensorFlow
:sync: TensorFlow

.. testcode::

Expand Down Expand Up @@ -471,7 +477,7 @@ In this case, use :meth:`XGBoostTrainer.get_model() <ray.train.xgboost.XGBoostTr
The rest of the logic looks the same as in the `Quickstart <#quickstart>`_.

.. testcode::

from typing import Dict
import pandas as pd
import numpy as np
Expand All @@ -485,18 +491,18 @@ The rest of the logic looks the same as in the `Quickstart <#quickstart>`_.
class XGBoostPredictor:
def __init__(self, checkpoint: Checkpoint):
self.model = XGBoostTrainer.get_model(checkpoint)

def __call__(self, data: pd.DataFrame) -> Dict[str, np.ndarray]:
dmatrix = xgboost.DMatrix(data)
return {"predictions": self.model.predict(dmatrix)}


# Use 2 parallel actors for inference. Each actor predicts on a
# different partition of data.
scale = ray.data.ActorPoolStrategy(size=2)
# Map the Predictor over the Dataset to get predictions.
predictions = test_dataset.map_batches(
XGBoostPredictor,
XGBoostPredictor,
compute=scale,
batch_format="pandas",
# Pass in the Checkpoint to the XGBoostPredictor constructor.
Expand Down
Loading