mirror of
https://github.com/GoogleCloudPlatform/vertex-ai-samples.git
synced 2026-09-26 14:42:04 +00:00
Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9648e5d03f | ||
|
|
16c3e13cfc | ||
|
|
1de730011e | ||
|
|
70b7542b90 | ||
|
|
a3ae322f8e | ||
|
|
be00f7d3a4 | ||
|
|
8035f7c61f | ||
|
|
b6f00cf284 | ||
|
|
8c2ef11d88 | ||
|
|
fc5a6bba3b |
@@ -160,7 +160,8 @@
|
||||
" ! pip3 install --upgrade google-cloud-logging $USER_FLAG\n",
|
||||
" ! pip3 install --upgrade apache-beam[gcp] $USER_FLAG\n",
|
||||
" ! pip3 install --upgrade pyarrow $USER_FLAG\n",
|
||||
" ! pip3 install --upgrade cloudml-hypertune $USER_FLAG"
|
||||
" ! pip3 install --upgrade cloudml-hypertune $USER_FLAG\n",
|
||||
" ! pip3 install --upgrade kfp $USER_FLAG"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -402,9 +403,9 @@
|
||||
"id": "init_aip:mbsdk"
|
||||
},
|
||||
"source": [
|
||||
"### Initialize Vertex SDK for Python\n",
|
||||
"### Initialize Vertex AI SDK for Python\n",
|
||||
"\n",
|
||||
"Initialize the Vertex SDK for Python for your project and corresponding bucket."
|
||||
"Initialize the Vertex AI SDK for Python for your project and corresponding bucket."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -78,19 +78,19 @@
|
||||
"source": [
|
||||
"### Objective\n",
|
||||
"\n",
|
||||
"In this tutorial, you learn how to use `Vertex Distributed Training` for when training with `Vertex AI`.\n",
|
||||
"In this tutorial, you learn how to use `Vertex AI Distributed Training` for when training with `Vertex AI`.\n",
|
||||
"\n",
|
||||
"This tutorial uses the following Google Cloud ML services:\n",
|
||||
"\n",
|
||||
"- `Vertex Distributed Training`\n",
|
||||
"- `Vertex Reduction Server`\n",
|
||||
"- `Vertex AI Distributed Training`\n",
|
||||
"- `Vertex AI Reduction Server`\n",
|
||||
"\n",
|
||||
"The steps performed include:\n",
|
||||
"\n",
|
||||
"- `MirroredStrategy`: Train on single VM with multiple GPUs.\n",
|
||||
"- `MultiWorkerMirroredStrategy`: Train on multiple VMs with automatic setup of replicas.\n",
|
||||
"- `MultiWorkerMirroredStrategy`: Train on multiple VMs with fine grain control of replicas.\n",
|
||||
"- `ReductionServer`: Train on multiple VMS and sync updates across VMS with Vertex Reduction Server"
|
||||
"- `ReductionServer`: Train on multiple VMS and sync updates across VMS with Vertex AI Reduction Server"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -101,7 +101,7 @@
|
||||
"source": [
|
||||
"### Recommendations\n",
|
||||
"\n",
|
||||
"When doing E2E MLOps on Google Cloud, the following are best practices for when to use Vertex Distributed Training:\n",
|
||||
"When doing E2E MLOps on Google Cloud, the following are best practices for when to use Vertex AI Distributed Training:\n",
|
||||
"\n",
|
||||
"**Single VM / Single Device (OneDeviceStrategy)**\n",
|
||||
"\n",
|
||||
@@ -152,7 +152,8 @@
|
||||
" ! pip3 install --upgrade google-cloud-logging $USER_FLAG\n",
|
||||
" ! pip3 install --upgrade apache-beam[gcp] $USER_FLAG\n",
|
||||
" ! pip3 install --upgrade pyarrow $USER_FLAG\n",
|
||||
" ! pip3 install --upgrade cloudml-hypertune $USER_FLAG"
|
||||
" ! pip3 install --upgrade cloudml-hypertune $USER_FLAG\n",
|
||||
" ! pip3 install --upgrade kfp $USER_FLAG"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -394,9 +395,9 @@
|
||||
"id": "init_aip:mbsdk"
|
||||
},
|
||||
"source": [
|
||||
"### Initialize Vertex SDK for Python\n",
|
||||
"### Initialize Vertex AI SDK for Python\n",
|
||||
"\n",
|
||||
"Initialize the Vertex SDK for Python for your project and corresponding bucket."
|
||||
"Initialize the Vertex AI SDK for Python for your project and corresponding bucket."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -568,9 +569,9 @@
|
||||
"source": [
|
||||
"## Mirrored Strategy\n",
|
||||
"\n",
|
||||
"When training on a single VM, one can either train was a single compute device or with multiple compute devices on the same VM. With Vertex Distributed Training you can specify both the number of compute devices for the VM instance and type of compute devices: CPU, GPU.\n",
|
||||
"When training on a single VM, one can either train was a single compute device or with multiple compute devices on the same VM. With Vertex AI Distributed Training you can specify both the number of compute devices for the VM instance and type of compute devices: CPU, GPU.\n",
|
||||
"\n",
|
||||
"Vertex Distributed Training supports `tf.distribute.MirroredStrategy' for TensorFlow models. To enable training across multiple compute devices on the same VM, you do the following additional steps in your Python training script:\n",
|
||||
"Vertex AI Distributed Training supports `tf.distribute.MirroredStrategy' for TensorFlow models. To enable training across multiple compute devices on the same VM, you do the following additional steps in your Python training script:\n",
|
||||
"\n",
|
||||
"1. Set the tf.distribute.MirrorStrategy\n",
|
||||
"2. Compile the model within the scope of tf.distribute.MirrorStrategy. *Note:* Tells MirroredStrategy which variables to mirror across your compute devices.\n",
|
||||
@@ -952,15 +953,15 @@
|
||||
"source": [
|
||||
"## Multi-Worker Mirrored Strategy\n",
|
||||
"\n",
|
||||
"With Vertex Distributed Training you can train with multiple VM instances\n",
|
||||
"With Vertex AI Distributed Training you can train with multiple VM instances\n",
|
||||
"\n",
|
||||
"Vertex Distributed Training supports `tf.distribute.MultiWorkerMirroredStrategy' for TensorFlow and PyTorch models. To enable training across multiple VMS, you do the following additional steps in your Python training script:\n",
|
||||
"Vertex AI Distributed Training supports `tf.distribute.MultiWorkerMirroredStrategy' for TensorFlow and PyTorch models. To enable training across multiple VMS, you do the following additional steps in your Python training script:\n",
|
||||
"\n",
|
||||
"1. All the additional steps for MirroredStrategy, except that MultiWorkerStrategy is set in place of MirroredStrategy.\n",
|
||||
"2. Setup the worker pools.\n",
|
||||
"3. Alter the saving of the model so that the non-primary workers save their model instance to a unique temporary directory each.\n",
|
||||
"\n",
|
||||
"*Note:* You do not need to construct the TF_CONFIG environment variable. It is automatically constructed by Vertex Distributed Training.\n",
|
||||
"*Note:* You do not need to construct the TF_CONFIG environment variable. It is automatically constructed by Vertex AI Distributed Training.\n",
|
||||
"\n",
|
||||
"Learn more about [Distributed Training](https://cloud.google.com/vertex-ai/docs/training/distributed-training)."
|
||||
]
|
||||
@@ -1006,7 +1007,7 @@
|
||||
"source": [
|
||||
"### Distributed training options for Multi-Worker Mirrored Strategy\n",
|
||||
"\n",
|
||||
"How you setup the worker pools is dependent on the Vertex method you use for training.\n",
|
||||
"How you setup the worker pools is dependent on the Vertex AI method you use for training.\n",
|
||||
"\n",
|
||||
"**CustomTrainingJob** / **CustomContainerTrainingJob** / **CustomPythonPackageTrainingJob**\n",
|
||||
"\n",
|
||||
@@ -1437,7 +1438,7 @@
|
||||
"\n",
|
||||
"To speed up training of large models, many engineering teams are adopting distributed training using scale-out clusters of ML accelerators. However, distributed training at scale brings its own set of challenges. Specifically, limited network bandwidth between nodes makes optimizing performance of distributed training inherently difficult, particularly for large cluster configurations.\n",
|
||||
"\n",
|
||||
"Vertex Reduction Server optimizes bandwidth and latency of multi-node distributed training on NVIDIA GPUs for synchronous data parallel algorithms. Synchronous data parallelism is the foundation of many widely adopted distributed training frameworks, including TensorFlow’s MultiWorkerMirroredStrategy, Horovod, and PyTorch Distributed. By optimizing bandwidth usage and latency of the all-reduce collective operation used by these frameworks, Reduction Server can decrease both the time and cost of large training jobs.\n",
|
||||
"Vertex AI Reduction Server optimizes bandwidth and latency of multi-node distributed training on NVIDIA GPUs for synchronous data parallel algorithms. Synchronous data parallelism is the foundation of many widely adopted distributed training frameworks, including TensorFlow’s MultiWorkerMirroredStrategy, Horovod, and PyTorch Distributed. By optimizing bandwidth usage and latency of the all-reduce collective operation used by these frameworks, Reduction Server can decrease both the time and cost of large training jobs.\n",
|
||||
"\n",
|
||||
"Learn more about [Optimizing training performance using Vertex Reduction Server](https://cloud.google.com/blog/topics/developers-practitioners/optimize-training-performance-reduction-server-vertex-ai)"
|
||||
]
|
||||
|
||||
@@ -67,18 +67,18 @@
|
||||
"source": [
|
||||
"### Objective\n",
|
||||
"\n",
|
||||
"In this tutorial, you learn how to use Python logging and `Vertex Experiments` when training with `Vertex AI`.\n",
|
||||
"In this tutorial, you learn how to use Python logging and `Vertex AI Experiments` when training with `Vertex AI`.\n",
|
||||
"\n",
|
||||
"This tutorial uses the following Google Cloud ML services:\n",
|
||||
"\n",
|
||||
"- `Vertex Experiments`\n",
|
||||
"- `Vertex ML Metadata`\n",
|
||||
"- `Vertex AI Experiments`\n",
|
||||
"- `Vertex AI ML Metadata`\n",
|
||||
"\n",
|
||||
"The steps performed include:\n",
|
||||
"\n",
|
||||
"- Use Python logging to log training configuration/results locally.\n",
|
||||
"- Use Google Cloud Logging to log training configuration/results in cloud storage.\n",
|
||||
"- Create a Vertex `Experiment` resource.\n",
|
||||
"- Create a Vertex AI `Experiment` resource.\n",
|
||||
"- Instantiate an experiment run.\n",
|
||||
"- Log parameters for the run.\n",
|
||||
"- Log metrics for the run.\n",
|
||||
@@ -105,7 +105,7 @@
|
||||
"\n",
|
||||
"#### Experiments\n",
|
||||
"\n",
|
||||
"Use Vertex Experiments in conjunction with logging when doing experiments to compare results for different experiment configurations."
|
||||
"Use Vertex AI Experiments in conjunction with logging when doing experiments to compare results for different experiment configurations."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -138,7 +138,8 @@
|
||||
" ! pip3 install --upgrade google-cloud-logging $USER_FLAG\n",
|
||||
" ! pip3 install --upgrade apache-beam[gcp] $USER_FLAG\n",
|
||||
" ! pip3 install --upgrade pyarrow $USER_FLAG\n",
|
||||
" ! pip3 install --upgrade cloudml-hypertune $USER_FLAG"
|
||||
" ! pip3 install --upgrade cloudml-hypertune $USER_FLAG\n",
|
||||
" ! pip3 install --upgrade kfp $USER_FLAG"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -324,9 +325,9 @@
|
||||
"id": "init_aip:mbsdk,region"
|
||||
},
|
||||
"source": [
|
||||
"### Initialize Vertex SDK for Python\n",
|
||||
"### Initialize Vertex AI SDK for Python\n",
|
||||
"\n",
|
||||
"Initialize the Vertex SDK for Python for your project and corresponding bucket."
|
||||
"Initialize the Vertex AI SDK for Python for your project and corresponding bucket."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -590,9 +591,9 @@
|
||||
"id": "experiments_logging"
|
||||
},
|
||||
"source": [
|
||||
"## Logging with Vertex Experiments and Vertex ML Metadata\n",
|
||||
"## Logging with Vertex AI Experiments and Vertex AI ML Metadata\n",
|
||||
"\n",
|
||||
"You can log results related to training experiments with `Vertex Experiments` and `ML Metadata`:\n",
|
||||
"You can log results related to training experiments with `Vertex AI Experiments` and `ML Metadata`:\n",
|
||||
"\n",
|
||||
"- Preserve results of an experiment.\n",
|
||||
"- Track multiple runs -- i.e., training runs -- within an experiment.\n",
|
||||
@@ -615,7 +616,7 @@
|
||||
"- `aip.init()` - Create an experiment instance\n",
|
||||
"- `aip.start_run()` - Track a specific run within the experiment.\n",
|
||||
"\n",
|
||||
"Learn more about [Introduction to Vertex ML Metadata](https://cloud.google.com/vertex-ai/docs/ml-metadata/introduction)."
|
||||
"Learn more about [Introduction to Vertex AI ML Metadata](https://cloud.google.com/vertex-ai/docs/ml-metadata/introduction)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -67,18 +67,18 @@
|
||||
"source": [
|
||||
"### Objective\n",
|
||||
"\n",
|
||||
"In this tutorial, you learn how to use `Vertex TensorBoard` when training with `Vertex AI`.\n",
|
||||
"In this tutorial, you learn how to use `Vertex AI TensorBoard` when training with `Vertex AI`.\n",
|
||||
"\n",
|
||||
"This tutorial uses the following Google Cloud ML services:\n",
|
||||
"\n",
|
||||
"- `Vertex TensorBoard`\n",
|
||||
"- `Vertex Training`\n",
|
||||
"- `Vertex AI TensorBoard`\n",
|
||||
"- `Vertex AI Training`\n",
|
||||
"\n",
|
||||
"The steps performed include:\n",
|
||||
"\n",
|
||||
"- Create a TensorBoard callback when training a model.\n",
|
||||
"- Using Tensorboard with locally trained model.\n",
|
||||
"- Using Vertex TensorBoard with Vertex Training."
|
||||
"- Using Vertex AI TensorBoard with Vertex AI Training."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -101,7 +101,7 @@
|
||||
"\n",
|
||||
"#### Experiments\n",
|
||||
"\n",
|
||||
"Use Vertex TensorBoard when you have a privacy issue or doing experiments to compare results for different experiment configurations."
|
||||
"Use Vertex AI TensorBoard when you have a privacy issue or doing experiments to compare results for different experiment configurations."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -134,7 +134,8 @@
|
||||
" ! pip3 install --upgrade google-cloud-logging $USER_FLAG\n",
|
||||
" ! pip3 install --upgrade apache-beam[gcp] $USER_FLAG\n",
|
||||
" ! pip3 install --upgrade pyarrow $USER_FLAG\n",
|
||||
" ! pip3 install --upgrade cloudml-hypertune $USER_FLAG"
|
||||
" ! pip3 install --upgrade cloudml-hypertune $USER_FLAG\n",
|
||||
" ! pip3 install --upgrade kfp $USER_FLAG"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -439,9 +440,9 @@
|
||||
"id": "init_aip:mbsdk"
|
||||
},
|
||||
"source": [
|
||||
"### Initialize Vertex SDK for Python\n",
|
||||
"### Initialize Vertex AI SDK for Python\n",
|
||||
"\n",
|
||||
"Initialize the Vertex SDK for Python for your project and corresponding bucket."
|
||||
"Initialize the Vertex AI SDK for Python for your project and corresponding bucket."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -591,7 +592,7 @@
|
||||
"\n",
|
||||
"Tensorboard provides the means to visualize your training in-real time and to visualize the results (metrics).\n",
|
||||
"\n",
|
||||
"You can use Tensorboard in conjunction with local training, cloud training and with `Vertex Training`, which is referred to as `Vertex TensorBoard`"
|
||||
"You can use Tensorboard in conjunction with local training, cloud training and with `Vertex AI Training`, which is referred to as `Vertex AI TensorBoard`"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -688,7 +689,7 @@
|
||||
"id": "create_vertex_tensorboard"
|
||||
},
|
||||
"source": [
|
||||
"### Uploading TensorBoard logs using Vertex TensorBoard\n",
|
||||
"### Uploading TensorBoard logs using Vertex AI TensorBoard\n",
|
||||
"\n",
|
||||
"You can upload your TensorBoard logs by first creating a TensorBoard instance and then using the `tb-gcp-uploader` command to upload the logs. Once uploaded, the command will return a URL for connecting to the TensorBoard instance via the browser.\n",
|
||||
"\n",
|
||||
@@ -756,13 +757,13 @@
|
||||
"id": "tensorboard_customjob"
|
||||
},
|
||||
"source": [
|
||||
"### CustomTrainingJob training with Vertex TensorBoard\n",
|
||||
"### CustomTrainingJob training with Vertex AI TensorBoard\n",
|
||||
"\n",
|
||||
"To use Vertex TensorBoard in conjunction with custom training with Vertex training, you make the following modifications:\n",
|
||||
"To use Vertex AI TensorBoard in conjunction with custom training with Vertex AI training, you make the following modifications:\n",
|
||||
"\n",
|
||||
"**Python Training Script**:\n",
|
||||
"\n",
|
||||
"1. Get the value of the environment variable `AIP_TENSORBOARD_LOG_DIR`. This is set by Vertex Training service.\n",
|
||||
"1. Get the value of the environment variable `AIP_TENSORBOARD_LOG_DIR`. This is set by Vertex AI Training service.\n",
|
||||
"2. Create a TensorBoard callback with the log_dir parameter set to the value of `AIP_TENSORBOARD_LOG_DIR`.\n",
|
||||
"\n",
|
||||
"**CustomTrainingJob**:\n",
|
||||
@@ -843,7 +844,7 @@
|
||||
"\n",
|
||||
"- Parse the command line arguments for the training configuration and hyperparameter settings.\n",
|
||||
" - Get the directory where to save the model artifacts from the command line (`--model_dir`), and if not specified, then from the environment variable `AIP_MODEL_DIR`.\n",
|
||||
" - Get the resource name of the Vertex TensorBoard instance, and if not specified, then from the environment variable `AIP_TENSORBOARD_LOG_DIR`.\n",
|
||||
" - Get the resource name of the Vertex AI TensorBoard instance, and if not specified, then from the environment variable `AIP_TENSORBOARD_LOG_DIR`.\n",
|
||||
"\n",
|
||||
"- Load and preprocess the MNIST dataset.\n",
|
||||
"- Build and compile a DNN model.\n",
|
||||
@@ -1054,8 +1055,8 @@
|
||||
"- `accelerator_type`: The hardware accelerator type.\n",
|
||||
"- `accelerator_count`: The number of accelerators to attach to a worker replica.\n",
|
||||
"- `base_output_dir`: The Cloud Storage location to write the model artifacts to.\n",
|
||||
"- `tensorboard`: The resource name of the Vertex TensorBoard instance.\n",
|
||||
"- `service_account`: The service account with permissions to access Cloud Storage and Vertex TensorBoard.\n",
|
||||
"- `tensorboard`: The resource name of the Vertex AI TensorBoard instance.\n",
|
||||
"- `service_account`: The service account with permissions to access Cloud Storage and Vertex AI TensorBoard.\n",
|
||||
"- `sync`: Whether to block until completion of the job."
|
||||
]
|
||||
},
|
||||
|
||||
@@ -78,11 +78,11 @@
|
||||
"source": [
|
||||
"### Objective\n",
|
||||
"\n",
|
||||
"In this tutorial, you learn how to use `Vertex Training` for custom models when training with `Vertex AI`.\n",
|
||||
"In this tutorial, you learn how to use `Vertex AI Training` for custom models when training with `Vertex AI`.\n",
|
||||
"\n",
|
||||
"This tutorial uses the following Google Cloud ML services:\n",
|
||||
"\n",
|
||||
"- `Vertex Training`\n",
|
||||
"- `Vertex AI Training`\n",
|
||||
"\n",
|
||||
"The steps performed include:\n",
|
||||
"\n",
|
||||
@@ -149,7 +149,8 @@
|
||||
" ! pip3 install --upgrade google-cloud-logging $USER_FLAG\n",
|
||||
" ! pip3 install --upgrade apache-beam[gcp] $USER_FLAG\n",
|
||||
" ! pip3 install --upgrade pyarrow $USER_FLAG\n",
|
||||
" ! pip3 install --upgrade cloudml-hypertune $USER_FLAG"
|
||||
" ! pip3 install --upgrade cloudml-hypertune $USER_FLAG\n",
|
||||
" ! pip3 install --upgrade kfp $USER_FLAG"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -391,9 +392,9 @@
|
||||
"id": "init_aip:mbsdk"
|
||||
},
|
||||
"source": [
|
||||
"### Initialize Vertex SDK for Python\n",
|
||||
"### Initialize Vertex AI SDK for Python\n",
|
||||
"\n",
|
||||
"Initialize the Vertex SDK for Python for your project and corresponding bucket."
|
||||
"Initialize the Vertex AI SDK for Python for your project and corresponding bucket."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -512,6 +513,7 @@
|
||||
"\n",
|
||||
"print(\"Training:\", TRAIN_IMAGE, TRAIN_GPU, TRAIN_NGPU)\n",
|
||||
"print(\"Deployment:\", DEPLOY_IMAGE, DEPLOY_GPU, DEPLOY_NGPU)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
@@ -666,14 +668,14 @@
|
||||
"- `accelerator_type`: The hardware accelerator type.\n",
|
||||
"- `accelerator_count`: The number of accelerators to attach to a worker replica.\n",
|
||||
"\n",
|
||||
"If you want to override the command-line argument `--model_dir`, use the following parameter to specify the location for writing the model artifacts. Note, the Vertex Training service will pass this location to the training script in the environment variable `AIP_MODEL_DIR`:\n",
|
||||
"If you want to override the command-line argument `--model_dir`, use the following parameter to specify the location for writing the model artifacts. Note, the Vertex AI Training service will pass this location to the training script in the environment variable `AIP_MODEL_DIR`:\n",
|
||||
"\n",
|
||||
"- `base_output_dir`: The Cloud Storage location to write the model artifacts to.\n",
|
||||
"\n",
|
||||
"If you are using Vertex TensorBoard in conjunction with your training, add the following parameters. Note, the Vertex Training service will pass the location of the TensorBoard log files to the training script in the environment variable `AIP_TENSORBOARD_LOG_DIR`:\n",
|
||||
"If you are using Vertex AI TensorBoard in conjunction with your training, add the following parameters. Note, the Vertex AI Training service will pass the location of the TensorBoard log files to the training script in the environment variable `AIP_TENSORBOARD_LOG_DIR`:\n",
|
||||
"\n",
|
||||
"- `tensorboard`: The resource name of the Vertex TensorBoard instance.\n",
|
||||
"- `service_account`: The service account with permissions to access Cloud Storage and Vertex TensorBoard.\n",
|
||||
"- `tensorboard`: The resource name of the Vertex AI TensorBoard instance.\n",
|
||||
"- `service_account`: The service account with permissions to access Cloud Storage and Vertex AI TensorBoard.\n",
|
||||
"\n",
|
||||
"There are additional parameters that are covered later in the notebook, related to:\n",
|
||||
"\n",
|
||||
@@ -1291,7 +1293,7 @@
|
||||
"source": [
|
||||
"## Model saving and conversion to Model Resource.\n",
|
||||
"\n",
|
||||
"Vertex Training will optional automatically convert your trained model into a Vertex Model resource, by adding the following additional steps:\n",
|
||||
"Vertex AI Training will optional automatically convert your trained model into a Vertex AI Model resource, by adding the following additional steps:\n",
|
||||
"\n",
|
||||
"- Specify the following additional parameters when creating the custom training job (e.g., CustomTrainingJob):\n",
|
||||
"\n",
|
||||
@@ -1304,7 +1306,7 @@
|
||||
"\n",
|
||||
"- In the training script, save the model to the location specified by the environment variable `AIP_MODEL_DIR`.\n",
|
||||
"\n",
|
||||
"The service will set the value of the environment variable `AIP_MODEL_DIR` relative to the Cloud Storage location of `base_output_dir`. Upon successful completion of the training script, the service will look at this location for the model artifacts, and upload the model artifacts into a Vertex Model resource.\n",
|
||||
"The service will set the value of the environment variable `AIP_MODEL_DIR` relative to the Cloud Storage location of `base_output_dir`. Upon successful completion of the training script, the service will look at this location for the model artifacts, and upload the model artifacts into a Vertex AI Model resource.\n",
|
||||
"\n",
|
||||
"The response from the `run()` method will be the Model resource, when ran synchronously. When ran asynchronously, the response is a LRO which one can do a wait() on. Upon completion, the response object is redirected to the Model resource."
|
||||
]
|
||||
|
||||
@@ -78,13 +78,13 @@
|
||||
"source": [
|
||||
"### Objective\n",
|
||||
"\n",
|
||||
"In this tutorial, you learn how to use `Vertex Vizier` for when training with `Vertex AI`.\n",
|
||||
"In this tutorial, you learn how to use `Vertex AI Vizier` for when training with `Vertex AI`.\n",
|
||||
"\n",
|
||||
"This tutorial uses the following Google Cloud ML services:\n",
|
||||
"\n",
|
||||
"- `Vertex Training`\n",
|
||||
"- `Vertex Hyperparameter Tuning`\n",
|
||||
"- `Vertex Vizier`\n",
|
||||
"- `Vertex AI Training`\n",
|
||||
"- `Vertex AI Hyperparameter Tuning`\n",
|
||||
"- `Vertex AI Vizier`\n",
|
||||
"\n",
|
||||
"The steps performed include:\n",
|
||||
"\n",
|
||||
@@ -100,7 +100,7 @@
|
||||
"source": [
|
||||
"### Recommendations\n",
|
||||
"\n",
|
||||
"When doing E2E MLOps on Google Cloud, the following are best practices for when to use Vertex Vizier for hyperparameter tuning:\n",
|
||||
"When doing E2E MLOps on Google Cloud, the following are best practices for when to use Vertex AI Vizier for hyperparameter tuning:\n",
|
||||
"\n",
|
||||
"**Grid Search**\n",
|
||||
"\n",
|
||||
@@ -158,7 +158,8 @@
|
||||
" ! pip3 install --upgrade google-cloud-logging $USER_FLAG\n",
|
||||
" ! pip3 install --upgrade apache-beam[gcp] $USER_FLAG\n",
|
||||
" ! pip3 install --upgrade pyarrow $USER_FLAG\n",
|
||||
" ! pip3 install --upgrade cloudml-hypertune $USER_FLAG"
|
||||
" ! pip3 install --upgrade cloudml-hypertune $USER_FLAG\n",
|
||||
" ! pip3 install --upgrade kfp $USER_FLAG"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -400,9 +401,9 @@
|
||||
"id": "init_aip:mbsdk"
|
||||
},
|
||||
"source": [
|
||||
"### Initialize Vertex SDK for Python\n",
|
||||
"### Initialize Vertex AI SDK for Python\n",
|
||||
"\n",
|
||||
"Initialize the Vertex SDK for Python for your project and corresponding bucket."
|
||||
"Initialize the Vertex AI SDK for Python for your project and corresponding bucket."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -577,7 +578,7 @@
|
||||
"id": "vizier_intro"
|
||||
},
|
||||
"source": [
|
||||
"## Standalone Vertex Vizer service\n",
|
||||
"## Standalone Vertex AI Vizer service\n",
|
||||
"\n",
|
||||
"The `Vizier` service can be used as a standalone service for selecting the next set of parameters for a trial.\n",
|
||||
"\n",
|
||||
@@ -592,9 +593,9 @@
|
||||
"id": "hpt_intro"
|
||||
},
|
||||
"source": [
|
||||
"## Vertex Hyperparameter Tuning service\n",
|
||||
"## Vertex AI Hyperparameter Tuning service\n",
|
||||
"\n",
|
||||
"The following example demonstrates how to setup, execute and evaluate trials using the Vertex Hyperparameter Tuning service with `random` search algorithm.\n",
|
||||
"The following example demonstrates how to setup, execute and evaluate trials using the Vertex AI Hyperparameter Tuning service with `random` search algorithm.\n",
|
||||
"\n",
|
||||
"Learn more about [Overview of hyperparameter tuning](https://cloud.google.com/vertex-ai/docs/training/hyperparameter-tuning-overview)"
|
||||
]
|
||||
@@ -1162,9 +1163,9 @@
|
||||
"id": "hpt_vizier_intro"
|
||||
},
|
||||
"source": [
|
||||
"## Vertex Hyperparameter Tuning and Vertex Vizer service combined\n",
|
||||
"## Vertex AI Hyperparameter Tuning and Vertex AI Vizer service combined\n",
|
||||
"\n",
|
||||
"The following example demonstrates how to setup, execute and evaluate trials using the Vertex Hyperparameter Tuning service with `Vizier` search service."
|
||||
"The following example demonstrates how to setup, execute and evaluate trials using the Vertex AI Hyperparameter Tuning service with `Vizier` search service."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1351,7 +1352,7 @@
|
||||
"id": "vizier_intro"
|
||||
},
|
||||
"source": [
|
||||
"## Standalone Vertex Vizer service\n",
|
||||
"## Standalone Vertex AI Vizer service\n",
|
||||
"\n",
|
||||
"The `Vizier` service can be used as a standalone service for selecting the next set of parameters for a trial.\n",
|
||||
"\n",
|
||||
@@ -1368,7 +1369,7 @@
|
||||
"source": [
|
||||
"### Create Vizier client\n",
|
||||
"\n",
|
||||
"Create a client side connection to the Vertex Vizier service."
|
||||
"Create a client side connection to the Vertex AI Vizier service."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -937,8 +937,17 @@
|
||||
" name=\"deploy_decision\",\n",
|
||||
" ):\n",
|
||||
"\n",
|
||||
" endpoint_op = gcc_aip.EndpointCreateOp(\n",
|
||||
" project=project,\n",
|
||||
" location=gcp_region,\n",
|
||||
" display_name=\"train-automl-beans\",\n",
|
||||
" )\n",
|
||||
"\n",
|
||||
" gcc_aip.ModelDeployOp(\n",
|
||||
" model=training_op.outputs[\"model\"],\n",
|
||||
" endpoint=endpoint_op.outputs[\"endpoint\"],\n",
|
||||
" dedicated_resources_min_replica_count=1,\n",
|
||||
" dedicated_resources_max_replica_count=1,\n",
|
||||
" dedicated_resources_machine_type=MACHINE_TYPE,\n",
|
||||
" )"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user