From 3f2da94728b77a566b98a83852de3002b8a27fc7 Mon Sep 17 00:00:00 2001 From: Vertex MG Team Date: Wed, 26 Feb 2025 18:21:30 -0800 Subject: [PATCH] Update owlvit notebook to support Vertex Workbench. PiperOrigin-RevId: 731527931 --- .../model_garden/model_garden_pytorch_owlvit.ipynb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/notebooks/community/model_garden/model_garden_pytorch_owlvit.ipynb b/notebooks/community/model_garden/model_garden_pytorch_owlvit.ipynb index 16b64e67c..49aea55a5 100644 --- a/notebooks/community/model_garden/model_garden_pytorch_owlvit.ipynb +++ b/notebooks/community/model_garden/model_garden_pytorch_owlvit.ipynb @@ -34,6 +34,11 @@ "\n", "\n", " \n", + "
\n", + " \n", + " \"Workbench
Run in Workbench\n", + "
\n", + "
\n", " \n", " \"Google
Run in Colab Enterprise\n", "
\n", @@ -122,6 +127,7 @@ "import matplotlib.pyplot as plt\n", "from google.cloud import aiplatform\n", "\n", + "! pip install --upgrade tensorflow\n", "! git clone https://github.com/GoogleCloudPlatform/vertex-ai-samples.git\n", "\n", "common_util = importlib.import_module(\n", @@ -134,6 +140,12 @@ "\n", "# Get the default region for launching jobs.\n", "if not REGION:\n", + " if not os.environ.get(\"GOOGLE_CLOUD_REGION\"):\n", + " raise ValueError(\n", + " \"REGION must be set. See\"\n", + " \" https://cloud.google.com/vertex-ai/docs/general/locations for\"\n", + " \" available cloud locations.\"\n", + " )\n", " REGION = os.environ[\"GOOGLE_CLOUD_REGION\"]\n", "\n", "# Enable the Vertex AI API and Compute Engine API, if not already.\n", @@ -227,7 +239,7 @@ " serving_env = {\n", " \"MODEL_ID\": model_id,\n", " \"TASK\": task,\n", - " \"DEPLOY_SOURCE\": \"notebook\",\n", + " \"DEPLOY_SOURCE\": common_util.get_deploy_source(),\n", " }\n", " # If the model_id is a GCS path, use artifact_uri to pass it to serving docker.\n", " artifact_uri = model_id if model_id.startswith(\"gs://\") else None\n",