mirror of
https://github.com/GoogleCloudPlatform/vertex-ai-samples.git
synced 2026-09-26 14:42:04 +00:00
chore,refactor(egen): minor changes to the automl_tabular_on_vertex_pipelines notebook (#3298)
* chore,refactor(egen): Changed REGION variable name to LOCATION, defined two variables to get the pipelines names to be used in cleanup section, added cleanup code for deletion of pipelines and models, replaced uuid with unique,removed os.getenv(IS_TESTING) from the cleanup section, refactored code according to the template guidelines and performed linter test. * fix(egen): changed the version of google-cloud-pipeline-components and performed linter test. * chore(egen): changed the version of google cloud pipeline components package in installation step and performed linter test. * fix(egen): changed the model-evaluation parameter to model-evaluation-2 in get_evaluation_metrics function and performed linter test. * fix(egen): modified the code in get_feature_attributions helper function and performed linter test. * fix(egen): modified code in cleanup section to delete pipeline jobs and performed linter test. * fix(egen): renamed model-upload-2 to model-upload in cleanup code of automl tabular architecture pipeline and performed linter test. * chore(egen): changed the colab enterprise link by renaming automml to automl in link and performed linter test. --------- Co-authored-by: sriramya2610 <sriramya.peddapally@egen.ai>
This commit is contained in:
co-authored by
sriramya2610
parent
5ec392769a
commit
42a8600aa7
@@ -32,25 +32,27 @@
|
||||
"# AutoML Tabular Workflow pipelines\n",
|
||||
"\n",
|
||||
"<table align=\"left\">\n",
|
||||
" <td>\n",
|
||||
" <td style=\"text-align: center\">\n",
|
||||
" <a href=\"https://colab.research.google.com/github/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/automl/automl_tabular_on_vertex_pipelines.ipynb\">\n",
|
||||
" <img src=\"https://cloud.google.com/ml-engine/images/colab-logo-32px.png\" alt=\"Colab logo\"> Run in Colab\n",
|
||||
" <img 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>\n",
|
||||
" <a href=\"https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/automl/automl_tabular_on_vertex_pipelines.ipynb\">\n",
|
||||
" <img src=\"https://cloud.google.com/ml-engine/images/github-logo-32px.png\" alt=\"GitHub logo\">\n",
|
||||
" View on GitHub\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%2Fautoml%2Fautoml_tabular_on_vertex_pipelines.ipynb\">\n",
|
||||
" <img width=\"32px\" src=\"https://cloud.google.com/ml-engine/images/colab-enterprise-logo-32px.png\" alt=\"Google Cloud Colab Enterprise logo\"><br> Open in Colab Enterprise\n",
|
||||
" </a>\n",
|
||||
" </td>\n",
|
||||
" <td>\n",
|
||||
" </td> \n",
|
||||
" <td style=\"text-align: center\">\n",
|
||||
" <a href=\"https://console.cloud.google.com/vertex-ai/workbench/deploy-notebook?download_url=https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/main/notebooks/official/automl/automl_tabular_on_vertex_pipelines.ipynb\">\n",
|
||||
" <img src=\"https://lh3.googleusercontent.com/UiNooY4LUgW_oTvpsNhPpQzsstV5W8F7rYgxgGBD85cWJoLmrOzhVs_ksK_vgx40SHs7jCqkTkCk=e14-rj-sc0xffffff-h130-w32\" alt=\"Vertex AI logo\">\n",
|
||||
" Open in Vertex AI Workbench\n",
|
||||
" <img src=\"https://lh3.googleusercontent.com/UiNooY4LUgW_oTvpsNhPpQzsstV5W8F7rYgxgGBD85cWJoLmrOzhVs_ksK_vgx40SHs7jCqkTkCk=e14-rj-sc0xffffff-h130-w32\" alt=\"Vertex AI logo\"><br> Open in Workbench\n",
|
||||
" </a>\n",
|
||||
" </td>\n",
|
||||
"</table>\n",
|
||||
"<br/><br/><br/>"
|
||||
" <td style=\"text-align: center\">\n",
|
||||
" <a href=\"https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/automl/automl_tabular_on_vertex_pipelines.ipynb\">\n",
|
||||
" <img src=\"https://cloud.google.com/ml-engine/images/github-logo-32px.png\" alt=\"GitHub logo\"><br> View on GitHub\n",
|
||||
" </a>\n",
|
||||
" </td>\n",
|
||||
"</table>"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -119,15 +121,22 @@
|
||||
"to generate a cost estimate based on your projected usage."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "f0316df526f8"
|
||||
},
|
||||
"source": [
|
||||
"## Get started"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "install_aip:mbsdk"
|
||||
},
|
||||
"source": [
|
||||
"## Installation\n",
|
||||
"\n",
|
||||
"Install the latest version of Vertex AI SDK for Python."
|
||||
"### Install Vertex AI SDK for Python and other required packages"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -138,48 +147,87 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"!pip3 install --upgrade --quiet google-cloud-pipeline-components==1.0.25 \\\n",
|
||||
"!pip3 install --upgrade --quiet google-cloud-pipeline-components==1.0.45 \\\n",
|
||||
" google-cloud-aiplatform"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "restart"
|
||||
"id": "ff555b32bab8"
|
||||
},
|
||||
"source": [
|
||||
"### Colab only: Uncomment the following cell to restart the kernel"
|
||||
"### Restart runtime (Colab only)\n",
|
||||
"\n",
|
||||
"To use the newly installed packages, you must restart the runtime on Google Colab."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "D-ZBOjErv5mM"
|
||||
"id": "f09b4dff629a"
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Automatically restart kernel after installs so that your environment can access the new packages\n",
|
||||
"# import IPython\n",
|
||||
"import sys\n",
|
||||
"\n",
|
||||
"# app = IPython.Application.instance()\n",
|
||||
"# app.kernel.do_shutdown(True)"
|
||||
"if \"google.colab\" in sys.modules:\n",
|
||||
"\n",
|
||||
" import IPython\n",
|
||||
"\n",
|
||||
" app = IPython.Application.instance()\n",
|
||||
" app.kernel.do_shutdown(True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "yfEglUHQk9S3"
|
||||
"id": "4a2b7b59bbf7"
|
||||
},
|
||||
"source": [
|
||||
"## Before you begin\n",
|
||||
"<div class=\"alert alert-block alert-warning\">\n",
|
||||
"<b>⚠️ The kernel is going to restart. Wait until it's finished before continuing to the next step. ⚠️</b>\n",
|
||||
"</div>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "f82e28c631cc"
|
||||
},
|
||||
"source": [
|
||||
"### Authenticate your notebook environment (Colab only)\n",
|
||||
"\n",
|
||||
"### Set your project ID\n",
|
||||
"Authenticate your environment on Google Colab."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "46604f70e831"
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import sys\n",
|
||||
"\n",
|
||||
"**If you don't know your project ID**, try the following:\n",
|
||||
"* Run `gcloud config list`.\n",
|
||||
"* Run `gcloud projects list`.\n",
|
||||
"* See the support page: [Locate the project ID](https://support.google.com/googleapi/answer/7014113)"
|
||||
"if \"google.colab\" in sys.modules:\n",
|
||||
"\n",
|
||||
" from google.colab import auth\n",
|
||||
"\n",
|
||||
" auth.authenticate_user()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "91842ef41bbd"
|
||||
},
|
||||
"source": [
|
||||
"### Set Google Cloud project information\n",
|
||||
"\n",
|
||||
"To get started using Vertex AI, you must have an existing Google Cloud project and [enable the Vertex AI API](https://console.cloud.google.com/flows/enableapi?apiid=aiplatform.googleapis.com). Learn more about [setting up a project and a development environment](https://cloud.google.com/vertex-ai/docs/start/cloud-environment)."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -191,100 +239,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"PROJECT_ID = \"[your-project-id]\" # @param {type:\"string\"}\n",
|
||||
"\n",
|
||||
"# Set the project id\n",
|
||||
"! gcloud config set project {PROJECT_ID}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "zebLBGXOky2A"
|
||||
},
|
||||
"source": [
|
||||
"## Notes about service account and permission\n",
|
||||
"\n",
|
||||
"**By default no configuration is required**, if you run into any permission related issue, please make sure the service accounts have the required roles listed in the [Service accounts for Tabular Workflow for End-to-End AutoML documentation](https://cloud.google.com/vertex-ai/docs/tabular-data/tabular-workflows/service-accounts#e2e-automl)."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "region"
|
||||
},
|
||||
"source": [
|
||||
"#### Region\n",
|
||||
"\n",
|
||||
"You can also change the `REGION` variable used by Vertex AI. Learn more about [Vertex AI regions](https://cloud.google.com/vertex-ai/docs/general/locations)."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "region"
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"REGION = \"us-central1\" # @param {type: \"string\"}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "gcp_authenticate"
|
||||
},
|
||||
"source": [
|
||||
"### Authenticate your Google Cloud account\n",
|
||||
"\n",
|
||||
"Depending on your Jupyter environment, you may have to manually authenticate. Follow the relevant instructions below.\n",
|
||||
"\n",
|
||||
"**1. Vertex AI Workbench**\n",
|
||||
"* Do nothing as you are already authenticated.\n",
|
||||
"\n",
|
||||
"**2. Local JupyterLab instance, uncomment and run:**"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "ce6043da7b33"
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# ! gcloud auth login"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "0367eac06a10"
|
||||
},
|
||||
"source": [
|
||||
"**3. Colab, uncomment and run:**"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "21ad4dbb4a61"
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# from google.colab import auth\n",
|
||||
"# auth.authenticate_user()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "c13224697bfb"
|
||||
},
|
||||
"source": [
|
||||
"**4. Service account or other**\n",
|
||||
"* See how to grant Cloud Storage permissions to your service account at https://cloud.google.com/storage/docs/gsutil/commands/iam#ch-examples."
|
||||
"LOCATION = \"us-central1\" # @param {type: \"string\"}"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -326,7 +281,7 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"! gsutil mb -l $REGION $BUCKET_URI"
|
||||
"! gsutil mb -l $LOCATION $BUCKET_URI"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -337,7 +292,7 @@
|
||||
"source": [
|
||||
"#### Service Account\n",
|
||||
"\n",
|
||||
"You use a service account to create Vertex AI Pipeline jobs. If you do not want to use your project's Compute Engine service account, set `SERVICE_ACCOUNT` to another service account ID."
|
||||
"You use a service account to create Vertex AI Pipeline jobs. If you don't want to use your project's Compute Engine service account, set `SERVICE_ACCOUNT` to another service account ID."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -359,6 +314,9 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import sys\n",
|
||||
"\n",
|
||||
"IS_COLAB = \"google.colab\" in sys.modules\n",
|
||||
"if (\n",
|
||||
" SERVICE_ACCOUNT == \"\"\n",
|
||||
" or SERVICE_ACCOUNT is None\n",
|
||||
@@ -420,7 +378,6 @@
|
||||
"import json\n",
|
||||
"# Import required modules\n",
|
||||
"import os\n",
|
||||
"import uuid\n",
|
||||
"from typing import Any, Dict, List\n",
|
||||
"\n",
|
||||
"from google.cloud import aiplatform, storage\n",
|
||||
@@ -447,7 +404,7 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"aiplatform.init(project=PROJECT_ID, location=REGION)"
|
||||
"aiplatform.init(project=PROJECT_ID, location=LOCATION)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -526,18 +483,16 @@
|
||||
"def get_feature_attributions(\n",
|
||||
" task_details,\n",
|
||||
"):\n",
|
||||
" ensemble_task = get_task_detail(task_details, \"model-evaluation-2\")\n",
|
||||
" ensemble_task = get_task_detail(task_details, \"feature-attribution-2\")\n",
|
||||
" return download_from_gcs(\n",
|
||||
" ensemble_task.outputs[\"evaluation_metrics\"]\n",
|
||||
" .artifacts[0]\n",
|
||||
" .metadata[\"explanation_gcs_path\"]\n",
|
||||
" ensemble_task.outputs[\"feature_attributions\"].artifacts[0].uri\n",
|
||||
" )\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def get_evaluation_metrics(\n",
|
||||
" task_details,\n",
|
||||
"):\n",
|
||||
" ensemble_task = get_task_detail(task_details, \"model-evaluation\")\n",
|
||||
" ensemble_task = get_task_detail(task_details, \"model-evaluation-2\")\n",
|
||||
" return download_from_gcs(\n",
|
||||
" ensemble_task.outputs[\"evaluation_metrics\"].artifacts[0].uri\n",
|
||||
" )\n",
|
||||
@@ -607,7 +562,7 @@
|
||||
" \"poutcome\",\n",
|
||||
"]\n",
|
||||
"transformations = generate_auto_transformation(features)\n",
|
||||
"transform_config_path = os.path.join(root_dir, f\"transform_config_{uuid.uuid4()}.json\")\n",
|
||||
"transform_config_path = os.path.join(root_dir, \"transform_config_unique.json\")\n",
|
||||
"write_to_gcs(transform_config_path, json.dumps(transformations))"
|
||||
]
|
||||
},
|
||||
@@ -658,7 +613,7 @@
|
||||
"source": [
|
||||
"## Customize search space and change training configuration\n",
|
||||
"\n",
|
||||
"We will create a skip evaluation AutoML Tables pipeline with the following customizations:\n",
|
||||
"You create a skip evaluation AutoML Tables pipeline with the following customizations:\n",
|
||||
"- Limit the hyperparameter search space\n",
|
||||
"- Change machine type and tuning / training parallelism"
|
||||
]
|
||||
@@ -721,7 +676,7 @@
|
||||
" parameter_values,\n",
|
||||
") = automl_tabular_utils.get_automl_tabular_pipeline_and_parameters(\n",
|
||||
" PROJECT_ID,\n",
|
||||
" REGION,\n",
|
||||
" LOCATION,\n",
|
||||
" root_dir,\n",
|
||||
" target_column,\n",
|
||||
" prediction_type,\n",
|
||||
@@ -747,10 +702,10 @@
|
||||
" export_additional_model_without_custom_ops=export_additional_model_without_custom_ops,\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"job_id = \"automl-tabular-{}\".format(uuid.uuid4())\n",
|
||||
"job_id = \"automl-tabular-unique\"\n",
|
||||
"job = aiplatform.PipelineJob(\n",
|
||||
" display_name=job_id,\n",
|
||||
" location=REGION, # launches the pipeline job in the specified region\n",
|
||||
" location=LOCATION, # launches the pipeline job in the specified location\n",
|
||||
" template_path=template_path,\n",
|
||||
" job_id=job_id,\n",
|
||||
" pipeline_root=root_dir,\n",
|
||||
@@ -774,7 +729,9 @@
|
||||
" load_and_print_json(get_evaluation_metrics(pipeline_task_details))\n",
|
||||
"\n",
|
||||
" print(\"feature attributions:\")\n",
|
||||
" load_and_print_json(get_feature_attributions(pipeline_task_details))"
|
||||
" load_and_print_json(get_feature_attributions(pipeline_task_details))\n",
|
||||
"\n",
|
||||
"automl_tabular_pipeline_job_name = job_id"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -784,11 +741,11 @@
|
||||
},
|
||||
"source": [
|
||||
"## Skip architecture search\n",
|
||||
"Instead of doing architecture search everytime, we can reuse the existing architecture search result. This could help:\n",
|
||||
"Instead of doing architecture search everytime, you can reuse the existing architecture search result. This could help:\n",
|
||||
"1. reducing the variation of the output model\n",
|
||||
"2. reducing training cost\n",
|
||||
"\n",
|
||||
"The existing architecture search result is stored in the `tuning_result_output` output of the `automl-tabular-stage-1-tuner` component. We can manually input it or get it programmatically."
|
||||
"The existing architecture search result is stored in the `tuning_result_output` output of the `automl-tabular-stage-1-tuner` component. You can manually input it or get it programmatically."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -830,7 +787,7 @@
|
||||
" parameter_values,\n",
|
||||
") = automl_tabular_utils.get_skip_architecture_search_pipeline_and_parameters(\n",
|
||||
" PROJECT_ID,\n",
|
||||
" REGION,\n",
|
||||
" LOCATION,\n",
|
||||
" root_dir,\n",
|
||||
" target_column,\n",
|
||||
" prediction_type,\n",
|
||||
@@ -852,10 +809,10 @@
|
||||
" dataflow_use_public_ips=dataflow_use_public_ips,\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"job_id = \"automl-tabular-skip-architecture-search-{}\".format(uuid.uuid4())\n",
|
||||
"job_id = \"automl-tabular-skip-architecture-search-unique\"\n",
|
||||
"job = aiplatform.PipelineJob(\n",
|
||||
" display_name=job_id,\n",
|
||||
" location=REGION, # launches the pipeline job in the specified region\n",
|
||||
" location=LOCATION, # launches the pipeline job in the specified location\n",
|
||||
" template_path=template_path,\n",
|
||||
" job_id=job_id,\n",
|
||||
" pipeline_root=root_dir,\n",
|
||||
@@ -874,7 +831,9 @@
|
||||
" print(\n",
|
||||
" \"trained model without custom TF ops:\",\n",
|
||||
" get_no_custom_ops_model_uri(pipeline_task_details),\n",
|
||||
" )"
|
||||
" )\n",
|
||||
"\n",
|
||||
"automl_tabular_skip_architecture_search_pipeline_job_name = job_id"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -897,12 +856,66 @@
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "ad8d12061a65"
|
||||
"id": "acd787ad23d6"
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"if os.getenv(\"IS_TESTING\"):\n",
|
||||
" ! gsutil rm -r $BUCKET_URI"
|
||||
"def get_task_detail(\n",
|
||||
" task_details: List[Dict[str, Any]], task_name: str\n",
|
||||
") -> List[Dict[str, Any]]:\n",
|
||||
" for task_detail in task_details:\n",
|
||||
" if task_detail.task_name == task_name:\n",
|
||||
" return task_detail"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "5354389ff0dc"
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Get the automl tabular training pipeline object\n",
|
||||
"automl_tabular_pipeline_job = aiplatform.PipelineJob.get(\n",
|
||||
" f\"projects/{PROJECT_ID}/locations/{LOCATION}/pipelineJobs/{automl_tabular_pipeline_job_name}\"\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"# fetch automl tabular training pipeline task details\n",
|
||||
"pipeline_task_details = automl_tabular_pipeline_job.gca_resource.job_detail.task_details\n",
|
||||
"\n",
|
||||
"# fetch model from automl tabular training pipeline and delete the model\n",
|
||||
"model_task = get_task_detail(pipeline_task_details, \"model-upload-2\")\n",
|
||||
"model_resourceName = model_task.outputs[\"model\"].artifacts[0].metadata[\"resourceName\"]\n",
|
||||
"model = aiplatform.Model(model_resourceName)\n",
|
||||
"model.delete()\n",
|
||||
"\n",
|
||||
"# Delete the automl tabular pipeline\n",
|
||||
"automl_tabular_pipeline_job.delete()\n",
|
||||
"\n",
|
||||
"# Get the automl tabular skip architecture search pipeline object\n",
|
||||
"automl_tabular_skip_architecture_search_pipeline_job = aiplatform.PipelineJob.get(\n",
|
||||
" f\"projects/{PROJECT_ID}/locations/{LOCATION}/pipelineJobs/{automl_tabular_skip_architecture_search_pipeline_job_name}\"\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"# fetch automl tabular skip architecture search pipeline task details\n",
|
||||
"pipeline_task_details = (\n",
|
||||
" automl_tabular_skip_architecture_search_pipeline_job.gca_resource.job_detail.task_details\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"# fetch model from automl tabular skip architecture search pipeline and delete the model\n",
|
||||
"model_task = get_task_detail(pipeline_task_details, \"model-upload\")\n",
|
||||
"model_resourceName = model_task.outputs[\"model\"].artifacts[0].metadata[\"resourceName\"]\n",
|
||||
"model = aiplatform.Model(model_resourceName)\n",
|
||||
"model.delete()\n",
|
||||
"\n",
|
||||
"# Delete the automl tabular skip architecture search pipeline\n",
|
||||
"automl_tabular_skip_architecture_search_pipeline_job.delete()\n",
|
||||
"\n",
|
||||
"# Delete Cloud Storage objects that were created\n",
|
||||
"delete_bucket = False # Set True for deletion\n",
|
||||
"if delete_bucket:\n",
|
||||
" ! gsutil -m rm -r $BUCKET_URI"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user