Compare commits

...
Author SHA1 Message Date
ivanmkc@google.com 5679e46a12 Addressed TW comments 2023-03-07 12:01:41 -05:00
ivanmkc@google.com d54b3845fe Fixed notebooks/official/ml_metadata/sdk-metric-parameter-tracking-for-locally-trained-models.ipynb 2023-03-07 10:45:42 -05:00
ivanmkc@google.com be20a635e4 Fixed missing dependency 2023-03-07 08:42:35 -05:00
ivanmkc@google.com b42b6c6fb8 Added missing cells 2023-03-06 23:34:27 -05:00
ivanmkc@google.com 73fbc762fe Added tqdm to requirements.txt 2023-03-06 20:00:53 -05:00
ivanmkc@google.com 994a86d07a Fixed bugs 2023-03-06 16:53:46 -05:00
ivanmkc@google.com 71c1eca210 Fixed predictions 2023-03-06 16:16:39 -05:00
ivanmkc@google.com 1c431bdb85 Updated links 2023-03-06 14:41:50 -05:00
ivanmkc@google.com 096a5d069e Linted 2023-03-06 14:38:29 -05:00
ivanmkc@google.com 3ade1ab265 Added stackoverflow embeddings notebook 2023-03-06 10:45:06 -05:00
Andrew FerlitschandGitHub 8593308244 Merge pull request #1569 from ninataneja/final-doc-change
Update dashboard instructions
2023-03-03 22:29:28 +00:00
Nina Taneja 806801b4ea Fix print error 2023-03-03 21:15:33 +00:00
Nina Taneja 3acd72ec81 Fix lint error 2023-03-03 20:49:42 +00:00
Nina Taneja 12347f3ce2 Add error handling for delete job 2023-03-03 20:45:29 +00:00
Nina Taneja f9c4e32088 Add sleep for async job 2023-03-03 20:11:00 +00:00
Nina Taneja 78da2206b0 Update dashboard instructions 2023-03-03 18:50:21 +00:00
gericdongandGitHub 46fa993732 Merge pull request #1559 from GoogleCloudPlatform/ml_ops_registry
feat: add notebook for model versioning
2023-03-03 18:43:05 +00:00
Andrew FerlitschandGitHub df0c0d209b Merge pull request #1568 from kthytang/fs-integration
feat: notebook for prediction feature store integration
2023-03-03 18:32:05 +00:00
kthytang 2e8d6239df chore: run python3.9 -m tensorflow_docs.tools.nbfmt --remove_outputs "$notebook" 2023-03-03 10:02:46 -08:00
Andrew Ferlitsch 1841201fee fix: dep issue 2023-03-03 17:20:44 +00:00
kthytang f10857f299 chore: address comments 2023-03-03 07:17:50 -08:00
kthytang e3bcff62fc chore: fix lint 2023-03-02 14:18:47 -08:00
kthytang ce3a439d06 feat: notebook for prediction feature store integration 2023-03-02 14:04:38 -08:00
Andrew FerlitschandGitHub b47d4b46f3 Merge pull request #1567 from GoogleCloudPlatform/reznitskii-patch-12
Fixed typo
2023-03-02 21:40:56 +00:00
Andrew FerlitschandGitHub 1cc87860c4 Merge pull request #1566 from GoogleCloudPlatform/reznitskii-patch-11
Fixed typo and link
2023-03-02 21:40:06 +00:00
reznitskiiandGitHub 5d6aa4479d Update automl_video_classification_model_evaluation.ipynb 2023-03-02 15:11:07 -05:00
reznitskiiandGitHub 5a25b06f2d Update UJ14 Vertex SDK AutoML Video Classification.ipynb 2023-03-02 15:09:45 -05:00
Andrew Ferlitsch bb055ed061 fix: cleanup 2023-03-02 18:26:45 +00:00
Andrew FerlitschandGitHub 974610a555 Merge pull request #1562 from GoogleCloudPlatform/reznitskii-patch-8
Updated link
2023-03-02 08:25:51 +00:00
Andrew FerlitschandGitHub d78574e640 Merge pull request #1565 from ninataneja/dask-sdk
Add SDK support for Dask dashboard to Training
2023-03-02 08:25:22 +00:00
Nina Taneja ff367ae9f5 Fixed formatting problem 2023-03-02 01:34:46 +00:00
Nina Taneja 40b5e74645 Addressed formatting and wording changes 2023-03-02 01:26:52 +00:00
Nina Taneja dee509e8d7 Add SDK support for Dask dashboard to Training 2023-03-01 23:39:06 +00:00
Andrew Ferlitsch fd5921fa32 fix: invalid alias 2023-03-01 22:55:39 +00:00
reznitskiiandGitHub c74a44a4a8 Update sdk_automl_tabular_classification_online_explain.ipynb 2023-03-01 17:22:30 -05:00
Andrew FerlitschandGitHub 367c985642 Merge pull request #1560 from GoogleCloudPlatform/autoindex_tensorboard
fix: tensorboard branding
2023-03-01 22:03:24 +00:00
Andrew Ferlitsch f7a970e15b fix: TIMESTAMP 2023-03-01 21:53:51 +00:00
Andrew Ferlitsch 9a914a5af4 fix: tensorboard branding 2023-03-01 21:46:57 +00:00
Andrew Ferlitsch e5315be85a feat: add notebook for model versioning 2023-03-01 20:54:17 +00:00
Andrew FerlitschandGitHub 6daf663a69 Merge pull request #1557 from GoogleCloudPlatform/custom_eval
feat: notebook for custom evaluations
2023-03-01 20:15:56 +00:00
Andrew Ferlitsch 45a65f1db8 fix: install issue 2023-03-01 20:05:54 +00:00
Andrew Ferlitsch 240c291728 feat: add eval on versioned model 2023-03-01 19:21:21 +00:00
gericdongandGitHub 4aec14c576 Merge pull request #1558 from GoogleCloudPlatform/andrewferlitsch-patch-4
tmp file added by mistake
2023-03-01 18:34:45 +00:00
Andrew FerlitschandGitHub f7d4d3a9c3 tmp file added by mistake 2023-03-01 10:08:20 -08:00
Andrew Ferlitsch 3c64a8aa58 fix: review nits 2023-03-01 18:04:34 +00:00
Andrew Ferlitsch 5f692ea299 fix: missing installs 2023-03-01 16:06:54 +00:00
Andrew FerlitschandGitHub ab1e97ac18 Merge pull request #1553 from GoogleCloudPlatform/autoindex_max_3
fix: 5 branding bugs
2023-03-01 16:04:23 +00:00
Andrew FerlitschandGitHub 78630ae2c0 Merge pull request #1552 from GoogleCloudPlatform/reznitskii-patch-3
Fixed typo
2023-03-01 16:03:51 +00:00
Andrew Ferlitsch 0f48628782 feat: notebook for custom evaluations 2023-03-01 00:52:20 +00:00
Andrew Ferlitsch 93e9fbac92 fix: 5 branding bugs 2023-02-28 20:42:03 +00:00
Andrew FerlitschandGitHub 231b2ef02b Merge pull request #1556 from GoogleCloudPlatform/reznitskii-patch-6
Fixed typo
2023-02-28 20:40:04 +00:00
Andrew FerlitschandGitHub 7132c12831 Merge pull request #1555 from GoogleCloudPlatform/reznitskii-patch-5
Fixed typos
2023-02-28 20:31:30 +00:00
reznitskiiandGitHub 2b547e8279 Update forecasting-retail-demand.ipynb 2023-02-28 15:24:25 -05:00
reznitskiiandGitHub 8b84524244 Update ai-explanations-tabnet-algorithm.ipynb 2023-02-28 15:21:53 -05:00
Andrew Ferlitsch 60fe1bd2c6 fix: 5 branding bugs 2023-02-28 20:16:57 +00:00
reznitskiiandGitHub 0edea80ffa Update custom_tabular_regression_model_evaluation.ipynb 2023-02-28 15:02:47 -05:00
Yvonne LiandGitHub 493e50a999 Merge pull request #1550 from GoogleCloudPlatform/autoindex_max_2
fix: extra period in link
2023-02-28 19:50:08 +00:00
Andrew Ferlitsch 8440e7f164 fix: extra period in link 2023-02-28 19:44:33 +00:00
gericdongandGitHub 906aa91fe7 Merge pull request #1549 from GoogleCloudPlatform/mv_pytorch
fix: reorg
2023-02-28 18:41:15 +00:00
gericdongandGitHub 34e282172f Merge pull request #1548 from GoogleCloudPlatform/rm_pytorch_folder
fix: reorg
2023-02-28 18:29:13 +00:00
Andrew Ferlitsch bddf642b58 fix: reorg 2023-02-28 18:24:55 +00:00
Andrew Ferlitsch 25b89c497f fix: reorg 2023-02-28 18:19:55 +00:00
Andrew FerlitschandGitHub 23a51dbcaa Merge pull request #1526 from GoogleCloudPlatform/doc_tag_1
update tag/linkback #1 AutoML Video
2023-02-28 18:15:56 +00:00
Andrew FerlitschandGitHub 26761198d7 Merge pull request #1547 from GoogleCloudPlatform/autoindex_max_1
fix: web index tune
2023-02-28 17:39:34 +00:00
Andrew Ferlitsch 5b4e88e791 fix: web index tune 2023-02-28 17:29:45 +00:00
Andrew Ferlitsch 83cc796687 fix: workaround for running > 24hrs 2023-02-28 17:05:34 +00:00
Andrew FerlitschandGitHub 3e29cc62c7 Merge pull request #1536 from GoogleCloudPlatform/doc_tag_11
update tag/linkback #11 AutoML Video
2023-02-28 17:02:09 +00:00
Andrew FerlitschandGitHub 2b1bb77f4b Merge pull request #1535 from GoogleCloudPlatform/doc_tag_10
update tag/linkback #10 AutoMLVideo
2023-02-28 16:55:55 +00:00
Andrew Ferlitsch 7144b87f01 fix: workaround for running > 24hrs 2023-02-28 16:50:51 +00:00
Andrew Ferlitsch ebf4d6d8be fix: workaround for running > 24hrs 2023-02-28 16:47:14 +00:00
Andrew FerlitschandGitHub 2ccd913e2e Merge pull request #1528 from GoogleCloudPlatform/doc_tag_3
update tag/linkback #3 AutoML Video
2023-02-28 16:45:02 +00:00
Andrew Ferlitsch d777dd8625 fix: workaround for running > 24hrs 2023-02-28 16:32:16 +00:00
Andrew FerlitschandGitHub d912d3d4d8 Merge pull request #1545 from GoogleCloudPlatform/reznitskii-patch-1
Fixed typo
2023-02-28 02:29:29 +00:00
reznitskiiandGitHub bafe623590 Update automl_tabular_regression_model_evaluation.ipynb 2023-02-27 17:34:34 -05:00
gericdongandGitHub 152077a823 Merge pull request #1543 from GoogleCloudPlatform/guidelines
feat: add authoring guidelines
2023-02-27 20:43:43 +00:00
Andrew Ferlitsch 81c94f9711 feat: add authoring guidelines 2023-02-27 19:53:10 +00:00
Andrew FerlitschandGitHub 897e8e3e47 Merge pull request #1541 from GoogleCloudPlatform/template_linkback
fix: add tag/linkback
2023-02-27 18:06:24 +00:00
Andrew Ferlitsch ddc125da69 fix: smaller dataset 2023-02-27 16:16:13 +00:00
Eric SchmidtandGitHub abb66ade41 Merge pull request #1542 from gericdong/b270683209
fix: bad links in notebook
2023-02-24 17:06:07 +00:00
gericdong 2915824641 Lint 2023-02-24 09:03:19 -05:00
gericdong 44447637bd fixed bad links 2023-02-24 08:59:24 -05:00
Andrew FerlitschandGitHub 6a8345446d Merge pull request #1504 from reznitskii/b267661933-2
Replaced Vertex AI Training linkbacks with Custom training
2023-02-24 02:13:42 +00:00
Andrew Ferlitsch 27a7b8b1da fix: add tag/linkback 2023-02-24 00:22:18 +00:00
Andrew FerlitschandGitHub 04471e7104 Merge pull request #1540 from GoogleCloudPlatform/issue_1522
fix: link
2023-02-23 17:43:06 +00:00
Andrew FerlitschandGitHub e78ea4e805 Merge pull request #1538 from wintwoo/dataproc
Specify Dataproc Serverless Runtime version to use for batch workloads.
2023-02-23 04:14:06 +00:00
Andrew Ferlitsch 7487a14783 fix: link 2023-02-22 23:07:37 +00:00
Andrew FerlitschandGitHub 757d0c5087 change copyright back to 2022. Policy is year is the year first authored 2023-02-22 15:00:49 -08:00
Andrew FerlitschandGitHub 60cb93a9a9 Delete pytorch-text-sentiment-classification-custom-train-deploy.ipynb 2023-02-22 14:43:12 -08:00
Andrew FerlitschandGitHub 0fb72773f4 Merge pull request #1533 from GoogleCloudPlatform/doc_tag_8
update tag/linkback #8
2023-02-22 22:21:16 +00:00
Andrew FerlitschandGitHub 5d2fc74f78 Merge pull request #1532 from GoogleCloudPlatform/doc_tag_7
update tag/linkback #7
2023-02-22 22:20:58 +00:00
Andrew FerlitschandGitHub 1cc26481b2 Merge pull request #1531 from GoogleCloudPlatform/doc_tag_6
update tag/linkback #6
2023-02-22 22:20:50 +00:00
Andrew FerlitschandGitHub 85b0346eab Merge pull request #1530 from GoogleCloudPlatform/doc_tag_5
update tag/linkback #5
2023-02-22 22:20:24 +00:00
Andrew FerlitschandGitHub 910cbacb54 Merge pull request #1529 from GoogleCloudPlatform/doc_tag_4
update tag/linkback #4
2023-02-22 22:19:44 +00:00
Andrew FerlitschandGitHub c7206e3cc8 Merge pull request #1527 from GoogleCloudPlatform/doc_tag_2
update tag/linkback #2
2023-02-22 21:46:40 +00:00
Win Woo 12d721d33e Specify Dataproc runtime versions to use for batch jobs 2023-02-22 02:46:00 +00:00
Andrew FerlitschandGitHub 16df2216d1 Merge pull request #1525 from GoogleCloudPlatform/triton_ensenble_2
feat: triton ensemble
2023-02-21 21:32:16 +00:00
Andrew Ferlitsch fb26b7213c fix: links 2023-02-21 21:30:12 +00:00
Andrew Ferlitsch d90f52e122 fix: links 2023-02-21 19:47:23 +00:00
Andrew Ferlitsch 652f34b814 update tag/linkback 2023-02-21 18:37:09 +00:00
Andrew Ferlitsch c84f8738f8 update tag/linkback 2023-02-21 18:16:13 +00:00
Andrew Ferlitsch 9d72bbf237 update tag/linkback 2023-02-21 18:02:11 +00:00
Andrew Ferlitsch 85df50d06f update tag/linkback 2023-02-21 17:39:51 +00:00
Andrew Ferlitsch 9ab6cddade update tag/linkback 2023-02-21 17:33:56 +00:00
Andrew Ferlitsch 02ffffaeb7 update tag/linkback 2023-02-21 17:30:03 +00:00
Andrew Ferlitsch dfc5635d34 update tag/linkback 2023-02-21 17:25:40 +00:00
Andrew Ferlitsch 90b686cf69 update tag/linkback 2023-02-21 17:02:33 +00:00
Andrew Ferlitsch ad63153778 update tag/linkback 2023-02-21 16:58:56 +00:00
Andrew Ferlitsch 7858f8644e update tag/linkback 2023-02-21 16:55:10 +00:00
Andrew Ferlitsch 3df4098364 update tag/linkback 2023-02-21 16:46:03 +00:00
Andrew Ferlitsch ae3c1877e4 update tag/linkback 2023-02-21 16:41:17 +00:00
Andrew FerlitschandGitHub 2798ab1e02 set timeout 2023-02-21 08:33:40 -08:00
Andrew FerlitschandGitHub 7bd2c567a1 Merge pull request #1490 from GoogleCloudPlatform/imkc--matching-engine-embedding-tweak
Fixed typo in sdk_matching_engine_for_indexing.ipynb
2023-02-18 00:48:17 +00:00
Andrew Ferlitsch 56503cce6a feat: triton ensemble 2023-02-17 22:10:20 +00:00
Andrew FerlitschandGitHub a5a9f53a32 Merge pull request #1515 from junyanxu/add_experimental_info_to_automl_image_montioring_notebook
Add experimental information to automl image classifcation monitoring…
2023-02-17 15:52:07 +00:00
Junyan Xu 469e8436e9 Format the automl image online for model monitoring 2023-02-16 22:37:50 +00:00
Junyan Xu e9f9a5c29b Merge branch 'add_experimental_info_to_automl_image_montioring_notebook' of https://github.com/junyanxu/vertex-ai-samples into add_experimental_info_to_automl_image_montioring_notebook 2023-02-16 17:19:49 +00:00
Junyan Xu 102400a67f update online pip install package 2023-02-16 17:19:00 +00:00
Andrew FerlitschandGitHub 0ae53f47d4 Update get_started_with_model_monitoring_automl_image_batch.ipynb 2023-02-16 08:27:40 -08:00
Eric SchmidtandGitHub ff3e0b4784 Merge pull request #1519 from GoogleCloudPlatform/autoindex_official_6
tune: web index
2023-02-15 21:03:10 +00:00
Andrew Ferlitsch 0f4546c18c tune: web index 2023-02-15 20:56:47 +00:00
Andrew FerlitschandGitHub ee381e15f5 Update get_started_with_model_monitoring_automl_image_batch.ipynb 2023-02-15 12:13:36 -08:00
Junyan Xu c51a82febb format notebook 2023-02-10 19:15:15 +00:00
Junyan Xu 8e6e4729aa Add experimental information to automl image classifcation monitoring notebook 2023-02-10 18:48:09 +00:00
Max Reznitskii 4e82877269 Reverting changes to failing notebooks 2023-02-09 16:42:44 +00:00
Max Reznitskii c4f08589a9 Reverting changes to notebooks that fail tests 2023-02-03 19:21:48 +00:00
Max Reznitskii bcb0b19dc4 Replaced Vertex AI Training linkbacks with Custom training 2023-02-02 23:04:08 +00:00
ivanmkc@google.com bcd86a3707 Fixed typo for index display name 2023-01-25 08:56:59 +09:00
ivanmkc@google.com 4e5c75fed6 Renamed json to jsonl 2023-01-24 21:08:08 +09:00
Ivan Cheung b28f941abe Fixed typo 2023-01-24 21:02:46 +09:00
wintwooandGitHub f681879a8a Merge branch 'GoogleCloudPlatform:main' into dataproc 2022-12-28 11:23:34 +11:00
Win Woo 62c903f47d Addressed PR feedback 2022-12-08 03:01:56 +00:00
Win Woo 9f26e8385d Show how to use experiments 2022-11-18 10:02:02 +00:00
52 changed files with 6570 additions and 132 deletions
+1
View File
@@ -11,3 +11,4 @@ google-cloud-storage
google-cloud-build
ratemate
GitPython
tqdm
File diff suppressed because one or more lines are too long
@@ -33,6 +33,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "JAPoU8Sm5E6e"
@@ -41,18 +42,18 @@
"<table align=\"left\">\n",
"\n",
" <td>\n",
" <a href=\"https://colab.research.google.com/github/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/vertex_endpoints/torchserve/dreambooth_stable_diffusion.ipynb\">\n",
" <a href=\"https://colab.research.google.com/github/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/vertex_endpoints/torchserve/dreambooth_stablediffusion.ipynb\">\n",
" <img src=\"https://cloud.google.com/ml-engine/images/colab-logo-32px.png\" alt=\"Colab logo\"> Run in Colab\n",
" </a>\n",
" </td>\n",
" <td>\n",
" <a href=\"https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/vertex_endpoints/torchserve/dreambooth_stable_diffusion.ipynb\">\n",
" <a href=\"https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/vertex_endpoints/torchserve/dreambooth_stablediffusion.ipynb\">\n",
" <img src=\"https://cloud.google.com/ml-engine/images/github-logo-32px.png\" alt=\"GitHub logo\">\n",
" View on GitHub\n",
" </a>\n",
" </td>\n",
" <td>\n",
" <a href=\"https://console.cloud.google.com/vertex-ai/workbench/deploy-notebook?download_url=https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/vertex_endpoints/torchserve/dreambooth_stable_diffusion.ipynb\">\n",
" <a href=\"https://console.cloud.google.com/vertex-ai/workbench/deploy-notebook?download_url=https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/vertex_endpoints/torchserve/dreambooth_stablediffusion.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",
" </a>\n",
+3 -1
View File
@@ -74,7 +74,9 @@
"source": [
"## Overview\n",
"\n",
"{TODO: Include a paragraph or two explaining what this example demonstrates, who should be interested in it, and what you need to know before you get started.}"
"{TODO: Include a paragraph or two explaining what this example demonstrates, who should be interested in it, and what you need to know before you get started.}\n",
"\n",
"Learn more about [web-doc-title](linkback-to-webdoc-page). {TODO: if more than one primary feature, add tag/linkback for each one}"
]
},
{
+9 -21
View File
@@ -1144,36 +1144,20 @@ def add_index(path: str,
if args.desc:
desc = replace_cl(desc.replace('`', ''))
print('<br/>')
print(f' {desc}<br/>\n')
print(f' {desc}\n')
if args.steps:
print("<devsite-expandable>\n")
print(' <h6 class="showalways">Notebook steps</h6>\n')
print(' <ul style="font-size: .75em">\n')
if ":" in steps:
steps = steps.split(':')[1].replace('*', '').replace('-', '').strip().split('\n')
else:
steps = []
for step in steps:
print(f' <li>{replace_cl(step)}</li>\n')
#steps = replace_cl(steps.replace('\n', '<br/>').replace('-', '&nbsp;&nbsp;-').replace('**', '').replace('*', '&nbsp;&nbsp;-').replace('`', ''))
#print('<br/>' + steps + '<br/>')
print(' </ul>\n')
print("</devsite-expandable>\n")
if args.linkback and linkbacks:
num = len(tags)
for _ in range(num):
if linkbacks[_].startswith("vertex-ai"):
print(f' Learn more about <a href="https://cloud.google.com/{linkbacks[_]}." target="_blank">{replace_cl(tags[_])}</a>.\n')
print(f' Learn more about <a href="https://cloud.google.com/{linkbacks[_]}" target="_blank">{replace_cl(tags[_])}</a>.\n')
else:
print(f' Learn more about <a href="{linkbacks[_]}." target="_blank">{replace_cl(tags[_])}</a>.\n')
print(f' Learn more about <a href="{linkbacks[_]}" target="_blank">{replace_cl(tags[_])}</a>.\n')
if args.steps:
print("<devsite-expandable>\n")
print(' <h6 class="showalways">Notebook steps</h6>\n')
print(' <p class="showalways">Tutorial steps</p>\n')
print(' <ul>\n')
if ":" in steps:
@@ -1256,6 +1240,8 @@ def replace_cl(text : str ) -> str:
'Vertex AI Prediction': '{{vertex_prediction_name}}',
'Vertex TensorBoard': '{{vertex_tensorboard_name}}',
'Vertex AI TensorBoard': '{{vertex_tensorboard_name}}',
'TensorBoard': '{{vertex_tensorboard_name}}',
'Tensorboard': '{{vertex_tensorboard_name}}',
'Vertex ML Metadata': '{{vertex_metadata_name}}',
'Vertex Pipelines': '{{vertex_pipelines_name}}',
'Vertex AI Pipelines': '{{vertex_pipelines_name}}',
@@ -1281,6 +1267,8 @@ def replace_cl(text : str ) -> str:
'Vertex AI': '{{vertex_ai_name}}',
'Cloud Storage': '{{storage_name}}',
'GCS': '{{storage_name}}',
'GCP': '{{gcp_name}}',
'TensorFlow Enterprise': '{{tf4gcp_name}}',
'TensorFlow': '{{tensorflow_name}}',
}
@@ -1336,7 +1324,7 @@ if args.web:
print(' <th width="80px">Open in</th>')
print(' </tr>')
print(' </thead>')
print(' <tbody>')
print(' <tbody class="list">')
if args.notebook_dir:
if not os.path.isdir(args.notebook_dir):
@@ -23,7 +23,62 @@
- Incorrect examples: "Let's update the field", "We'll update the field", "The user should update the field"
- **Googlers**: Please follow our [branding guidelines](http://goto/cloud-branding).
### Code
## Authoring guidelines
### Focus
Notebooks for official are expected to be narrow focused, which highlight a subset of features of a Vertex AI product/service.
The product/feature is to be highlighted in the Overview section. For example:
```
This tutorial demonstrates using Vertex AI Training to train an XGBoost model using a XGBoost pre-built training container.
```
In the above example, the Vertex AI product/service is `Vertex AI Training` and the feature is `XGBoost pre-built training container`.
### Scope
Notebooks for official are expected to be narrow in scope, without extra extraneous steps. For example, if the notebook is about training, we discourage ending the notebook with deploying the model and doing an online/batch prediction. On the later, we recommend a separate notebook about prediction that uses a pretrained model.
#### Training
Notebooks for training should be constructed as follows:
1. If the training script(s) are small, embed them in the notebook and use %writefile to store them locally.
2. If the training script(s) are large, store them in our public bucket: gs://cloud-samples-data/vertex-ai/dataset-management/script, and use !wgets to retrieve and store the script locally.
3. Train the model using the Vertex AI SDK methods for custom training.
4. Preferrable have the service upload the trained model to the Vertex AI Model Registry.
4. Have the script do an evaluation.
5. Retrieve the evaluation metrics and attach them as an artifact to the corresponding entry in the Model Registry.
6. Optionally, download the model artifacts and test locally -- i.e., make a local prediction request.
#### Evaluation
Notebooks for evaluation should be constructed as follows:
1. Use a pretrained model from a public repository.
2. Upload the pretrained model to the Vertex AI Model Registry.
3. Perform a model evaluation.
4. Review the model evaluation.
4. Attach the model evaluation to the corresponding entry in the Model Registry.
#### Prediction
Notebooks for prediction should be constructed as follows:
1. Use a pretrained model from a public repository.
2. If relevant, attach a serving function to the model artifacts.
3. Upload the pretrained model to the Vertex AI Model Registry.
4. For online:<br/>
A. Deploy the model.<br/>
B. Perform an online prediction.</br>
C. Review the result.
5. For batch:<br/>
A. Perform a batch prediction.</br/>
B. Review the result.
## Code
- Put all your installs and imports in a setup section.
- Save the notebook with the Table of Contents open.
@@ -31,7 +86,7 @@
- Follow the [Google Python Style guide](https://github.com/google/styleguide/blob/gh-pages/pyguide.md) and write readable code.
- Keep cells small (max ~20 lines).
## TensorFlow code style
### TensorFlow code style
Use the highest level API that gets the job done (unless the goal is to demonstrate the low level API). For example, when using Tensorflow:
@@ -64,7 +64,7 @@
"\n",
"This tutorial demonstrates how to use AutoML in production. This tutorial covers get started with AutoML training.\n",
"\n",
"Learn more about [Vertex AI for AutoML](https://cloud.google.com/vertex-ai/docs/start/automl-users)."
"Learn more about [AutoML training](https://cloud.google.com/vertex-ai/docs/training-overview)."
]
},
{
@@ -872,6 +872,18 @@
"The execution of the training pipeline will take upto > 30 minutes."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "3eaba926cdfa"
},
"outputs": [],
"source": [
"if os.getenv(\"IS_TESTING\"):\n",
" sys.exit(0)"
]
},
{
"cell_type": "code",
"execution_count": null,
@@ -60,7 +60,7 @@
"\n",
"This tutorial walks you through building a custom container to serve a scikit-learn model on Vertex AI. You use the FastAPI Python web server framework to create a prediction and health endpoint. You also incorporate a pre-processor from training pipeline into your online serving application.\n",
"\n",
"Learn more about [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training) and [Vertex AI Prediction](https://cloud.google.com/vertex-ai/docs/predictions/get-predictions)."
"Learn more about [Custom training](https://cloud.google.com/vertex-ai/docs/training/custom-training) and [Vertex AI Prediction](https://cloud.google.com/vertex-ai/docs/predictions/get-predictions)."
]
},
{
@@ -64,7 +64,7 @@
"\n",
"Learn more about serving an FBProphet model from this [article on testdriven.io: Deploying and Hosting a Machine Learning Model with FastAPI and Heroku](https://testdriven.io/blog/fastapi-machine-learning/).\n",
"\n",
"Learn more about [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training) and [Vertex AI Prediction](https://cloud.google.com/vertex-ai/docs/predictions/get-predictions).\n"
"Learn more about [Custom training](https://cloud.google.com/vertex-ai/docs/training/custom-training) and [Vertex AI Prediction](https://cloud.google.com/vertex-ai/docs/predictions/get-predictions).\n"
]
},
{
@@ -147,8 +147,7 @@
"# Install the packages\n",
"! pip3 install --upgrade google-cloud-aiplatform \\\n",
" google-cloud-storage \\\n",
" google-cloud-bigquery \\\n",
" pyarrow"
" 'google-cloud-bigquery[pandas]'"
]
},
{
@@ -632,12 +631,12 @@
" df_train_x, df_train_y = df_train, df_train.pop(LABEL_COLUMN)\n",
" df_validation_x, df_validation_y = df_validation, df_validation.pop(LABEL_COLUMN)\n",
"\n",
" y_train = np.asarray(df_train_y).astype(\"float32\")\n",
" y_validation = np.asarray(df_validation_y).astype(\"float32\")\n",
" y_train = tf.convert_to_tensor(np.asarray(df_train_y).astype(\"float32\"))\n",
" y_validation = tf.convert_to_tensor(np.asarray(df_validation_y).astype(\"float32\"))\n",
"\n",
" # Convert to numpy representation\n",
" x_train = np.asarray(df_train_x) \n",
" x_test = np.asarray(df_validation_x)\n",
" x_train = tf.convert_to_tensor(np.asarray(df_train_x).astype(\"float32\"))\n",
" x_test = tf.convert_to_tensor(np.asarray(df_validation_x).astype(\"float32\"))\n",
"\n",
" # Convert to one-hot representation\n",
" num_species = len(df_train_y.unique())\n",
@@ -735,7 +734,7 @@
" display_name=JOB_NAME,\n",
" script_path=\"task.py\",\n",
" container_uri=\"us-docker.pkg.dev/vertex-ai/training/tf-cpu.2-8:latest\",\n",
" requirements=[\"google-cloud-bigquery>=2.20.0\", \"db-dtypes\"],\n",
" requirements=[\"google-cloud-bigquery[pandas]\", \"protobuf<3.20.0\"],\n",
" model_serving_container_image_uri=\"us-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-8:latest\",\n",
")\n",
"\n",
@@ -64,7 +64,7 @@
"\n",
"This tutorial demonstrates how to use the Vertex AI SDK for Python to train and deploy a custom image classification model for batch prediction.\n",
"\n",
"Learn more about [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training) and [Vertex AI Batch Prediction](https://cloud.google.com/vertex-ai/docs/tabular-data/classification-regression/get-batch-predictions)."
"Learn more about [Custom training](https://cloud.google.com/vertex-ai/docs/training/custom-training) and [Vertex AI Batch Prediction](https://cloud.google.com/vertex-ai/docs/tabular-data/classification-regression/get-batch-predictions)."
]
},
{
@@ -64,7 +64,7 @@
"\n",
"This tutorial demonstrates how to use the Vertex AI SDK for Python to train and deploy a custom image classification model for online prediction.\n",
"\n",
"Learn more about [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training) and [Vertex AI Prediction](https://cloud.google.com/vertex-ai/docs/predictions/get-predictions)."
"Learn more about [Custom training](https://cloud.google.com/vertex-ai/docs/training/custom-training) and [Vertex AI Prediction](https://cloud.google.com/vertex-ai/docs/predictions/get-predictions)."
]
},
{
@@ -73,7 +73,7 @@
"\n",
"This tutorial demonstrates how to use Vertex AI in production. This tutorial covers get started with Vertex AI Experiments.\n",
"\n",
"Learn more about [Vertex AI Experiments](https://cloud.google.com/vertex-ai/docs/experiments/intro-vertex-ai-experiments), [Vertex ML Metadata](https://cloud.google.com/vertex-ai/docs/ml-metadata) and [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
"Learn more about [Vertex AI Experiments](https://cloud.google.com/vertex-ai/docs/experiments/intro-vertex-ai-experiments), [Vertex ML Metadata](https://cloud.google.com/vertex-ai/docs/ml-metadata) and [Custom training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
]
},
{
@@ -64,7 +64,7 @@
"\n",
"This tutorial demonstrates how to use the Vertex AI SDK to create tabular classification models and do online prediction with explanation using a Google Cloud [AutoML](https://cloud.google.com/vertex-ai/docs/start/automl-users) model.\n",
"\n",
"Learn more about [AutoML Tabular](https://cloud.google.com/vertex-ai/docs/tabular-data/overview) and [Vertex Explainable AI](https://cloud.google.com/vertex-ai/docs/explainable-ai/overview)."
"Learn more about [Classification for tabular data](https://cloud.google.com/vertex-ai/docs/tabular-data/classification-regression/overview) and [Vertex Explainable AI](https://cloud.google.com/vertex-ai/docs/explainable-ai/overview)."
]
},
{
@@ -292,8 +292,7 @@
},
"outputs": [],
"source": [
"# VPC_NETWORK = \"[your-vpc-network-name]\" # @param {type:\"string\"}\n",
"VPC_NETWORK = \"matching-engine-test\" # @param {type:\"string\"}\n",
"VPC_NETWORK = \"[your-vpc-network-name]\" # @param {type:\"string\"}\n",
"\n",
"PEERING_RANGE_NAME = \"ann-haystack-range\""
]
@@ -544,7 +543,7 @@
" json.dumps(\n",
" {\n",
" \"id\": str(index),\n",
" \"embedding\": [str(value) for value in train[index]],\n",
" \"embedding\": [str(value) for value in embedding],\n",
" \"restricts\": [\n",
" {\n",
" \"namespace\": \"class\",\n",
@@ -646,7 +645,7 @@
"outputs": [],
"source": [
"tree_ah_index = aiplatform.MatchingEngineIndex.create_tree_ah_index(\n",
" display_name=DISPLAY_NAME_BRUTE_FORCE,\n",
" display_name=DISPLAY_NAME,\n",
" contents_delta_uri=EMBEDDINGS_INITIAL_URI,\n",
" dimensions=DIMENSIONS,\n",
" approximate_neighbors_count=150,\n",
@@ -712,7 +711,7 @@
"outputs": [],
"source": [
"brute_force_index = aiplatform.MatchingEngineIndex.create_brute_force_index(\n",
" display_name=DISPLAY_NAME,\n",
" display_name=DISPLAY_NAME_BRUTE_FORCE,\n",
" contents_delta_uri=EMBEDDINGS_INITIAL_URI,\n",
" dimensions=DIMENSIONS,\n",
" distance_measure_type=\"DOT_PRODUCT_DISTANCE\",\n",
@@ -64,7 +64,7 @@
"\n",
"This tutorial demonstrates how to use the Vertex AI SDK for Python to train and deploy an AutoML image classification model.\n",
"\n",
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [AutoML Image](https://cloud.google.com/vertex-ai/docs/tutorials/image-recognition-automl/training)."
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [Classification for image data](https://cloud.google.com/vertex-ai/docs/training-overview#classification_for_images)."
]
},
{
@@ -64,7 +64,7 @@
"\n",
"This tutorial demonstrates how to use the Vertex AI SDK for Python to train and deploy a custom tabular classification scikit-learn model for batch prediction.\n",
"\n",
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [Custom training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
]
},
{
@@ -65,7 +65,7 @@
"\n",
"This tutorial demonstrates how to use the Vertex AI SDK for Python to hyperparamer tune a custom tabular classification TemsorFlow model.\n",
"\n",
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/training/hyperparameter-tuning-overview) and [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/training/hyperparameter-tuning-overview) and [Custom training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
]
},
{
@@ -29,7 +29,7 @@
"id": "title:migration,new"
},
"source": [
"# Vertex AI: Vertex AI Migration: AutoML Video Classificaton\n",
"# Vertex AI: Vertex AI Migration: AutoML Video Classification\n",
"\n",
"<table align=\"left\">\n",
"\n",
@@ -64,7 +64,7 @@
"\n",
"This tutorial demonstrates how to use the Vertex AI SDK for Python to train a AutoML video classification model and do a batch prediction.\n",
"\n",
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [AutoML Video](https://cloud.google.com/vertex-ai/docs/tutorials/video-classification-automl/training)."
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [Classification for video data](https://cloud.google.com/vertex-ai/docs/training-overview#classification_for_videos)."
]
},
{
@@ -568,7 +568,7 @@
},
"outputs": [],
"source": [
"IMPORT_FILE = \"gs://automl-video-demo-data/hmdb_split1_5classes_train_inf.csv\""
"IMPORT_FILE = \"gs://automl-video-demo-data/hmdb_split1_train_40_mp4_gs.csv\""
]
},
{
@@ -604,6 +604,19 @@
"! gsutil cat $FILE | head"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "f483d8d80f64"
},
"outputs": [],
"source": [
"import datetime\n",
"\n",
"start = datetime.datetime.now()"
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -757,7 +770,19 @@
"\n",
"The `run` method when completed returns the `Model` resource.\n",
"\n",
"The execution of the training pipeline will take upto 20 minutes."
"The execution of the training pipeline may take over 24 hrs."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "8f135100f5d9"
},
"outputs": [],
"source": [
"if os.getenv(\"IS_TESTING\"):\n",
" sys.exit(0)"
]
},
{
@@ -806,6 +831,18 @@
" INFO:google.cloud.aiplatform.training_jobs:Model available at projects/759209241365/locations/us-central1/models/1899701006099283968"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "48ca7f0980e0"
},
"outputs": [],
"source": [
"end = datetime.datetime.now()\n",
"end - start"
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -64,7 +64,7 @@
"\n",
"This tutorial demonstrates how to use the Vertex AI SDK for Python to train a AutoML video object tracking model and do a batch prediction.\n",
"\n",
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [AutoML Video](https://cloud.google.com/video-intelligence/automl/object-tracking/docs/index-object-tracking)."
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [Object tracking for video data](https://cloud.google.com/vertex-ai/docs/training-overview#object_tracking_for_videos)."
]
},
{
@@ -64,7 +64,7 @@
"\n",
"This tutorial demonstrates how to use the Vertex AI SDK for Python to train using a pre-built container and deploy a custom image classification model for online and batch prediction.\n",
"\n",
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [Custom training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
]
},
{
@@ -63,7 +63,7 @@
"\n",
"This notebook demonstrates training a custom image classification model using Tensorflow and Vertex AI SDK by creating a custom training container. Additionally, the notebooks also deploys the trained model to Vertex AI and predictions are generated from it.\n",
"\n",
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [Custom training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
]
},
{
@@ -65,7 +65,7 @@
"\n",
"This tutorial demonstrates how to use the Vertex AI SDK for Python to train and deploy an AutoML object detection model.\n",
"\n",
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [AutoML Image](https://cloud.google.com/vertex-ai/docs/tutorials/image-recognition-automl/training)."
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [Object detection for image data](https://cloud.google.com/vertex-ai/docs/training-overview#object_detection_for_images)."
]
},
{
@@ -61,11 +61,11 @@
"source": [
"## Overview\n",
"\n",
"This notebook demonstrates how to create an AutoML Video Classification Model, with a Vertex AI video dataset, and how to serve the model for batch prediction. It requires you provide a bucket where the dataset will be stored.\n",
"This notebook demonstrates how to create an AutoML Text Classification Model, with a Vertex AI text dataset, and how to serve the model for batch prediction. It requires you provide a bucket where the dataset will be stored.\n",
"\n",
"Note: you may incur charges for training, prediction, storage or usage of other GCP products in connection with testing this SDK.\n",
"\n",
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [AutoML Text](https://cloud.google.com/vertex-ai/docs/text-data/classification/prepare-data)."
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [Classification for text data](https://cloud.google.com/vertex-ai/docs/training-overview#classification_for_text)."
]
},
{
@@ -76,7 +76,7 @@
"source": [
"### Objective\n",
"\n",
"The objective of this notebook is to build a AutoML Video Classification Model. The following steps have been followed:\n",
"The objective of this notebook is to build a AutoML Text Classification Model. The following steps have been followed:\n",
"This tutorial uses the following Google Cloud ML services :\n",
"\n",
"* Vertex AI Dataset resource\n",
@@ -87,11 +87,11 @@
"The steps performed include the following:\n",
"\n",
"* Set your task name, and GCS prefix\n",
"* Copy AutoML video demo train data for creating managed dataset\n",
"* Copy AutoML text demo train data for creating managed dataset\n",
"* Create a dataset on Vertex AI.\n",
"* Configure a training job\n",
"* Launch a training job and create a model on Vertex AI\n",
"* Copy AutoML Video Demo Prediction Data for creating batch prediction job\n",
"* Copy AutoML Text Demo Prediction Data for creating batch prediction job\n",
"* Perform batch prediction job on the model"
]
},
@@ -65,7 +65,7 @@
"\n",
"Note: you may incur charges for training, prediction, storage or usage of other Google Cloud products in connection with testing this SDK.\n",
"\n",
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [AutoML Text](https://cloud.google.com/vertex-ai/docs/text-data/entity-extraction/prepare-data)."
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [Entity extraction for text data](https://cloud.google.com/vertex-ai/docs/training-overview#entity_extraction_for_text).\n"
]
},
{
@@ -76,7 +76,7 @@
"source": [
"### Objective\n",
"\n",
"The objective of this notebook is to build a AutoML Text Entity Extraction Model. The following steps have been followed:\n",
"The objective of this notebook is to build a AutoML Text Entity Extraction model. The following steps have been followed:\n",
"This tutorial uses the following Google Cloud ML services :\n",
"\n",
"* Vertex AI Dataset resource\n",
@@ -66,7 +66,7 @@
"\n",
"Note: you may incur charges for training, prediction, storage or usage of other Google Cloud products in connection with testing this SDK.\n",
"\n",
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [AutoML Text](https://cloud.google.com/vertex-ai/docs/text-data/sentiment-analysis/prepare-data)."
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [Sentiment analysis for text data](https://cloud.google.com/vertex-ai/docs/training-overview#sentiment_analysis_for_text)."
]
},
{
@@ -64,7 +64,7 @@
"\n",
"This tutorial demonstrates how to use the Vertex AI SDK for Python to train and deploy a custom tabular classification XGBoost model for batch prediction.\n",
"\n",
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [Custom training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
]
},
{
@@ -63,7 +63,7 @@
"\n",
"This notebook demonstrates how to track metrics and parameters for Vertex AI custom training jobs, and how to perform detailed analysis using this data.\n",
"\n",
"Learn more about [Vertex ML Metadata](https://cloud.google.com/vertex-ai/docs/ml-metadata) and [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
"Learn more about [Vertex ML Metadata](https://cloud.google.com/vertex-ai/docs/ml-metadata) and [Custom training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
]
},
{
@@ -140,7 +140,7 @@
"outputs": [],
"source": [
"! pip install --upgrade -q google-cloud-aiplatform \\\n",
" tensorflow==2.8 -q"
" tensorflow -q"
]
},
{
@@ -92,7 +92,7 @@
"- Run the `AutoMLTabularTrainingJob` which returns a model\n",
"- Import a pre-trained `AutoML model resource` into the pipeline\n",
"- Run a `batch prediction` job in the pipeline\n",
"- Evaulate the AutoML model using the `regression evaluation component`\n",
"- Evaluate the AutoML model using the `regression evaluation component`\n",
"- Import the Regression Metrics to the AutoML model resource"
]
},
@@ -63,7 +63,7 @@
"\n",
"This notebook demonstrates how to use the Vertex AI classification model evaluation component to evaluate an AutoML video classification model. Model evaluation helps you determine your model performance based on the evaluation metrics and improve the model if necessary. \n",
"\n",
"Learn more about [Vertex AI Model Evaluation](https://cloud.google.com/vertex-ai/docs/evaluation/introduction) and [AutoML Video](https://cloud.google.com/vertex-ai/docs/video-data/classification/prepare-data)."
"Learn more about [Vertex AI Model Evaluation](https://cloud.google.com/vertex-ai/docs/evaluation/introduction) and [Classification for video data](https://cloud.google.com/vertex-ai/docs/training-overview#classification_for_videos)."
]
},
{
@@ -92,7 +92,7 @@
"- Train a Automl Video Classification model on the `Vertex AI Dataset` resource.\n",
"- Import the trained `AutoML Vertex AI Model resource` into the pipeline.\n",
"- Run a batch prediction job inside the pipeline.\n",
"- Evaulate the AutoML model using the classification evaluation component.\n",
"- Evaluate the AutoML model using the classification evaluation component.\n",
"- Import the classification metrics to the AutoML Vertex AI Model resource."
]
},
@@ -792,7 +792,19 @@
"\n",
"The `run` method when completed returns the `Model` resource.\n",
"\n",
"The execution of the training pipeline can take over 3 hours to complete."
"The execution of the training pipeline can take over 24 hours to complete."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "3eaba926cdfa"
},
"outputs": [],
"source": [
"if os.getenv(\"IS_TESTING\"):\n",
" sys.exit(0)"
]
},
{
@@ -63,7 +63,7 @@
"\n",
"This notebook demonstrates how to use the Vertex AI regression model evaluation component to evaluate a custom regression model. Model evaluation helps you determine your model performance based on the evaluation metrics and improve the model if necessary. \n",
"\n",
"Learn more about [Vertex AI Model Evaluation](https://cloud.google.com/vertex-ai/docs/evaluation/introduction) and [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
"Learn more about [Vertex AI Model Evaluation](https://cloud.google.com/vertex-ai/docs/evaluation/introduction) and [Custom training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
]
},
{
@@ -93,7 +93,7 @@
"- Upload the model as a Vertex AI Model resource.\n",
"- Import a pre-trained `Vertex AI model resource` into the pipeline.\n",
"- Run a `batch prediction` job in the pipeline.\n",
"- Evaulate the model using the `regression evaluation component`.\n",
"- Evaluate the model using the `regression evaluation component`.\n",
"- Import the Regression Metrics to the Vertex AI model resource."
]
},
@@ -0,0 +1,865 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "ur8xi4C7S06n"
},
"outputs": [],
"source": [
"# Copyright 2023 Google LLC\n",
"#\n",
"# Licensed under the Apache License, Version 2.0 (the \"License\");\n",
"# you may not use this file except in compliance with the License.\n",
"# You may obtain a copy of the License at\n",
"#\n",
"# https://www.apache.org/licenses/LICENSE-2.0\n",
"#\n",
"# Unless required by applicable law or agreed to in writing, software\n",
"# distributed under the License is distributed on an \"AS IS\" BASIS,\n",
"# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
"# See the License for the specific language governing permissions and\n",
"# limitations under the License."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "JAPoU8Sm5E6e"
},
"source": [
"# Get started with importing a custom model evaluation to the Vertex AI Model Registry\n",
"\n",
"<table align=\"left\">\n",
"\n",
" <td>\n",
" <a href=\"https://colab.research.google.com/github/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/model_evaluation/get_started_with_custom_model_evaluation_import.ipynb\">\n",
" <img src=\"https://cloud.google.com/ml-engine/images/colab-logo-32px.png\" alt=\"Colab logo\"> Run in Colab\n",
" </a>\n",
" </td>\n",
" <td>\n",
" <a href=\"https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/model_evaluation/get_started_with_custom_model_evaluation_import.ipynb\">\n",
" <img src=\"https://cloud.google.com/ml-engine/images/github-logo-32px.png\" alt=\"GitHub logo\">\n",
" View on GitHub\n",
" </a>\n",
" </td>\n",
" <td>\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/model_evaluation/get_started_with_custom_model_evaluation_import.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",
" </a>\n",
" </td> \n",
"</table>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "24743cf4a1e1"
},
"source": [
"**_NOTE_**: This notebook has been tested in the following environment:\n",
"\n",
"* Python version = 3.9"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "tvgnzT1CKxrO"
},
"source": [
"## Overview\n",
"\n",
"This tutorial shows how to use Vertex AI Model Evaluation to import a custom model evaluation to an existing Vertex AI Model Registry entry."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "d975e698c9a4"
},
"source": [
"### Objective\n",
"\n",
"In this tutorial, you learn how to construct and upload a custom model evaluation, and upload the custom model evaluation to a Model resource entry in Vertex AI Model Registry.\n",
"\n",
"This tutorial uses the following Google Cloud ML services and resources:\n",
"\n",
"- Vertex AI Model Evaluation\n",
"- Vertex AI Model Registry\n",
"\n",
"The steps performed include:\n",
"\n",
"- Import a pretrained (blessed) model to the Vertex AI Model Registry.\n",
"- Construct a custom model evaluation.\n",
"- Import the model evaluation metrics to the corresponding model in the Vertex AI Model Registry.\n",
"- List the model evaluation for the corresponding model in the Vertex AI Model Registry.\n",
"- Construct a second custom model evaluation.\n",
"- Import the second model evaluation metrics to the corresponding model in the Vertex AI Model Registry.\n",
"- List the second model evaluation for the corresponding model in the Vertex AI Model Registry.\n",
"\n",
"Learn more about [Model Evaluation in Vertex AI](https://cloud.google.com/vertex-ai/docs/evaluation/introduction)."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "08d289fa873f"
},
"source": [
"### Model\n",
"\n",
"This tutorial uses a pre-trained image classification model from TensorFlow Hub, which is trained on ImageNet dataset.\n",
"\n",
"Learn more about [ResNet V2 pretained model](https://tfhub.dev/google/imagenet/resnet_v2_101/classification/5). "
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "aed92deeb4a0"
},
"source": [
"### Costs \n",
"\n",
"This tutorial uses billable components of Google Cloud:\n",
"\n",
"* Vertex AI\n",
"* Cloud Storage\n",
"\n",
"Learn about [Vertex AI pricing](https://cloud.google.com/vertex-ai/pricing),\n",
"and [Cloud Storage pricing](https://cloud.google.com/storage/pricing), \n",
"and use the [Pricing Calculator](https://cloud.google.com/products/calculator/)\n",
"to generate a cost estimate based on your projected usage."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "i7EUnXsZhAGF"
},
"source": [
"## Installation\n",
"\n",
"Install the following packages required to execute this notebook. "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "2b4ef9b72d43"
},
"outputs": [],
"source": [
"# Install the packages\n",
"USER=''\n",
"! pip3 install {USER} --upgrade google-cloud-aiplatform \\\n",
" tensorflow==2.5 \\\n",
" tensorflow-hub"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "58707a750154"
},
"source": [
"### Colab only: Uncomment the following cell to restart the kernel."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "f200f10a1da3"
},
"outputs": [],
"source": [
"# Automatically restart kernel after installs so that your environment can access the new packages\n",
"# import IPython\n",
"\n",
"# app = IPython.Application.instance()\n",
"# app.kernel.do_shutdown(True)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "BF1j6f9HApxa"
},
"source": [
"## Before you begin\n",
"\n",
"### Set up your Google Cloud project\n",
"\n",
"**The following steps are required, regardless of your notebook environment.**\n",
"\n",
"1. [Select or create a Google Cloud project](https://console.cloud.google.com/cloud-resource-manager). When you first create an account, you get a $300 free credit towards your compute/storage costs.\n",
"\n",
"2. [Make sure that billing is enabled for your project](https://cloud.google.com/billing/docs/how-to/modify-project).\n",
"\n",
"3. [Enable the Vertex AI API]\n",
"\n",
"4. If you are running this notebook locally, you need to install the [Cloud SDK](https://cloud.google.com/sdk)."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "WReHDGG5g0XY"
},
"source": [
"#### Set your project ID\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)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "oM1iC_MfAts1"
},
"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": "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": "sBCra4QMA2wR"
},
"source": [
"### Authenticate your Google Cloud account\n",
"\n",
"Depending on your Jupyter environment, you may have to manually authenticate. Follow the relevant instructions below."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "74ccc9e52986"
},
"source": [
"**1. Vertex AI Workbench**\n",
"* Do nothing as you are already authenticated."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "de775a3773ba"
},
"source": [
"**2. Local JupyterLab instance, uncomment and run:**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "254614fa0c46"
},
"outputs": [],
"source": [
"# ! gcloud auth login"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "ef21552ccea8"
},
"source": [
"**3. Colab, uncomment and run:**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "603adbbf0532"
},
"outputs": [],
"source": [
"# from google.colab import auth\n",
"# auth.authenticate_user()"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "f6b2ccc891ed"
},
"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."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "zgPO1eR3CYjk"
},
"source": [
"### Create a Cloud Storage bucket\n",
"\n",
"Create a storage bucket to store intermediate artifacts such as datasets.\n",
"\n",
"- *{Note to notebook author: For any user-provided strings that need to be unique (like bucket names or model ID's), append \"-unique\" to the end so proper testing can occur}*"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "MzGDU7TWdts_"
},
"outputs": [],
"source": [
"BUCKET_URI = f\"gs://your-bucket-name-unique-{PROJECT_ID}\" # @param {type:\"string\"}"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "-EcIXiGsCePi"
},
"source": [
"**Only if your bucket doesn't already exist**: Run the following cell to create your Cloud Storage bucket."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "NIq7R4HZCfIc"
},
"outputs": [],
"source": [
"! gsutil mb -l $REGION -p $PROJECT_ID $BUCKET_URI"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "960505627ddf"
},
"source": [
"### Import libraries"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "PyQmSRbKA8r-"
},
"outputs": [],
"source": [
"import tensorflow as tf\n",
"import tensorflow_hub as hub\n",
"from google.cloud import aiplatform\n",
"from google.cloud.aiplatform import gapic"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "init_aip:mbsdk,all"
},
"source": [
"### Initialize Vertex AI SDK for Python\n",
"\n",
"Initialize the Vertex AI SDK for Python for your project."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "init_aip:mbsdk,all"
},
"outputs": [],
"source": [
"aiplatform.init(project=PROJECT_ID, location=REGION, staging_bucket=BUCKET_URI)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "accelerators:training,cpu,prediction,cpu,mbsdk"
},
"source": [
"#### Set hardware accelerators\n",
"\n",
"You can set hardware accelerators for prediction.\n",
"\n",
"Set the variables `DEPLOY_GPU/DEPLOY_NGPU` to use a container image supporting a GPU and the number of GPUs allocated to the virtual machine (VM) instance. For example, to use a GPU container image with 4 Nvidia Telsa K80 GPUs allocated to each VM, you would specify:\n",
"\n",
" (aip.gapic.AcceleratorType.NVIDIA_TESLA_K80, 4)\n",
"\n",
"\n",
"Otherwise specify `(None, None)` to use a container image to run on a CPU.\n",
"\n",
"Learn more about [hardware accelerator support for your region](https://cloud.google.com/vertex-ai/docs/general/locations#accelerators), and [GPU pricing](https://cloud.google.com/compute/gpus-pricing)."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "accelerators:training,cpu,prediction,cpu,mbsdk"
},
"outputs": [],
"source": [
"DEPLOY_GPU, DEPLOY_NGPU = (None, None)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "container:training,prediction"
},
"source": [
"#### Set pre-built containers\n",
"\n",
"Set the pre-built Docker container image for prediction.\n",
"\n",
"For the latest list, see [Pre-built containers for prediction](https://cloud.google.com/ai-platform-unified/docs/predictions/pre-built-containers)."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "container:training,prediction"
},
"outputs": [],
"source": [
"TF = \"2.5\".replace(\".\", \"-\")\n",
"\n",
"if DEPLOY_GPU:\n",
" DEPLOY_VERSION = \"tf2-gpu.{}\".format(TF)\n",
"else:\n",
" DEPLOY_VERSION = \"tf2-cpu.{}\".format(TF)\n",
"\n",
"DEPLOY_IMAGE = \"{}-docker.pkg.dev/vertex-ai/prediction/{}:latest\".format(\n",
" REGION.split(\"-\")[0], DEPLOY_VERSION\n",
")\n",
"\n",
"print(\"Deployment:\", DEPLOY_IMAGE, DEPLOY_GPU, DEPLOY_NGPU)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "d8128b8ff025"
},
"source": [
"## Get pretrained model from TensorFlow Hub\n",
"\n",
"For demonstration purposes, this tutorial uses a pretrained model from TensorFlow Hub (TFHub), which is then uploaded to a `Vertex AI Model` resource. Once you have a `Vertex AI Model` resource, the model can be deployed to a `Vertex AI Endpoint` resource.\n",
"\n",
"### Download the pretrained model\n",
"\n",
"First, you download the pretrained model from TensorFlow Hub. The model gets downloaded as a TF.Keras layer. To finalize the model, in this example, you create a `Sequential()` model with the downloaded TFHub model as a layer, and specify the input shape to the model."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "c55fa4c826f7"
},
"outputs": [],
"source": [
"tfhub_model = tf.keras.Sequential(\n",
" [hub.KerasLayer(\"https://tfhub.dev/google/imagenet/resnet_v2_101/classification/5\")]\n",
")\n",
"\n",
"tfhub_model.build([None, 32, 32, 3])\n",
"\n",
"tfhub_model.summary()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "64618c713db9"
},
"outputs": [],
"source": [
"MODEL_DIR = BUCKET_URI + \"/model\"\n",
"tfhub_model.save(MODEL_DIR)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "e8ce91147c93"
},
"source": [
"### Upload the TensorFlow Hub model to a `Vertex AI Model` resource\n",
"\n",
"Finally, you upload the model artifacts from the TFHub model into a `Vertex AI Model` resource using the method `upload()`, with the following parameters:\n",
"\n",
"- `display_name`: A human readable name for the `Model` resource.\n",
"- `artifact_uri`: The Cloud Storage location of the model package.\n",
"- `serving_container_image_uri`: The serving container image.\n",
"\n",
"Uploading a model into a Vertex AI Model resource returns a long running operation, since it may take a few moments. \n",
"\n",
"*Note:* When you upload the model artifacts to a `Vertex AI Model` resource, you specify the corresponding deployment container image."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "ad61e1429512"
},
"outputs": [],
"source": [
"model = aiplatform.Model.upload(\n",
" display_name=\"resnet\",\n",
" artifact_uri=MODEL_DIR,\n",
" serving_container_image_uri=DEPLOY_IMAGE,\n",
" is_default_version=True,\n",
" version_aliases=[\"v1\"],\n",
")\n",
"\n",
"print(model)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "c11e98ef5391"
},
"source": [
"## Introduction to custom model evaluations\n",
"\n",
"When training a custom model, one generally performs some form of an evaluation of the trained model. Your custom model evaluation can then be imported to the corresponding model in the Vertex AI Model Registry using the `import_model_evaluation()` method. Once imported, the custom model evaluation can be subsequently retreived with the `list_model_evaluations()` method. \n",
"\n",
"The Vertex AI Model Registry supports importing multiple model evaluations for a model where each evaluation is distinquished by a unique `display_name`.\n",
"\n",
"\n",
"### Create a model evaluation\n",
"\n",
"First, you create a model evaluation in a format that corresponds to one of the predefined schemas for model evaluations. In this example, you use the schema for a classification metric, and specify the following subset of evaluation metrics as a dictionary:\n",
"\n",
"- `logLoss`: The log loss.\n",
"- `auPrc`: The accuracy.\n",
"\n",
"You then construct the `ModelEvaluation` object with the following parameters:\n",
"\n",
"- `display_name`: The human readable name for the evaluation metric.\n",
"- `metrics_schema_uri`: The schema for the specific type of evaluation metrics.\n",
"- `metrics`: The dictionary with the evaluation metrics.\n",
"\n",
"Learn more about [Schemas for evaluation metrics](https://cloud.google.com/vertex-ai/docs/evaluation/introduction#features)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "e9af222db292"
},
"outputs": [],
"source": [
"metrics = {\"logLoss\": 1.4, \"auPrc\": 0.85}\n",
"print(metrics)\n",
"\n",
"model_eval = gapic.ModelEvaluation(\n",
" display_name=\"eval\",\n",
" metrics_schema_uri=\"gs://google-cloud-aiplatform/schema/modelevaluation/classification_metrics_1.0.0.yaml\",\n",
" metrics=metrics,\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "68870bd8194d"
},
"source": [
"### Upload the evaluation metrics to the Model Registry\n",
"\n",
"Next, upload the model's evaluation from the custom training job to the corresponding entry in the Vertex AI Model Registry.\n",
"\n",
"Currently, there is not yet support for this method in the SDK. Instead, you use the lower level GAPIC API interface."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "3044788848af"
},
"outputs": [],
"source": [
"API_ENDPOINT = f\"{REGION}-aiplatform.googleapis.com\"\n",
"client = gapic.ModelServiceClient(client_options={\"api_endpoint\": API_ENDPOINT})\n",
"\n",
"client.import_model_evaluation(parent=model.resource_name, model_evaluation=model_eval)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "337319a19efe"
},
"source": [
"### List the custom model evaluation\n",
"\n",
"Now that your custom metric has been uploaded to the corresponding model in the Vertex AI Model Registry, you can retriv"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "1b3374e988cf"
},
"outputs": [],
"source": [
"evaluation = model.list_model_evaluations()[0]\n",
"print(evaluation.gca_resource)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "68870bd8194d"
},
"source": [
"### Upload a second evaluation metrics to the Model Registry\n",
"\n",
"Next, upload a second model evaluation to the corresponding entry in the Vertex AI Model Registry. In this example, we refer to first evaluation metric as `eval` (from training) and the second as `prod` (from production data)."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "9b864c0ba07f"
},
"outputs": [],
"source": [
"metrics = {\"logLoss\": 1.2, \"auPrc\": 0.87}\n",
"print(metrics)\n",
"\n",
"model_prod = gapic.ModelEvaluation(\n",
" display_name=\"prod\",\n",
" metrics_schema_uri=\"gs://google-cloud-aiplatform/schema/modelevaluation/classification_metrics_1.0.0.yaml\",\n",
" metrics=metrics,\n",
")\n",
"\n",
"client.import_model_evaluation(parent=model.resource_name, model_evaluation=model_prod)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "337319a19efe"
},
"source": [
"### List a specific custom model evaluation\n",
"\n",
"Now that your custom second metric has been uploaded to the corresponding model in the Vertex AI Model Registry, you can retrieve this specific evaluation by filtering using the `display_name`:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "1b3374e988cf"
},
"outputs": [],
"source": [
"evaluations = model.list_model_evaluations()\n",
"for evaluation in evaluations:\n",
" if evaluation.display_name == \"prod\":\n",
" print(evaluation.gca_resource)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "b3a3993dc813"
},
"source": [
"### Upload version 2 of the TFHub model to the `Vertex AI Model Registry`\n",
"\n",
"Next, you upload the second version of the TFHub model as a `Model` resource in the `Vertex AI Model Registry`, with the additional following parameters:\n",
"\n",
"- `parent_model`: The existing `Model` resource for which to add this model as the next model version.\n",
"- `is_default_version`: Whether this will be the default version for the `Model` resource. In this example, you change from the default from the first version to the second version of the model.\n",
"- `version_ailiases`: User defined list of alternative alias names for the model version, such as `production`.\n",
"- `version_description`: User description of the model version.\n",
"\n",
"When a subsequent model version is created in the `Vertex AI Model Registry`, the property `version_id` will automatically be incremented. In this example, it will be set to 2 (2nd version)."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "852be5e5f964"
},
"outputs": [],
"source": [
"model_v2 = aiplatform.Model.upload(\n",
" display_name=\"resnet\",\n",
" artifact_uri=MODEL_DIR,\n",
" serving_container_image_uri=DEPLOY_IMAGE,\n",
" parent_model=model.resource_name,\n",
" is_default_version=True,\n",
" version_aliases=[\"v2\"],\n",
" version_description=\"This is the second version of the model\",\n",
")\n",
"\n",
"print(model_v2)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "68870bd8194d"
},
"source": [
"### Upload an evaluation metrics for version 2 of the model to the Model Registry\n",
"\n",
"Next, upload a model evaluation to the corresponding model version in the Vertex AI Model Registry. Note, you referenced `model_v2.resource_name` to refer to version 2 of this model."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "9b864c0ba07f"
},
"outputs": [],
"source": [
"metrics = {\"logLoss\": 1.0, \"auPrc\": 0.91}\n",
"print(metrics)\n",
"\n",
"model_eval = gapic.ModelEvaluation(\n",
" display_name=\"eval\",\n",
" metrics_schema_uri=\"gs://google-cloud-aiplatform/schema/modelevaluation/classification_metrics_1.0.0.yaml\",\n",
" metrics=metrics,\n",
")\n",
"\n",
"client.import_model_evaluation(\n",
" parent=model_v2.resource_name, model_evaluation=model_eval\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "d4e72b21b06b"
},
"source": [
"### List the evaluations for both versions of the model\n",
"\n",
"Finally, list the number of evaluations for both versions of the model."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "369a23d392a4"
},
"outputs": [],
"source": [
"evaluations = model.list_model_evaluations()\n",
"print(\"Model v1 no. of evaluations\", len(evaluations))\n",
"evaluations = model_v2.list_model_evaluations()\n",
"print(\"Model v2 no. of evaluations\", len(evaluations))"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "TpV-iwP9qw9c"
},
"source": [
"## Cleaning up\n",
"\n",
"To clean up all Google Cloud resources used in this project, you can [delete the Google Cloud\n",
"project](https://cloud.google.com/resource-manager/docs/creating-managing-projects#shutting_down_projects) you used for the tutorial.\n",
"\n",
"Otherwise, you can delete the individual resources you created in this tutorial:\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "sx_vKniMq9ZX"
},
"outputs": [],
"source": [
"import os\n",
"\n",
"# Delete model resource\n",
"model.delete()\n",
"\n",
"# Delete Cloud Storage objects that were created\n",
"delete_bucket = False\n",
"if delete_bucket or os.getenv(\"IS_TESTING\"):\n",
" ! gsutil -m rm -r $BUCKET_URI"
]
}
],
"metadata": {
"colab": {
"collapsed_sections": [],
"name": "get_started_with_custom_model_evaluation_import.ipynb",
"toc_visible": true
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
@@ -55,7 +55,11 @@
"</table>\n",
"<br/><br/><br/>\n",
"\n",
"**This feature is in private preview**. You can request access to model monitoring for AutoML image models with this [Form](https://docs.google.com/forms/d/1aTitFrlNRlUAF_gvbMFQWDY0Oq8T_fUrN1m79atF8xQ/edit?resourcekey=0-psKsTGtVUFFUBDL2timIQA)."
"**This feature is in experimental**. You can request access to model monitoring for AutoML image models with this [Form](https://docs.google.com/forms/d/1aTitFrlNRlUAF_gvbMFQWDY0Oq8T_fUrN1m79atF8xQ/edit?resourcekey=0-psKsTGtVUFFUBDL2timIQA).\n",
"\n",
"**LEGAL NOTICE**\n",
"\n",
"This is an Experimental release. Experiments are focused on validating a prototype and are not guaranteed to be released. Experiments are covered by the [Pre-GA Offerings Terms](https://cloud.google.com/terms/service-terms) of the Google Cloud Platform Terms of Service. They are not intended for production use or covered by any SLA, support obligation, or deprecation policy and might be subject to backward-incompatible changes.\n"
]
},
{
@@ -188,7 +192,8 @@
"\n",
"! pip3 install {USER_FLAG} -q -U google-cloud-aiplatform \"shapely<2\" \\\n",
" tensorflow==2.7 \\\n",
" google-api-core==2.10"
" google-api-core==2.10 \\\n",
" protobuf==3.20.3"
]
},
{
@@ -55,9 +55,13 @@
"</table>\n",
"<br/><br/><br/>\n",
"\n",
"**This feature is in private preview**. You can request access to model monitoring for AutoML image models with this [Form](https://docs.google.com/forms/d/1aTitFrlNRlUAF_gvbMFQWDY0Oq8T_fUrN1m79atF8xQ/edit?resourcekey=0-psKsTGtVUFFUBDL2timIQA).\n",
"**This feature is in experimental**. You can request access to model monitoring for AutoML image models with this [Form](https://docs.google.com/forms/d/1aTitFrlNRlUAF_gvbMFQWDY0Oq8T_fUrN1m79atF8xQ/edit?resourcekey=0-psKsTGtVUFFUBDL2timIQA).\n",
"\n",
"If after access is granted and your monitoring job fails to start for this reason `Training Datasets for AutoML Deployed Models no longer available, please explicitly configure Analysis Instance Schema`, you need to request that your project be added to the group `VISION_MM_EXP`."
"If after access is granted and your monitoring job fails to start for this reason `Training Datasets for AutoML Deployed Models no longer available, please explicitly configure Analysis Instance Schema`, you need to request that your project be added to the group `VISION_MM_EXP`.\n",
"\n",
"## LEGAL NOTICE\n",
"\n",
"This is an Experimental release. Experiments are focused on validating a prototype and are not guaranteed to be released. Experiments are covered by the [Pre-GA Offerings Terms](https://cloud.google.com/terms/service-terms) of the Google Cloud Platform Terms of Service. They are not intended for production use or covered by any SLA, support obligation, or deprecation policy and might be subject to backward-incompatible changes."
]
},
{
@@ -189,14 +193,15 @@
" USER_FLAG = \"--user\"\n",
"\n",
"# Install the packages\n",
"# Install the packages\n",
"! pip3 install {USER_FLAG} -q --upgrade google-cloud-aiplatform \\\n",
" google-cloud-storage \\\n",
" pandas-gbq \n",
" pandas-gbq\n",
"\n",
"! pip3 install {USER_FLAG} -q -U google-api-core==2.10 \n",
"\n",
"! pip3 install {USER_FLAG} -q --upgrade protobuf \\\n",
" tensorflow==2.7"
"! pip3 install {USER_FLAG} -q -U google-cloud-aiplatform \"shapely<2\" \\\n",
" tensorflow==2.7 \\\n",
" google-api-core==2.10 \\\n",
" protobuf==3.20.3"
]
},
{
File diff suppressed because it is too large Load Diff
@@ -65,7 +65,7 @@
"\n",
"This tutorial demonstrates how to use Vertex AI Pipelines with pre-built Google Cloud Pipeline Components for custom training.\n",
"\n",
"Learn more about [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines/introduction) and [Vertex AI Training components](https://cloud.google.com/vertex-ai/docs/training/create-training-pipeline)."
"Learn more about [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines/introduction) and [Custom training components](https://cloud.google.com/vertex-ai/docs/training/create-training-pipeline)."
]
},
{
@@ -784,7 +784,7 @@
"outputs": [],
"source": [
"# Setup\n",
"SPARK_VERSION = \"3.1.2\"\n",
"DATAPROC_RUNTIME_VERSION = \"1.1.3\"\n",
"SRC = path(\"src\")\n",
"BUILD_PATH = path(\"build\")\n",
"DELIVERABLES = path(\"deliverables\")\n",
@@ -856,7 +856,7 @@
" HPT_BUNDLE_URI,\n",
"]\n",
"HPT_RUNTIME_PROPERTIES = {\n",
" \"spark.jars.packages\": \"ml.combust.mleap:mleap-spark-base_2.12:0.20.0,ml.combust.mleap:mleap-spark_2.12:0.20.0\"\n",
" \"spark.jars.packages\": \"ml.combust.mleap:mleap-spark-base_2.12:0.21.1,ml.combust.mleap:mleap-spark_2.12:0.21.1\"\n",
"}\n",
"\n",
"# Experiment\n",
@@ -2465,6 +2465,7 @@
" deploy_model: bool = DEPLOY_MODEL,\n",
" artifact_uri: str = ARTIFACT_URI,\n",
" serving_image_uri: str = SERVING_IMAGE_URI,\n",
" dataproc_runtime_version: str = DATAPROC_RUNTIME_VERSION,\n",
"):\n",
" from google_cloud_pipeline_components.v1.dataproc import \\\n",
" DataprocPySparkBatchOp\n",
@@ -2485,6 +2486,7 @@
" main_python_file_uri=preprocessing_main_python_file_uri,\n",
" args=build_preprocessing_args_op.output,\n",
" subnetwork_uri=subnetwork_uri,\n",
" runtime_config_version=dataproc_runtime_version,\n",
" ).after(build_preprocessing_args_op)\n",
"\n",
" # build training data args\n",
@@ -2502,6 +2504,7 @@
" main_python_file_uri=training_main_python_file_uri,\n",
" args=build_training_args_op.output,\n",
" subnetwork_uri=subnetwork_uri,\n",
" runtime_config_version=dataproc_runtime_version,\n",
" ).after(build_training_args_op)\n",
"\n",
" evaluate_model_op = evaluate_model(metrics_uri=metrics_path).after(\n",
@@ -2530,6 +2533,8 @@
" args=build_hpt_args_op.output,\n",
" runtime_config_properties=HPT_RUNTIME_PROPERTIES,\n",
" subnetwork_uri=subnetwork_uri,\n",
" # TODO: change to Dataproc Serverless Runtime 1.1.x image when MLeap supports Spark 3.3\n",
" runtime_config_version=\"1.0.29\",\n",
" ).after(model_training_op)\n",
"\n",
" # evaluate condition to upload and deploy model to Vertex AI\n",
@@ -63,7 +63,7 @@
"\n",
"This notebook shows how to use the components defined in [`google_cloud_pipeline_components`](https://github.com/kubeflow/pipelines/tree/master/components/google-cloud) to build a [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines) workflow that trains a [custom model](https://cloud.google.com/vertex-ai/docs/training/containers-overview), uploads the model as a `Model` resource, creates an `Endpoint` resource, and deploys the `Model` resource to the `Endpoint` resource.\n",
"\n",
"Learn more about [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines/introduction) and [Vertex AI Training components](https://cloud.google.com/vertex-ai/docs/pipelines/customjob-component)."
"Learn more about [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines/introduction) and [Custom training components](https://cloud.google.com/vertex-ai/docs/pipelines/customjob-component)."
]
},
{
@@ -94,7 +94,7 @@
"- Compile the KFP pipeline.\n",
"- Execute the KFP pipeline using `Vertex AI Pipelines`\n",
"\n",
"The components are [documented here](https://google-cloud-pipeline-components.readthedocs.io/en/latest/google_cloud_pipeline_components.aiplatform.html#module-google_cloud_pipeline_components.aiplatform).\n",
"The components are [documented here](https://google-cloud-pipeline-components.readthedocs.io/en/google-cloud-pipeline-components-1.0.39/google_cloud_pipeline_components.aiplatform.html).\n",
"(From that page, see also the `CustomPythonPackageTrainingJobRunOp` and `CustomContainerTrainingJobRunOp` components, which similarly run 'custom' training, but as with the related `google.cloud.aiplatform.CustomContainerTrainingJob` and `google.cloud.aiplatform.CustomPythonPackageTrainingJob` methods from the [Vertex AI SDK](https://googleapis.dev/python/aiplatform/latest/aiplatform.html), also upload the trained model)."
]
},
-20
View File
@@ -1,20 +0,0 @@
[Training, tuning and deploying a PyTorch text sentiment classification model on Vertex AI](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/pytorch/pytorch-text-sentiment-classification-custom-train-deploy.ipynb)
```
Learn to build, train, tune and deploy a PyTorch model on [Vertex AI](https://cloud.
The steps performed include:
- Create training package for the text classification model.
- Train the model with custom training on Vertex AI.
- Check the created model artifacts.
- Create a custom container for predictions.
- Deploy the trained model to a Vertex AI Endpoint using the custom container for predictions.
- Send online prediction requests to the deployed model and validate.
- Clean up the resources created in this notebook.
```
&nbsp;&nbsp;&nbsp;Learn more about [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training).
@@ -64,7 +64,7 @@
"\n",
"Note: you may incur charges for training, prediction, storage or usage of other GCP products in connection with testing this SDK.\n",
"\n",
"Learn more about [AutoML Video](https://cloud.google.com/vertex-ai/docs/tutorials/video-classification-automl/training)."
"Learn more about [Classification for video data](https://cloud.google.com/vertex-ai/docs/training-overview#classification_for_videos)."
]
},
{
@@ -773,7 +773,19 @@
"\n",
"The `run` method when completed returns the `Model` resource.\n",
"\n",
"The execution of the training pipeline can take over 2 hours to complete."
"The execution of the training pipeline can take over 24 hours to complete."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "8f135100f5d9"
},
"outputs": [],
"source": [
"if os.getenv(\"IS_TESTING\"):\n",
" sys.exit(0)"
]
},
{
@@ -64,7 +64,7 @@
"\n",
"Note: You may incur charges for training, prediction, storage or usage of other GCP products in connection with testing this SDK.\n",
"\n",
"Learn more about [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
"Learn more about [Custom training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
]
},
{
@@ -29,7 +29,7 @@
"id": "JAPoU8Sm5E6e"
},
"source": [
"# Vertex AI Explainations with TabNet models\n",
"# Vertex AI Explanations with TabNet models\n",
"\n",
"<table align=\"left\">\n",
"\n",
@@ -86,7 +86,7 @@
"- TabNet builtin algorithm\n",
"\n",
"The steps performed are:\n",
"* Setup the the project.\n",
"* Setup the project.\n",
"* Download the prediction data of pretrain model onf Syn2 data.\n",
"* Visualize and understand the feature importance based on the masks output.\n",
"* Clean up the resource created by this tutorial."
@@ -91,7 +91,7 @@
"With Vertex AI TensorBoard, you can track, visualize, and compare\n",
"ML experiments and share them with your team.\n",
"\n",
"Learn more about [Vertex AI TensorBoard](https://cloud.google.com/vertex-ai/docs/experiments/tensorboard-overview) and [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
"Learn more about [Vertex AI TensorBoard](https://cloud.google.com/vertex-ai/docs/experiments/tensorboard-overview) and [Custom training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
]
},
{
@@ -91,7 +91,7 @@
"With Vertex AI TensorBoard, you can track, visualize, and compare\n",
"ML experiments and share them with your team.\n",
"\n",
"Learn more about [Vertex AI TensorBoard](https://cloud.google.com/vertex-ai/docs/experiments/tensorboard-overview) and [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
"Learn more about [Vertex AI TensorBoard](https://cloud.google.com/vertex-ai/docs/experiments/tensorboard-overview) and [Custom training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
]
},
{
@@ -72,7 +72,7 @@
"\n",
"This tutorial demonstrates how to create a multi-node, distributed image classification using PyTorch on Vertex AI SDK with GPU. This can help your training job scale to handle large amounts of data.\n",
"\n",
"Learn more about [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
"Learn more about [Custom training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
]
},
{
@@ -33,18 +33,18 @@
"\n",
"<table align=\"left\">\n",
" <td>\n",
" <a href=\"https://colab.research.google.com/github/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/pytorch/pytorch-text-sentiment-classification-custom-train-deploy.ipynb\">\n",
" <a href=\"https://colab.research.google.com/github/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/training/pytorch-text-sentiment-classification-custom-train-deploy.ipynb\">\n",
" <img src=\"https://cloud.google.com/ml-engine/images/colab-logo-32px.png\" alt=\"Colab logo\"> Run in Colab\n",
" </a>\n",
" </td>\n",
" <td>\n",
" <a href=\"https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/pytorch/pytorch-text-sentiment-classification-custom-train-deploy.ipynb\">\n",
" <a href=\"https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/training/pytorch-text-sentiment-classification-custom-train-deploy.ipynb\">\n",
" <img src=\"https://cloud.google.com/ml-engine/images/github-logo-32px.png\" alt=\"GitHub logo\">\n",
" View on GitHub\n",
" </a>\n",
" </td>\n",
" <td>\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/pytorch/pytorch-text-sentiment-classification-custom-train-deploy.ipynb\" target='_blank'>\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/training/pytorch-text-sentiment-classification-custom-train-deploy.ipynb\" target='_blank'>\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",
" </a>\n",
@@ -65,7 +65,7 @@
"\n",
"You can find more details about the model at [Hugging Face Hub](https://huggingface.co/bert-base-cased). For more notebooks with the state of the art PyTorch/Tensorflow/JAX, you can explore [Hugging FaceNotebooks](https://huggingface.co/transformers/notebooks.html).\n",
"\n",
"Learn more about [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
"Learn more about [Custom training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
]
},
{
@@ -1301,12 +1301,26 @@
"- `machine_type`: Mahcine type on which the job needs to run.\n",
"- `accelerator_type`: Hardware accelerator type for running the job. One of _ACCELERATOR_TYPE_UNSPECIFIED_,\n",
" _NVIDIA_TESLA_K80_, _NVIDIA_TESLA_P100_, _NVIDIA_TESLA_V100_, _NVIDIA_TESLA_P4_,\n",
" _NVIDIA_TESLA_T4_.\n",
" _NVIDIA_TESLA_T4_, _NVIDIA_TELSA_A100_\n",
"- `accelerator_count`: The number of accelerators to attach to a worker replica.\n",
"- `replica_count`: The number of worker replicas.\n",
"- `args`: Command line arguments to be passed to the Python script.\n",
"\n",
"Learn more about Vertex AI's [Custom Python-Package Trainining](https://cloud.google.com/python/docs/reference/aiplatform/latest/google.cloud.aiplatform.CustomPythonPackageTrainingJob)."
"Learn more about Vertex AI's [Custom Python-Package Trainining](https://cloud.google.com/python/docs/reference/aiplatform/latest/google.cloud.aiplatform.CustomPythonPackageTrainingJob).\n",
"\n",
"*Note*: This training job may take over 24 hours."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "b3709beb73e2"
},
"outputs": [],
"source": [
"if os.getenv(\"IS_TESTING\"):\n",
" sys.exit(0)"
]
},
{
@@ -63,7 +63,7 @@
"\n",
"This tutorial shows you how to create a distributed custom training job on Vertex AI that can handle large amounts of training data.\n",
"\n",
"Learn more about [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
"Learn more about [Custom training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
]
},
{
@@ -830,13 +830,22 @@
" ! gcloud builds submit --timeout=1800s --region={REGION} --tag $TRAIN_IMAGE"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "41ZgDYPNfEvt"
},
"source": [
"## Run training job with SDK (Option 1) or with gcloud (Option 2)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "PtUycdZhCJvQ"
},
"source": [
"### Initialize Vertex AI SDK"
"### 1.1 Initialize Vertex AI SDK"
]
},
{
@@ -860,7 +869,16 @@
"id": "_GB2j39BCXiy"
},
"source": [
"### Run a Vertex AI SDK CustomContainerTrainingJob"
"### 1.2 Run a Vertex AI SDK CustomContainerTrainingJob"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "7udaU3jxfKs8"
},
"source": [
"You can specify the fields enable_web_access and enable_dashboard_access. The enable_web_access enables the interactive shell for the job and enable_dashboard_access allows the dask dashboard to be accessed."
]
},
{
@@ -887,9 +905,34 @@
" base_output_dir=gcs_output_uri_prefix,\n",
" replica_count=replica_count,\n",
" machine_type=machine_type,\n",
" enable_dashboard_access=True,\n",
" enable_web_access=True,\n",
" sync=False,\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "ROqdvgBKFGKL"
},
"source": [
"Wait for a few minutes for the Custom Job to start"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "rBYbvim_FJz0"
},
"outputs": [],
"source": [
"import time\n",
"\n",
"time.sleep(60 * 3)"
]
},
{
"cell_type": "code",
"execution_count": null,
@@ -902,13 +945,66 @@
"print(f\"GCS Output URI Prefix: {gcs_output_uri_prefix}\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "-0EJdcjPyjDK"
},
"source": [
"You can access the link to the Custom Job in the Cloud Console UI here:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "ZMZPrcqsyj0e"
},
"outputs": [],
"source": [
"print(\n",
" f\"Custom Training Job URI: {custom_container_training_job._custom_job_console_uri()}\"\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "7McPKJGxymLU"
},
"source": [
"Once the job is in the state \"RUNNING\", you can access the web access and dashboard access URIs here:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "tiHdwJs1yoE0"
},
"outputs": [],
"source": [
"print(f\"Web Access and Dashboard URIs: {custom_container_training_job.web_access_uris}\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "9RDh5CzNywIA"
},
"source": [
"The interactive shell has the key with the format \"workerpool0-0\", while the dashboard uri has the key with the format \"workerpool0-0:\" + port number (workerpool0-0:8888 in this example). On the page for your Custom Job in the Cloud Console UI, you can also \"Launch web terminal\" for \"workerpool0-0\" for web access, or click \"Launch web terminal\" for \"workerpool0-0:\" + port number for dashboard access.\n",
"\n",
"Note that you can only access an interactive shell and dashboard while the job is running. If you don't see Launch web terminal in the UI or the URIs in the output of the Web Access and Dashboard URIs command, this might be because Vertex AI hasn't started running your job yet, or because the job has already finished or failed. If the job's Status is Queued or Pending, wait a minute; then try refreshing the page, or trying the command again."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "tVktIbToRpmR"
},
"source": [
"### Access the Dask dashboard"
"### 2. Run a CustomContainerTraining Job with gcloud"
]
},
{
@@ -917,7 +1013,7 @@
"id": "uVvxLj8GRsM6"
},
"source": [
"You can also create a training job with gcloud command. With gcloud command, you can specify the field enableWebAccess and enableDashboardAccess. enableWebAccess enables the interactive shell for the job and enableDashboardAccess allows the dask dashboard to be accessed."
"You can also create a training job with the gcloud command. With the gcloud command, you can specify the field enableWebAccess and enableDashboardAccess. The enableWebAccess enables the interactive shell for the job and enableDashboardAccess allows the dask dashboard to be accessed."
]
},
{
@@ -975,10 +1071,16 @@
{
"cell_type": "markdown",
"metadata": {
"id": "onb40Ge0SVKh"
"id": "HAYihHT9ff9q"
},
"source": [
"Once the job is created. You can use the output `gcloud ai custom-jobs describe` command to print the field webAccessUris. The interactive shell has the key with the format \"workerpool0-0\", while the dashboard uri has the key with the format \"workerpool0-0:\" + port number. Note: You have to access the links while the job is running."
"#### Access the dashboard and interactive shell for a gcloud custom job\n",
"\n",
"Once the job is created, you can access the web access URI and dashboard access URI by using the `gcloud ai custom-jobs describe` command to print the field webAccessUris. The interactive shell has the key with the format \"workerpool0-0\", while the dashboard uri has the key with the format \"workerpool0-0:\" + port number (workerpool0-0:8888 in this example).\n",
"\n",
"You also can find the links in the Cloud Console UI. In the Cloud Console UI, in the Vertex AI section, go to Training and then Custom Jobs. Click on the name of your custom training job. On the page for your job, click \"Launch web terminal\" for \"workerpool0-0\" for web access, or click \"Launch web terminal\" for \"workerpool0-0:\" + port number for dashboard access.\n",
"\n",
"Note that you can only access an interactive shell and dashboard while the job is running. If you don't see Launch web terminal in the UI or the URIs in the output of the gcloud command, this might be because Vertex AI hasn't started running your job yet, or because the job has already finished or failed. If the job's Status is Queued or Pending, wait a minute; then try refreshing the page, or trying the gcloud command again."
]
},
{
@@ -1098,6 +1200,9 @@
},
"outputs": [],
"source": [
"import logging\n",
"import traceback\n",
"\n",
"# Set this to true only if you'd like to delete your bucket\n",
"delete_bucket = False\n",
"\n",
@@ -1106,7 +1211,11 @@
"if delete_bucket or os.getenv(\"IS_TESTING\"):\n",
" ! gsutil rm -r $BUCKET_URI\n",
"\n",
"custom_container_training_job.delete()"
"try:\n",
" custom_container_training_job.delete()\n",
"except Exception as e:\n",
" logging.error(traceback.format_exc())\n",
" print(e)"
]
}
],
@@ -89,7 +89,7 @@
"* Model with BigQuery and the ARIMA model\n",
"* Evaluate the model\n",
"* Evaluate the model results using BigQuery ML (on training data)\n",
"* Evalute the model results - MAE, MAPE, MSE, RMSE (on test data)\n",
"* Evaluate the model results - MAE, MAPE, MSE, RMSE (on test data)\n",
"* Use the executor feature"
]
},
@@ -63,7 +63,7 @@
"\n",
"This tutorial shows you how to build, deploy, and analyze predictions from a simple [random forest](https://en.wikipedia.org/wiki/Random_forest) model using tools like scikit-learn, Vertex AI, and the [What-IF Tool (WIT)](https://cloud.google.com/ai-platform/prediction/docs/using-what-if-tool) on a synthetic fraud transaction dataset to solve a financial fraud detection problem.\n",
"\n",
"Learn more about [Vertex AI Workbench](https://cloud.google.com/vertex-ai/docs/workbench/introduction) and [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
"Learn more about [Vertex AI Workbench](https://cloud.google.com/vertex-ai/docs/workbench/introduction) and [Custom training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
]
},
{