mirror of
https://github.com/GoogleCloudPlatform/vertex-ai-samples.git
synced 2026-09-26 14:42:04 +00:00
Ray on vertex ai (#2827)
* Made numerous edits. Code not impacted * removed empty cell * delete empty cell
This commit is contained in:
@@ -34,12 +34,12 @@
|
||||
"<table align=\"left\">\n",
|
||||
" <td style=\"text-align: center\">\n",
|
||||
" <a href=\"https://colab.research.google.com/github/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/ray_on_vertex_ai/get_started_with_pytorch_rov.ipynb\">\n",
|
||||
" <img width=\"32px\" src=\"https://cloud.google.com/ml-engine/images/colab-logo-32px.png\" alt=\"Google Colaboratory logo\"><br> Run in Colab\n",
|
||||
" <img width=\"32px\" src=\"https://cloud.google.com/ml-engine/images/colab-logo-32px.png\" alt=\"Google Colaboratory logo\"><br> Open in Colab\n",
|
||||
" </a>\n",
|
||||
" </td>\n",
|
||||
" <td style=\"text-align: center\">\n",
|
||||
" <a href=\"https://console.cloud.google.com/vertex-ai/colab/import/https:%2F%2Fraw.githubusercontent.com%2FGoogleCloudPlatform%2Fvertex-ai-samples%2Fmain%2Fnotebooks%2Fofficial%2Fray_on_vertex_ai%2Fget_started_with_pytorch_rov.ipynb\">\n",
|
||||
" <img width=\"32px\" src=\"https://lh3.googleusercontent.com/JmcxdQi-qOpctIvWKgPtrzZdJJK-J3sWE1RsfjZNwshCFgE_9fULcNpuXYTilIR2hjwN\" alt=\"Google Cloud Colab Enterprise logo\"><br> Run in Colab Enterprise\n",
|
||||
" <img width=\"32px\" src=\"https://lh3.googleusercontent.com/JmcxdQi-qOpctIvWKgPtrzZdJJK-J3sWE1RsfjZNwshCFgE_9fULcNpuXYTilIR2hjwN\" alt=\"Google Cloud Colab Enterprise logo\"><br> Open in Colab Enterprise\n",
|
||||
" </a>\n",
|
||||
" </td>\n",
|
||||
" <td style=\"text-align: center\">\n",
|
||||
@@ -388,7 +388,7 @@
|
||||
"id": "-EcIXiGsCePi"
|
||||
},
|
||||
"source": [
|
||||
"**Only if your bucket doesn't already exist**: Run the following cell to create your Cloud Storage bucket."
|
||||
"**If your bucket doesn't already exist**: Run the following cell to create your Cloud Storage bucket."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -432,7 +432,7 @@
|
||||
"id": "k9ryiScCEapt"
|
||||
},
|
||||
"source": [
|
||||
"### Set a Ray on Vertex AI cluster"
|
||||
"### Set a Ray cluster on Vertex AI"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -441,7 +441,7 @@
|
||||
"id": "MwmK5nBBCgJa"
|
||||
},
|
||||
"source": [
|
||||
"Before to run the code below, make sure to [set up](https://cloud.google.com/vertex-ai/docs/open-source/ray-on-vertex-ai/set-up) Ray on Vertex AI and [create](https://cloud.google.com/vertex-ai/docs/open-source/ray-on-vertex-ai/create-cluster) at least one Ray on Vertex AI cluster."
|
||||
"Before running the code below, make sure to [set up](https://cloud.google.com/vertex-ai/docs/open-source/ray-on-vertex-ai/set-up) Ray on Vertex AI and [create](https://cloud.google.com/vertex-ai/docs/open-source/ray-on-vertex-ai/create-cluster) at least one Ray cluster on Vertex AI."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -519,7 +519,7 @@
|
||||
"source": [
|
||||
"#### Create the Ray cluster\n",
|
||||
"\n",
|
||||
"Create the Ray cluster using the Ray on Vertex AI Python SDK."
|
||||
"Create the Ray cluster using the Vertex AI SDK for Python version used with Ray."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -556,7 +556,7 @@
|
||||
"source": [
|
||||
"#### Get the Ray cluster\n",
|
||||
"\n",
|
||||
"Use the Ray on Vertex AI Python SDK to get the Ray cluster."
|
||||
"Use the Vertex AI SDK for Python to get the Ray cluster."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -744,11 +744,11 @@
|
||||
"source": [
|
||||
"#### Prepare the training application\n",
|
||||
"\n",
|
||||
"Before you start the training, let's take a look at how Ray job might be assembled to distribute your training.\n",
|
||||
"Before you start the training, let's take a look at how a Ray job might be assembled to distribute your training.\n",
|
||||
"\n",
|
||||
"Ray 2.4.0 uses `train_loop_per_worker` fuction to a distributed multi-worker training function.\n",
|
||||
"\n",
|
||||
"After you set up your dataset and your model, you define your single-worker PyTorch training function and then you convert it to distributed multi-worker training function as followed:\n",
|
||||
"After you set up your dataset and your model, define your single-worker PyTorch training function and then convert it to distributed multi-worker training function as followed:\n",
|
||||
"\n",
|
||||
"1. Use the `ray.train.torch.prepare_data_loader` to wrap your data with `DistributedSampler` for distributed training.\n",
|
||||
"\n",
|
||||
@@ -758,7 +758,7 @@
|
||||
"\n",
|
||||
"Additionally, you can define a `RunConfig` to specify checkpointing and synchronization behaviors along the distributed training workload and some additional training loop parameters.\n",
|
||||
"\n",
|
||||
"Finally, you pass everything to `TorchTrainer` which Ray uses to distribute your training utilizing Distributed Data Parallelism (using PyTorch’s Distributed backend)."
|
||||
"Finally, pass everything to `TorchTrainer`, which Ray uses to distribute your training utilizing Distributed Data Parallelism (using PyTorch’s Distributed backend)."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1045,9 +1045,9 @@
|
||||
"source": [
|
||||
"### Submit a Ray job using the Ray Jobs API\n",
|
||||
"\n",
|
||||
"Submit the script to the Ray on Vertex AI cluster using the Ray Jobs API with the public Ray dashboard address.\n",
|
||||
"Submit the script to the Ray cluster on Vertex AI using the Ray Jobs API with the public Ray dashboard address.\n",
|
||||
"\n",
|
||||
"It is important to highlight that Ray Jobs API is the prefered option if you would rather submit jobs programmatically. You can also use the Ray on Vertex AI SDK if you prefer an interactive Python development environment."
|
||||
"It's important to highlight that Ray Jobs API is the prefered option if you'd rather submit jobs programmatically. You can also use the Ray on Vertex AI SDK if you prefer an interactive Python development environment."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1140,7 +1140,7 @@
|
||||
"source": [
|
||||
"### Check model artifacts\n",
|
||||
"\n",
|
||||
"When the Ray training job has completed, you check the model artifacts in the Cloud Storage location.\n"
|
||||
"When the Ray training job has completed, check the model artifacts in the Cloud Storage location.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1162,13 +1162,13 @@
|
||||
"source": [
|
||||
"## Serving a PyTorch model\n",
|
||||
"\n",
|
||||
"You can serve a PyTorch model on Vertex AI using TorchServe as followed:\n",
|
||||
"You can serve a PyTorch model on Vertex AI using TorchServe as follows:\n",
|
||||
"\n",
|
||||
"1. Download Ray training checkpoints.\n",
|
||||
"2. Get PyTorch model from the Ray TorchCheckpoint.\n",
|
||||
"3. Package the trained model artifacts including the model artifact, the model module and the custom handler by creating an archive file using the Torch Model Archiver tool.\n",
|
||||
"4. Register model in Vertex AI Model Registry.\n",
|
||||
"5. Deploy model to Vertex AI Endpoint for predictions."
|
||||
"5. Deploy model to Vertex AI endpoint for predictions."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1179,7 +1179,7 @@
|
||||
"source": [
|
||||
"### Download Ray training checkpoints\n",
|
||||
"\n",
|
||||
"You download all resulting checkpoints from Ray training job."
|
||||
"Download all resulting checkpoints from Ray training job."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1201,7 +1201,7 @@
|
||||
"source": [
|
||||
"### Get the best training checkpoint\n",
|
||||
"\n",
|
||||
"You use the `ExperimentAnalysis` to retrive the best checkpoint according to relevant metrics and mode."
|
||||
"Use the `ExperimentAnalysis` to retrive the best checkpoint according to relevant metrics and mode."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1249,7 +1249,7 @@
|
||||
"source": [
|
||||
"### Build PyTorch model archive (.mar) file\n",
|
||||
"\n",
|
||||
"TorchServe allows you to serve Torch model by packaging all model artifacts into a single model archive file. In this case, the following information is required to create a standalone model archive:\n",
|
||||
"TorchServe lets you to serve the Torch model by packaging all model artifacts into a single model archive file. In this case, the following information is required to create a standalone model archive:\n",
|
||||
"\n",
|
||||
"1. Serialized file\n",
|
||||
"2. Model file\n",
|
||||
@@ -1464,7 +1464,7 @@
|
||||
"source": [
|
||||
"### Register model in Vertex AI Model Registry\n",
|
||||
"\n",
|
||||
"Register the model as a Model Resource in Vertex AI Model Registry."
|
||||
"Register the model as a Model resource in Vertex AI Model Registry."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1490,7 +1490,7 @@
|
||||
"source": [
|
||||
"### Deploy model for predictions\n",
|
||||
"\n",
|
||||
"Create a Vertex AI Endpoint and deploy the registered model for predictions."
|
||||
"Create a Vertex AI endpoint and deploy the registered model for predictions."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1517,7 +1517,7 @@
|
||||
"source": [
|
||||
"## Make online predictions\n",
|
||||
"\n",
|
||||
"You sample an image from the `CIFAR10` dataset for getting online predictions."
|
||||
"Sample an image from the `CIFAR10` dataset for getting online predictions."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user