Compare commits

...
Author SHA1 Message Date
Andrew Ferlitsch 2386958dc6 fix: remove hardwired project number 2022-06-29 21:41:12 +00:00
Andrew Ferlitsch 5c8bb2d428 fix: remove hardwired project number 2022-06-29 21:40:26 +00:00
@@ -255,6 +255,30 @@
"! gcloud config set project $PROJECT_ID"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "23988890fef6"
},
"source": [
"#### Get your project number\n",
"\n",
"Now that the project ID is set, you get your corresponding project number."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "2d6950574e1d"
},
"outputs": [],
"source": [
"shell_output = ! gcloud projects list --filter=\"PROJECT_ID:'{PROJECT_ID}'\" --format='value(PROJECT_NUMBER)'\n",
"PROJECT_NUMBER = shell_output[0]\n",
"print(\"Project Number:\", PROJECT_NUMBER)"
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -730,7 +754,7 @@
"\n",
"artifact_item = Artifact(\n",
" display_name=\"flowers_\" + TIMESTAMP,\n",
" uri=\"https://us-central1-aiplatform.googleapis.com/v1/\" + dataset.resource_name,\n",
" uri=f\"https://{REGION}-aiplatform.googleapis.com/v1/\" + dataset.resource_name,\n",
" name=dataset.resource_name,\n",
" schema_title=\"google.VertexDataset\",\n",
" metadata={\"data_type\": \"image\", \"annotation_type\": \"image classification\"},\n",
@@ -738,7 +762,7 @@
")\n",
"\n",
"artifact_dataset = clients[\"metadata\"].create_artifact(\n",
" parent=\"projects/759209241365/locations/us-central1/metadataStores/default\",\n",
" parent=f\"projects/{PROJECT_NUMBER}/locations/{REGION}/metadataStores/default\",\n",
" artifact=artifact_item,\n",
" artifact_id=dataset.resource_name.split(\"/\")[-1],\n",
")\n",
@@ -869,7 +893,7 @@
"source": [
"artifact_item = Artifact(\n",
" display_name=\"flowers_\" + TIMESTAMP,\n",
" uri=\"https://us-central1-aiplatform.googleapis.com/v1/\" + model.resource_name,\n",
" uri=f\"https://{REGION}-aiplatform.googleapis.com/v1/\" + model.resource_name,\n",
" name=model.resource_name,\n",
" schema_title=\"google.VertexModel\",\n",
" metadata={\"model_type\": \"image classification\"},\n",
@@ -877,7 +901,7 @@
")\n",
"\n",
"artifact_model = clients[\"metadata\"].create_artifact(\n",
" parent=\"projects/759209241365/locations/us-central1/metadataStores/default\",\n",
" parent=f\"projects/{PROJECT_NUMBER}/locations/{REGION}/metadataStores/default\",\n",
" artifact=artifact_item,\n",
" artifact_id=model.resource_name.split(\"/\")[-1],\n",
")\n",
@@ -941,7 +965,7 @@
"source": [
"artifact_item = Artifact(\n",
" display_name=\"flowers_\" + TIMESTAMP,\n",
" uri=\"https://us-central1-aiplatform.googleapis.com/v1/\"\n",
" uri=f\"https://{REGION}-aiplatform.googleapis.com/v1/\"\n",
" + model_evaluations[0].resource_name,\n",
" name=model_evaluations[0].resource_name,\n",
" schema_title=\"system.SlicedClassificationMetrics\",\n",
@@ -950,7 +974,7 @@
")\n",
"\n",
"artifact_metrics = clients[\"metadata\"].create_artifact(\n",
" parent=\"projects/759209241365/locations/us-central1/metadataStores/default\",\n",
" parent=f\"projects/{PROJECT_NUMBER}/locations/{REGION}/metadataStores/default\",\n",
" artifact=artifact_item,\n",
" artifact_id=model_evaluations[0].resource_name.split(\"/\")[-1],\n",
")\n",
@@ -1011,7 +1035,7 @@
"source": [
"artifact_item = Artifact(\n",
" display_name=\"flowers_\" + TIMESTAMP,\n",
" uri=\"https://us-central1-aiplatform.googleapis.com/v1/\" + endpoint.resource_name,\n",
" uri=f\"https://{REGION}-aiplatform.googleapis.com/v1/\" + endpoint.resource_name,\n",
" name=endpoint.resource_name,\n",
" schema_title=\"google.VertexEndpoint\",\n",
" metadata={\"param\": \"value\"},\n",
@@ -1019,7 +1043,7 @@
")\n",
"\n",
"artifact_endpoint = clients[\"metadata\"].create_artifact(\n",
" parent=\"projects/759209241365/locations/us-central1/metadataStores/default\",\n",
" parent=f\"projects/{PROJECT_NUMBER}/locations/{REGION}/metadataStores/default\",\n",
" artifact=artifact_item,\n",
" artifact_id=endpoint.resource_name.split(\"/\")[-1],\n",
")\n",
@@ -1058,7 +1082,7 @@
"from google.cloud.aiplatform_v1beta1.types import Execution\n",
"\n",
"execution = clients[\"metadata\"].create_execution(\n",
" parent=\"projects/759209241365/locations/us-central1/metadataStores/default\",\n",
" parent=f\"projects/{PROJECT_NUMBER}/locations/{REGION}/metadataStores/default\",\n",
" execution=Execution(\n",
" display_name=\"AutoML training and deployment\",\n",
" schema_title=\"system.ContainerExecution\",\n",
@@ -1157,7 +1181,7 @@
"from google.cloud.aiplatform_v1beta1.types import Context\n",
"\n",
"context = clients[\"metadata\"].create_context(\n",
" parent=\"projects/759209241365/locations/us-central1/metadataStores/default\",\n",
" parent=f\"projects/{PROJECT_NUMBER}/locations/{REGION}/metadataStores/default\",\n",
" context=Context(\n",
" display_name=\"flowers_\" + TIMESTAMP,\n",
" schema_title=\"system.Pipeline\",\n",