Skip to content

Commit

Permalink
Clean up Ray AIR references in code (ray-project#39490)
Browse files Browse the repository at this point in the history
  • Loading branch information
richardliaw authored Sep 9, 2023
1 parent f9b1944 commit dc3d163
Show file tree
Hide file tree
Showing 34 changed files with 48 additions and 53 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This is a RayCluster configuration for exploration of the 100Gi Ray AIR XGBoostTrainer benchmark.
# This is a RayCluster configuration for exploration of the 100Gi Ray XGBoostTrainer benchmark.

# This configuration here modifies the file xgboost-benchmark.yaml in this directory
# to demonstrate autoscaling.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This is a RayCluster configuration for exploration of the 100Gi Ray AIR XGBoostTrainer benchmark.
# This is a RayCluster configuration for exploration of the 100Gi Ray XGBoostTrainer benchmark.

# The configuration includes 1 Ray head pod and 9 Ray worker pods.
# Each Ray container requests 54 Gi memory and 14 CPU.
Expand Down
2 changes: 1 addition & 1 deletion doc/source/cluster/vms/configs/xgboost-benchmark.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This is a Ray cluster configuration for exploration of the 100Gi Ray AIR XGBoostTrainer benchmark.
# This is a Ray cluster configuration for exploration of the 100Gi Ray XGBoostTrainer benchmark.

# The configuration includes 1 Ray head node and 9 worker nodes.

Expand Down
Binary file modified doc/source/ray-air/images/air_arch_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion doc/source/ray-overview/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Use Ray to scale applications on your laptop or the cloud. Choose the right guid


(libraries-quickstart)=
## Ray AI Runtime Libraries Quickstart
## Ray AI Libraries Quickstart

Use individual libraries for ML workloads. Click on the dropdowns for your workload below.

Expand Down
2 changes: 1 addition & 1 deletion doc/source/ray-overview/use-cases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ Learn more about reinforcement learning with the following resources.
ML Platform
-----------

Ray and its AI Runtime libraries provide unified compute runtime for teams looking to simplify their ML platform.
Ray and its AI libraries provide unified compute runtime for teams looking to simplify their ML platform.
Ray's libraries such as Ray Train, Ray Data, and Ray Serve can be used to compose end-to-end ML workflows, providing features and APIs for
data preprocessing as part of training, and transitioning from training to serving.

Expand Down
2 changes: 1 addition & 1 deletion doc/source/templates/02_many_model_training/start.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@
"source": [
"## Summary\n",
"\n",
"This template is a quickstart to using [Ray Tune](https://docs.ray.io/en/latest/tune/index.html) for many model training. Ray Tune is one of many libraries under the [Ray AI Runtime](https://docs.ray.io/en/latest/ray-air/getting-started.html). See [this blog post](https://www.anyscale.com/blog/training-one-million-machine-learning-models-in-record-time-with-ray) for more information on the benefits of performing many model training with Ray!\n",
"This template is a quickstart to using [Ray Tune](https://docs.ray.io/en/latest/tune/index.html) for many model training. See [this blog post](https://www.anyscale.com/blog/training-one-million-machine-learning-models-in-record-time-with-ray) for more information on the benefits of performing many model training with Ray!\n",
"\n",
"At a high level, this template showed how to do the following:\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@
"source": [
"## Summary\n",
"\n",
"This template used [Ray Serve](https://docs.ray.io/en/latest/serve/index.html) to serve many replicas of a stable diffusion model. Ray Serve is one of many libraries under the [Ray AI Runtime](https://docs.ray.io/en/latest/ray-air/getting-started.html).\n",
"This template used [Ray Serve](https://docs.ray.io/en/latest/serve/index.html) to serve many replicas of a stable diffusion model. \n",
"\n",
"At a high level, this template showed how to:\n",
"1. Define a Ray Serve deployment to load a HuggingFace model and perform inference.\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

# LoRA related imports end ##
from diffusers.utils.import_utils import is_xformers_available
from ray.air import ScalingConfig
from ray.train import ScalingConfig
from ray import train
from ray.train.torch import TorchTrainer
import torch
Expand Down
4 changes: 2 additions & 2 deletions doc/source/train/examples/pytorch/torch_detection.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"source": [
"# Fine-tuning a Torch object detection model\n",
"\n",
"This tutorial explains how to fine-tune `fasterrcnn_resnet50_fpn` using the Ray AI Runtime libraries for parallel data ingest and training.\n",
"This tutorial explains how to fine-tune `fasterrcnn_resnet50_fpn` using the Ray AI libraries for parallel data ingest and training.\n",
"\n",
"Here's what you'll do:\n",
"1. Load raw images and [VOC-style](http://host.robots.ox.ac.uk/pascal/VOC/) annotations into a Dataset\n",
Expand All @@ -29,7 +29,7 @@
"id": "e9a6d043",
"metadata": {},
"source": [
"* Install the dependencies for Ray AI Runtime libraries."
"* Install the dependencies for Ray Data and Ray Train."
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions doc/source/tune/examples/pbt_ppo_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"import random\n",
"\n",
"import ray\n",
"from ray import air, tune\n",
"from ray import train, tune\n",
"from ray.tune.schedulers import PopulationBasedTraining\n",
"\n",
"if __name__ == \"__main__\":\n",
Expand Down Expand Up @@ -111,7 +111,7 @@
" \"sgd_minibatch_size\": tune.choice([128, 512, 2048]),\n",
" \"train_batch_size\": tune.choice([10000, 20000, 40000]),\n",
" },\n",
" run_config=air.RunConfig(stop=stopping_criteria),\n",
" run_config=train.RunConfig(stop=stopping_criteria),\n",
" )\n",
" results = tuner.fit()\n"
]
Expand Down
4 changes: 2 additions & 2 deletions doc/source/tune/tutorials/tune-distributed.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ reduce synchronization overhead. For this, you just have to specify a remote ``s

.. code-block:: python
from ray import air, tune
from ray import train, tune
from my_module import my_trainable
tuner = tune.Tuner(
my_trainable,
run_config=air.RunConfig(
run_config=train.RunConfig(
name="experiment_name",
storage_path="s3://bucket-name/sub-path/",
)
Expand Down
4 changes: 2 additions & 2 deletions doc/source/tune/tutorials/tune-storage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ All we need to do is **set the shared network filesystem as the path to save res

.. code-block:: python
from ray import air, tune
from ray import train, tune
tuner = tune.Tuner(
trainable,
run_config=air.RunConfig(
run_config=train.RunConfig(
name="experiment_name",
storage_path="/mnt/path/to/shared/storage/",
)
Expand Down
2 changes: 1 addition & 1 deletion python/ray/air/integrations/keras.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def on_predict_end(self, logs=None):

@PublicAPI(stability="alpha")
class ReportCheckpointCallback(_Callback):
"""Keras callback for Ray AIR reporting and checkpointing.
"""Keras callback for Ray Train reporting and checkpointing.
.. note::
Metrics are always reported with checkpoints, even if the event isn't specified
Expand Down
2 changes: 1 addition & 1 deletion python/ray/air/util/check_ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def make_local_dataset_iterator(
raise RuntimeError(
"make_local_dataset_iterator should only be used by the driver "
"for development and debugging. To consume a dataset from a "
"worker or AIR trainer, see "
"worker or Ray Train Trainer, see "
"https://docs.ray.io/en/latest/ray-air/check-ingest.html."
)

Expand Down
4 changes: 2 additions & 2 deletions python/ray/data/iterator.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class DataIterator(abc.ABC):
over the base Dataset. Note that for DatasetPipelines, each pass iterates over
the original Dataset, instead of a window (if ``.window()`` was used).
If using Ray AIR, each trainer actor should get its own iterator by calling
If using Ray Train, each trainer actor should get its own iterator by calling
:meth:`ray.train.get_dataset_shard("train")
<ray.train.get_dataset_shard>`.
Expand Down Expand Up @@ -896,7 +896,7 @@ def generator():

def iter_epochs(self, max_epoch: int = -1) -> None:
raise DeprecationWarning(
"If you are using AIR, note that ray.train.get_dataset_shard() "
"If you are using Ray Train, ray.train.get_dataset_shard() "
"returns a ray.data.DataIterator instead of a "
"DatasetPipeline as of Ray 2.3. "
"To iterate over one epoch of data, use iter_batches(), "
Expand Down
2 changes: 1 addition & 1 deletion python/ray/train/base_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class BaseTrainer(abc.ABC):
Note: The base ``BaseTrainer`` class cannot be instantiated directly. Only
one of its subclasses can be used.
Note to AIR developers: If a new AIR trainer is added, please update
Note to developers: If a new trainer is added, please update
`air/_internal/usage.py`.
**How does a trainer work?**
Expand Down
2 changes: 1 addition & 1 deletion python/ray/train/data_parallel_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ def _load_checkpoint_dict(
message.
Returns:
The model or weights and AIR preprocessor contained within.
The model or weights and preprocessor contained within.
"""
checkpoint_dict = checkpoint.to_dict()
preprocessor = checkpoint_dict.get(PREPROCESSOR_KEY, None)
Expand Down
6 changes: 3 additions & 3 deletions python/ray/train/lightning/lightning_checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def from_path(
raise ValueError(
f"`from_path()` expects a file path, but `{path}` is a directory. "
"A valid checkpoint file name is normally with .ckpt extension."
"If you have an AIR checkpoint folder, you can also try to use "
"If you have a Ray checkpoint folder, you can also try to use "
"`LightningCheckpoint.from_directory()` instead."
)

Expand Down Expand Up @@ -77,7 +77,7 @@ def __init__(self, input_dim, output_dim) -> None:
# ...
# After the training is finished, LightningTrainer saves AIR
# After the training is finished, LightningTrainer saves
# checkpoints in the result directory, for example:
# ckpt_dir = "{storage_path}/LightningTrainer_.*/checkpoint_000000"
Expand Down Expand Up @@ -196,7 +196,7 @@ def from_path(
raise ValueError(
f"`from_path()` expects a file path, but `{path}` is a directory. "
"A valid checkpoint file name is normally with .ckpt extension."
"If you have an AIR checkpoint folder, you can also try to use "
"If you have a Ray checkpoint folder, you can also try to use "
"`LightningCheckpoint.from_directory()` instead."
)

Expand Down
2 changes: 1 addition & 1 deletion python/ray/train/lightning/lightning_predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def __init__(self, input_dim, output_dim) -> None:
# ...
# After the training is finished, LightningTrainer saves AIR
# After the training is finished, LightningTrainer saves
# checkpoints in the result directory, for example:
# ckpt_dir = "{storage_path}/LightningTrainer_.*/checkpoint_000000"
Expand Down
8 changes: 4 additions & 4 deletions python/ray/train/lightning/lightning_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def checkpointing(self, **kwargs) -> "LightningConfigBuilder":
Note that this method is not a replacement for the
``ray.train.CheckpointConfig``. You still need to specify your
checkpointing strategy in ``CheckpointConfig``. Otherwise, AIR stores
checkpointing strategy in ``CheckpointConfig``. Otherwise, Ray stores
all the reported checkpoints by default.
Args:
Expand Down Expand Up @@ -459,14 +459,14 @@ def __init__(
def _unify_checkpoint_configs(
self, ptl_ckpt_config: Dict, air_ckpt_config: CheckpointConfig
) -> CheckpointConfig:
"""Unify the Lightning checkpointing config and the AIR CheckpointConfig."""
"""Unify the Lightning checkpointing config and the Ray CheckpointConfig."""

ptl_ckpt_metric = ptl_ckpt_config.get("monitor", None)
air_ckpt_metric = air_ckpt_config.checkpoint_score_attribute

if ptl_ckpt_metric and air_ckpt_metric and ptl_ckpt_metric != air_ckpt_metric:
logger.warning(
"You have specified different metrics to track in AIR "
"You have specified different metrics to track in "
"`CheckpointConfig` and Lightning ModelCheckpoint. "
"Make sure that you have logged both metrics before "
"a checkpoint is created."
Expand Down Expand Up @@ -600,7 +600,7 @@ def _lightning_train_loop_per_worker(config):

checkpoint = session.get_checkpoint()
if checkpoint:
checkpoint_log_message = "Resuming training from an AIR checkpoint."
checkpoint_log_message = "Resuming training from a checkpoint."
if "ckpt_path" in trainer_fit_params:
checkpoint_log_message += " `ckpt_path` will be ignored."
logger.info(checkpoint_log_message)
Expand Down
2 changes: 1 addition & 1 deletion python/ray/train/mosaic/mosaic_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def _validate_trainer_init_config(self, config) -> None:
if config is not None and "loggers" in config:
warnings.warn(
"Composer's Loggers (any subclass of LoggerDestination) are \
not supported for MosaicComposer. Use Ray AIR provided loggers instead"
not supported for MosaicComposer. Use Ray provided loggers instead"
)


Expand Down
2 changes: 1 addition & 1 deletion python/ray/tune/examples/cifar10_pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def train_cifar(config):
# Ray Tune and will potentially be accessed through in ``get_checkpoint()``
# in future iterations.
# Note to save a file like checkpoint, you still need to put it under a directory
# to construct an AIR checkpoint.
# to construct a checkpoint.
os.makedirs("my_model", exist_ok=True) # ok to overwrite the previous one.
path = os.path.join("my_model", "checkpoint.pt")
torch.save(
Expand Down
2 changes: 1 addition & 1 deletion python/ray/tune/examples/pbt_convnet_function_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def train_convnet(config):
# Every 5 steps, checkpoint our current state.
# First get the checkpoint directory from tune.
# Need to create a directory under current working directory
# to construct an AIR Checkpoint object from.
# to construct checkpoint object from.
os.makedirs("my_model", exist_ok=True)
torch.save(
{
Expand Down
2 changes: 1 addition & 1 deletion python/ray/tune/experiment/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ def get_experiment_checkpoint_dir(
Args:
run_obj: Trainable to run.
storage_path: The path to Ray AIR's result storage.
storage_path: The path to the specified result storage.
name: The name of the experiment specified by user.
Returns:
Expand Down
12 changes: 6 additions & 6 deletions python/ray/tune/impl/tuner_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ def _choose_run_config(
Args:
tuner_run_config: The run config passed into the Tuner constructor.
trainer: The AIR Trainer instance to use with Tune, which may have
trainer: The Trainer instance to use with Tune, which may have
a RunConfig specified by the user.
param_space: The param space passed to the Tuner.
Expand Down Expand Up @@ -562,8 +562,8 @@ def param_space(self, param_space: Optional[Dict[str, Any]]):
self._process_scaling_config()

def _convert_trainable(self, trainable: TrainableTypeOrTrainer) -> TrainableType:
"""Converts an AIR Trainer to a Tune trainable and saves the converted
trainable. If not using an AIR Trainer, this leaves the trainable as is."""
"""Converts a Trainer to a Tune trainable and saves the converted
trainable. If not using a Trainer, this leaves the trainable as is."""
from ray.train.trainer import BaseTrainer

return (
Expand Down Expand Up @@ -610,7 +610,7 @@ def _get_tune_run_arguments(self, trainable: TrainableType) -> Dict[str, Any]:
"You passed `checkpoint_frequency="
f"{checkpoint_config.checkpoint_frequency}` to your "
"CheckpointConfig, but this trainer does not support "
"this argument. If you passed in an AIR trainer that takes in a "
"this argument. If you passed in a Trainer that takes in a "
"custom training loop, you will need to "
"report a checkpoint every `checkpoint_frequency` iterations "
"within your training loop using "
Expand All @@ -621,7 +621,7 @@ def _get_tune_run_arguments(self, trainable: TrainableType) -> Dict[str, Any]:
# If we specifically support it, it's handled in the training loop,
# so we disable tune's bookkeeping.
checkpoint_config.checkpoint_frequency = 0
# Otherwise, the trainable is not an AIR trainer and we just keep the
# Otherwise, the trainable is not a Trainer and we just keep the
# user-supplied value.
# Function trainables will raise a runtime error later if set > 0
if checkpoint_config.checkpoint_at_end is not None:
Expand All @@ -633,7 +633,7 @@ def _get_tune_run_arguments(self, trainable: TrainableType) -> Dict[str, Any]:
"You passed `checkpoint_at_end="
f"{checkpoint_config.checkpoint_at_end}` "
"to your CheckpointConfig, but this trainer does not support "
"this argument. If you passed in an AIR trainer that takes in a "
"this argument. If you passed in a Trainer that takes in a "
"custom training loop, you should include one last call to "
"`ray.train.report(metrics=..., checkpoint=...)` "
"at the end of your training loop to get this behavior."
Expand Down
2 changes: 1 addition & 1 deletion python/ray/tune/trainable/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ def with_resources(
Args:
trainable: Trainable to wrap.
resources: Resource dict, placement group factory, AIR ``ScalingConfig``
resources: Resource dict, placement group factory, ``ScalingConfig``
or callable that takes in a config dict and returns a placement
group factory.
Expand Down
2 changes: 1 addition & 1 deletion python/ray/tune/tune.py
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ class and registered trainables.
"To enable trials to use GPUs, wrap `train_func` with "
"`tune.with_resources(train_func, resources_per_trial={'gpu': 1})` "
"which allows Tune to expose 1 GPU to each trial. "
"For Ray AIR Trainers, you can specify GPU resources "
"For Ray Train Trainers, you can specify GPU resources "
"through `ScalingConfig(use_gpu=True)`. "
"You can also override "
"`Trainable.default_resource_request` if using the "
Expand Down
2 changes: 1 addition & 1 deletion python/ray/tune/tune_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class TuneConfig:
and stop actors often (e.g., PBT in time-multiplexing mode). This
requires trials to have the same resource requirements.
Defaults to ``True`` for function trainables (including most
Ray AIR trainers) and ``False`` for class and registered trainables
Ray Train Trainers) and ``False`` for class and registered trainables
(e.g. RLlib).
trial_name_creator: Optional function that takes in a Trial and returns
its name (i.e. its string representation). Be sure to include some unique
Expand Down
3 changes: 1 addition & 2 deletions python/ray/util/horovod/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
raise DeprecationWarning(
"ray.util.horovod has been removed as of Ray 2.0. Instead, use the `horovod` "
"library directly or the `HorovodTrainer` in Ray AIR ("
"https://docs.ray.io/en/master/ray-air/getting-started.html)"
"library directly or the `HorovodTrainer` in Ray Train."
)
3 changes: 1 addition & 2 deletions python/ray/util/lightgbm/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
raise DeprecationWarning(
"ray.util.lightgbm has been removed as of Ray 2.0. Instead, use the `lightgbm-ray` "
"library directly or the `LightGBMTrainer` in Ray AIR ("
"https://docs.ray.io/en/master/ray-air/getting-started.html)"
"library directly or the `LightGBMTrainer` in Ray Train."
)
4 changes: 1 addition & 3 deletions python/ray/util/sgd/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
raise DeprecationWarning(
"Ray SGD has been deprecated as of Ray 1.13. For distributed "
"deep learning on Ray please use Ray AI Runtime (Ray AIR) "
"instead ("
"https://docs.ray.io/en/master/ray-air/getting-started.html)."
"deep learning on Ray please use Ray Train instead."
)
3 changes: 1 addition & 2 deletions python/ray/util/xgboost/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
raise DeprecationWarning(
"ray.util.xgboost has been removed as of Ray 2.0. Instead, use the `xgboost-ray` "
"library directly or the `XGBoostTrainer` in Ray AIR ("
"https://docs.ray.io/en/master/ray-air/getting-started.html)"
"library directly or the `XGBoostTrainer` in Ray Train."
)
Loading

0 comments on commit dc3d163

Please sign in to comment.