Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[train][2.7][3/n] cherry-picks for documentations, tests, examples #39368

Merged
merged 12 commits into from
Sep 7, 2023
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
18 changes: 15 additions & 3 deletions .buildkite/pipeline.ml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
- ./ci/env/env_info.sh
- ./ci/run/run_bazel_test_with_sharding.sh
--config=ci $(./ci/run/bazel_export_options)
--test_tag_filters=-gpu_only,-gpu,-minimal,-tune,-doctest
--test_tag_filters=-gpu_only,-gpu,-minimal,-tune,-doctest,-needs_credentials
python/ray/train/...

- label: ":steam_locomotive: :octopus: Train + Tune tests and examples"
Expand All @@ -52,8 +52,20 @@
- cleanup() { if [ "${BUILDKITE_PULL_REQUEST}" = "false" ]; then ./ci/build/upload_build_info.sh; fi }; trap cleanup EXIT
- TRAIN_TESTING=1 TUNE_TESTING=1 ./ci/env/install-dependencies.sh
- ./ci/env/env_info.sh
- bazel test --config=ci $(./ci/run/bazel_export_options) --build_tests_only --test_tag_filters=tune,-gpu_only,-ray_air,-gpu,-doctest python/ray/train/...

- bazel test --config=ci $(./ci/run/bazel_export_options) --build_tests_only --test_tag_filters=tune,-gpu_only,-ray_air,-gpu,-doctest,-needs_credentials python/ray/train/...

# - label: ":train: :key: Train examples with authentication"
# conditions: ["NO_WHEELS_REQUIRED", "RAY_CI_TRAIN_AFFECTED", "RAY_CI_BRANCH_BUILD"]
# instance_size: medium
# commands:
# - if [ "$BUILDKITE_PULL_REQUEST" != "false" ]; then exit 0; fi
# - cleanup() { if [ "${BUILDKITE_PULL_REQUEST}" = "false" ]; then ./ci/build/upload_build_info.sh; fi }; trap cleanup EXIT
# - TRAIN_TESTING=1 ./ci/env/install-dependencies.sh
# - ./ci/env/env_info.sh
# - credentials=$(python ./ci/env/setup_credentials.py)
# - credential_exit_code=$$?
# - if [ $credential_exit_code -eq 0 ]; then echo "Credentials are fetched successfully"; bazel test --config=ci $(./ci/run/bazel_export_options) --build_tests_only --test_tag_filters=needs_credentials
# python/ray/train/... $credentials; else echo "Credentials cannot be fetched"; exit 1; fi

- label: ":brain: RLlib: Benchmarks (Torch 2.x)"
conditions: ["NO_WHEELS_REQUIRED", "RAY_CI_RLLIB_AFFECTED"]
Expand Down
50 changes: 50 additions & 0 deletions ci/env/setup_credentials.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"""
This script sets up credentials for some services in the
CI environment.
This prints out credentials in the following format, to be ingested
by as bazel test envs.
--test_env=WANDB_API_KEY=abcd --test_env=COMET_API_KEY=efgh
"""
import boto3
import json
import sys

AWS_AIR_SECRETS_ARN = (
"arn:aws:secretsmanager:us-west-2:029272617770:secret:"
"oss-ci/ray-air-test-secrets20221014164754935800000002-UONblX"
)


def get_ray_air_secrets(client):
raw_string = client.get_secret_value(SecretId=AWS_AIR_SECRETS_ARN)["SecretString"]
return json.loads(raw_string)


SERVICES = {
"wandb_key": "WANDB_API_KEY",
"comet_ml_token": "COMET_API_KEY",
}


def main():

try:
client = boto3.client("secretsmanager", region_name="us-west-2")
ray_air_secrets = get_ray_air_secrets(client)
except Exception as e:
print(f"Could not get Ray AIR secrets: {e}")
sys.exit(1)
return

print(
" ".join(
[
f"--test_env={SERVICES[key]}={ray_air_secrets[key]}"
for key in SERVICES.keys()
]
)
)


if __name__ == "__main__":
main()
12 changes: 0 additions & 12 deletions doc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -196,18 +196,6 @@ py_test_run_all_subdirectory(
tags = ["exclusive", "team:rllib"],
)

