Compare commits

...
2 changed files with 2372 additions and 9 deletions
@@ -131,7 +131,9 @@
" ! pip3 install --upgrade cloudml-hypertune $USER_FLAG\n",
" ! pip3 install --upgrade kfp $USER_FLAG\n",
" ! pip3 install --upgrade torchvision $USER_FLAG\n",
" ! pip3 install --upgrade rpy2 $USER_FLAG"
" ! pip3 install --upgrade rpy2 $USER_FLAG\n",
" ! pip3 install --upgrade python-tabulate $USER_FLAG\n",
" ! pip3 install -U opencv-python-headless==4.5.2.52 $USER_FLAG"
]
},
{
@@ -540,11 +542,13 @@
},
"outputs": [],
"source": [
"from kfp.v2.dsl import Artifact, Input, Model\n",
"from kfp.v2.dsl import Artifact, Input, Model, Output\n",
"\n",
"\n",
"@component(packages_to_install=[\"google-cloud-aiplatform\"])\n",
"def evaluateAutoMLModelOp(model: Input[Artifact], region: str) -> str:\n",
"def evaluateAutoMLModelOp(\n",
" model: Input[Artifact], region: str, model_evaluation: Output[Artifact]\n",
"):\n",
" import logging\n",
"\n",
" import google.cloud.aiplatform.gapic as gapic\n",
@@ -557,8 +561,7 @@
"\n",
" model_evaluations = model_service_client.list_model_evaluations(parent=model_id)\n",
" model_evaluation = list(model_evaluations)[0]\n",
" logging.info(model_evaluation)\n",
" return str(model_evaluation)"
" logging.info(model_evaluation)"
]
},
{
@@ -745,7 +748,7 @@
"source": [
"### Make the batch input file\n",
"\n",
"Now make a batch input file, which you will store in your local Cloud Storage bucket. The batch input file can be either CSV or JSONL. You will use JSONL in this tutorial. For JSONL file, you make one dictionary entry per line for each data item (instance). The dictionary contains the key/value pairs:\n",
"Now make a batch input file, which you will store in your local Cloud Storage bucket. The batch input file can only be in JSONL. For JSONL file, you make one dictionary entry per line for each data item (instance). The dictionary contains the key/value pairs:\n",
"\n",
"- `content`: The Cloud Storage path to the image.\n",
"- `mime_type`: The content type. In our example, it is a `jpeg` file.\n",
@@ -877,14 +880,29 @@
" + str(TASK_ID)\n",
" + \"/gcp_resources\"\n",
" )\n",
" EVAL_METRICS = (\n",
" PIPELINE_ROOT\n",
" + \"/\"\n",
" + PROJECT_NUMBER\n",
" + \"/\"\n",
" + JOB_ID\n",
" + \"/\"\n",
" + output_task_name\n",
" + \"_\"\n",
" + str(TASK_ID)\n",
" + \"/evaluation_metrics\"\n",
" )\n",
" if tf.io.gfile.exists(EXECUTE_OUTPUT):\n",
" ! gsutil cat $EXECUTE_OUTPUT\n",
" break\n",
" return EXECUTE_OUTPUT\n",
" elif tf.io.gfile.exists(GCP_RESOURCES):\n",
" ! gsutil cat $GCP_RESOURCES\n",
" break\n",
" return GCP_RESOURCES\n",
" elif tf.io.gfile.exists(EVAL_METRICS):\n",
" ! gsutil cat $EVAL_METRICS\n",
" return EVAL_METRICS\n",
"\n",
" return EXECUTE_OUTPUT\n",
" return None\n",
"\n",
"\n",
"print(\"image-dataset-create\")\n",
File diff suppressed because it is too large Load Diff