# --------------------------------------------------------------------
# Test all doc/source/ray-air/doc_code code included in rst/md files.
# --------------------------------------------------------------------

py_test_run_all_subdirectory(
size = "large",
include = ["source/ray-air/doc_code/*.py"],
exclude = [],
extra_srcs = [],
tags = ["exclusive", "team:ml"],
)

# --------------------------------------------------------------------
# Test all doc/source/train/doc_code code included in rst/md files.
# --------------------------------------------------------------------
Expand Down
14 changes: 1 addition & 13 deletions doc/source/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -386,17 +386,5 @@ parts:
- file: cluster/usage-stats
- file: ray-references/glossary

- file: ray-contribute/stability
- file: ray-contribute/index
title: Developer Guides
sections:
- file: ray-contribute/getting-involved
sections:
- file: ray-contribute/development
- file: ray-contribute/docs
- file: ray-contribute/writing-code-snippets
- file: ray-contribute/fake-autoscaler
- file: ray-core/examples/testing-tips
- file: ray-contribute/debugging.rst
- file: ray-contribute/profiling.rst
- file: ray-core/configure
- file: ray-contribute/whitepaper
67 changes: 2 additions & 65 deletions doc/source/data/examples/batch_training.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -85,72 +85,9 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2022-12-08 17:04:06,689\tINFO worker.py:1223 -- Using address localhost:9031 set in the environment variable RAY_ADDRESS\n",
"2022-12-08 17:04:06,691\tINFO worker.py:1333 -- Connecting to existing Ray cluster at address: 172.31.174.62:9031...\n",
"2022-12-08 17:04:06,700\tINFO worker.py:1509 -- Connected to Ray cluster. View the dashboard at \u001b[1m\u001b[32mhttps://console.anyscale-staging.com/api/v2/sessions/ses_gyl6mbksa8xt7b149ib6abld/services?redirect_to=dashboard \u001b[39m\u001b[22m\n"
]
},
{
"data": {
"text/html": [
"<div>\n",
" <div style=\"margin-left: 50px;display: flex;flex-direction: row;align-items: center\">\n",
" <h3 style=\"color: var(--jp-ui-font-color0)\">Ray</h3>\n",
" <svg version=\"1.1\" id=\"ray\" width=\"3em\" viewBox=\"0 0 144.5 144.6\" style=\"margin-left: 3em;margin-right: 3em\">\n",
" <g id=\"layer-1\">\n",
" <path fill=\"#00a2e9\" class=\"st0\" d=\"M97.3,77.2c-3.8-1.1-6.2,0.9-8.3,5.1c-3.5,6.8-9.9,9.9-17.4,9.6S58,88.1,54.8,81.2c-1.4-3-3-4-6.3-4.1\n",
" c-5.6-0.1-9.9,0.1-13.1,6.4c-3.8,7.6-13.6,10.2-21.8,7.6C5.2,88.4-0.4,80.5,0,71.7c0.1-8.4,5.7-15.8,13.8-18.2\n",
" c8.4-2.6,17.5,0.7,22.3,8c1.3,1.9,1.3,5.2,3.6,5.6c3.9,0.6,8,0.2,12,0.2c1.8,0,1.9-1.6,2.4-2.8c3.5-7.8,9.7-11.8,18-11.9\n",
" c8.2-0.1,14.4,3.9,17.8,11.4c1.3,2.8,2.9,3.6,5.7,3.3c1-0.1,2,0.1,3,0c2.8-0.5,6.4,1.7,8.1-2.7s-2.3-5.5-4.1-7.5\n",
" c-5.1-5.7-10.9-10.8-16.1-16.3C84,38,81.9,37.1,78,38.3C66.7,42,56.2,35.7,53,24.1C50.3,14,57.3,2.8,67.7,0.5\n",
" C78.4-2,89,4.7,91.5,15.3c0.1,0.3,0.1,0.5,0.2,0.8c0.7,3.4,0.7,6.9-0.8,9.8c-1.7,3.2-0.8,5,1.5,7.2c6.7,6.5,13.3,13,19.8,19.7\n",
" c1.8,1.8,3,2.1,5.5,1.2c9.1-3.4,17.9-0.6,23.4,7c4.8,6.9,4.6,16.1-0.4,22.9c-5.4,7.2-14.2,9.9-23.1,6.5c-2.3-0.9-3.5-0.6-5.1,1.1\n",
" c-6.7,6.9-13.6,13.7-20.5,20.4c-1.8,1.8-2.5,3.2-1.4,5.9c3.5,8.7,0.3,18.6-7.7,23.6c-7.9,5-18.2,3.8-24.8-2.9\n",
" c-6.4-6.4-7.4-16.2-2.5-24.3c4.9-7.8,14.5-11,23.1-7.8c3,1.1,4.7,0.5,6.9-1.7C91.7,98.4,98,92.3,104.2,86c1.6-1.6,4.1-2.7,2.6-6.2\n",
" c-1.4-3.3-3.8-2.5-6.2-2.6C99.8,77.2,98.9,77.2,97.3,77.2z M72.1,29.7c5.5,0.1,9.9-4.3,10-9.8c0-0.1,0-0.2,0-0.3\n",
" C81.8,14,77,9.8,71.5,10.2c-5,0.3-9,4.2-9.3,9.2c-0.2,5.5,4,10.1,9.5,10.3C71.8,29.7,72,29.7,72.1,29.7z M72.3,62.3\n",
" c-5.4-0.1-9.9,4.2-10.1,9.7c0,0.2,0,0.3,0,0.5c0.2,5.4,4.5,9.7,9.9,10c5.1,0.1,9.9-4.7,10.1-9.8c0.2-5.5-4-10-9.5-10.3\n",
" C72.6,62.3,72.4,62.3,72.3,62.3z M115,72.5c0.1,5.4,4.5,9.7,9.8,9.9c5.6-0.2,10-4.8,10-10.4c-0.2-5.4-4.6-9.7-10-9.7\n",
" c-5.3-0.1-9.8,4.2-9.9,9.5C115,72.1,115,72.3,115,72.5z M19.5,62.3c-5.4,0.1-9.8,4.4-10,9.8c-0.1,5.1,5.2,10.4,10.2,10.3\n",
" c5.6-0.2,10-4.9,9.8-10.5c-0.1-5.4-4.5-9.7-9.9-9.6C19.6,62.3,19.5,62.3,19.5,62.3z M71.8,134.6c5.9,0.2,10.3-3.9,10.4-9.6\n",
" c0.5-5.5-3.6-10.4-9.1-10.8c-5.5-0.5-10.4,3.6-10.8,9.1c0,0.5,0,0.9,0,1.4c-0.2,5.3,4,9.8,9.3,10\n",
" C71.6,134.6,71.7,134.6,71.8,134.6z\"/>\n",
" </g>\n",
" </svg>\n",
" <table>\n",
" <tr>\n",
" <td style=\"text-align: left\"><b>Python version:</b></td>\n",
" <td style=\"text-align: left\"><b>3.8.5</b></td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align: left\"><b>Ray version:</b></td>\n",
" <td style=\"text-align: left\"><b> 2.0.0</b></td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align: left\"><b>Dashboard:</b></td>\n",
" <td style=\"text-align: left\"><b><a href=\"http:https://console.anyscale-staging.com/api/v2/sessions/ses_gyl6mbksa8xt7b149ib6abld/services?redirect_to=dashboard\" target=\"_blank\">http:https://console.anyscale-staging.com/api/v2/sessions/ses_gyl6mbksa8xt7b149ib6abld/services?redirect_to=dashboard</a></b></td>\n",
"</tr>\n",
"\n",
" </table>\n",
" </div>\n",
"</div>\n"
],
"text/plain": [
"RayContext(dashboard_url='console.anyscale-staging.com/api/v2/sessions/ses_gyl6mbksa8xt7b149ib6abld/services?redirect_to=dashboard', python_version='3.8.5', ray_version='2.0.0', ray_commit='cba26cc83f6b5b8a2ff166594a65cb74c0ec8740', address_info={'node_ip_address': '172.31.174.62', 'raylet_ip_address': '172.31.174.62', 'redis_address': None, 'object_store_address': '/tmp/ray/session_2022-12-07_18-49-36_464358_162/sockets/plasma_store', 'raylet_socket_name': '/tmp/ray/session_2022-12-07_18-49-36_464358_162/sockets/raylet', 'webui_url': 'console.anyscale-staging.com/api/v2/sessions/ses_gyl6mbksa8xt7b149ib6abld/services?redirect_to=dashboard', 'session_dir': '/tmp/ray/session_2022-12-07_18-49-36_464358_162', 'metrics_export_port': 57175, 'gcs_address': '172.31.174.62:9031', 'address': '172.31.174.62:9031', 'dashboard_agent_listen_port': 52365, 'node_id': '90ea27f2278480d8d1918562b0d761e272b87b05f92774c3295ea896'})"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"import ray\n",
"\n",
Expand Down

This file was deleted.

72 changes: 0 additions & 72 deletions doc/source/ray-air/doc_code/torch_trainer.py

This file was deleted.

20 changes: 0 additions & 20 deletions doc/source/ray-air/examples/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,12 @@ filegroup(
# Test all doc/source/ray-air/examples notebooks.
# --------------------------------------------------------------------

py_test_run_all_notebooks(
size = "large",
include = ["*.ipynb"],
exclude = [
"huggingface_text_classification.ipynb",
"torch_detection.ipynb", # Requires GPUs
"gptj_batch_prediction.ipynb", # Requires GPUs
"gptj_serving.ipynb", # Requires GPUs
"stablediffusion_batch_prediction.ipynb", # Requires GPUs
"gptj_deepspeed_fine_tuning.ipynb", # Requires release test
"dolly_lightning_fsdp_finetuning.ipynb", # Requires release test
],
data = ["//doc/source/ray-air/examples:air_examples"],
tags = ["exclusive", "team:ml", "ray_air"],
)

# GPU Tests

py_test_run_all_notebooks(
size = "large",
include = [
"huggingface_text_classification.ipynb",
"torch_detection.ipynb",
"gptj_batch_prediction.ipynb",
"gptj_serving.ipynb",
"stablediffusion_batch_prediction.ipynb",
],
exclude = [],
data = ["//doc/source/ray-air/examples:air_examples"],
Expand Down
4 changes: 2 additions & 2 deletions doc/source/ray-air/examples/gptj_serving.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"\n",
"It is highly recommended to read about [Ray Serve Key Concepts](serve-key-concepts) before starting this example.\n",
"\n",
"If you are interested in batch prediction (offline inference), see {doc}`/ray-air/examples/gptj_batch_prediction`.\n",
"If you are interested in batch prediction (offline inference), see {doc}`/data/examples/gptj_batch_prediction`.\n",
"\n",
"```{note}\n",
"In order to run this example, make sure your Ray cluster has access to at least one GPU with 16 or more GBs of memory. The amount of memory needed will depend on the model.\n",
Expand Down Expand Up @@ -75,7 +75,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Setting up basic serving with Ray Serve is very similar to {doc}`batch inference with Ray Data </ray-air/examples/gptj_batch_prediction>`. First, we define a callable class that will serve as the [Serve deployment](serve-key-concepts-deployment). At runtime, a deployment consists of a number of *replicas*, which are individual copies of the class or function that are started in separate Ray Actors (processes). The number of replicas can be scaled up or down (or even autoscaled) to match the incoming request load.\n",
"Setting up basic serving with Ray Serve is very similar to {doc}`batch inference with Ray Data </data/examples/gptj_batch_prediction>`. First, we define a callable class that will serve as the [Serve deployment](serve-key-concepts-deployment). At runtime, a deployment consists of a number of *replicas*, which are individual copies of the class or function that are started in separate Ray Actors (processes). The number of replicas can be scaled up or down (or even autoscaled) to match the incoming request load.\n",
"\n",
"We make sure to set the deployment to use 1 GPU by setting `\"num_gpus\"` in `ray_actor_options`. We load the model in `__init__`, which will allow us to save time by initializing a model just once and then use it to handle multiple requests.\n",
"\n",
Expand Down
Loading
Loading