Compare commits

...
Author SHA1 Message Date
Andrew FerlitschandGitHub 06daeb1575 Merge branch 'main' into instance_schema 2022-10-31 13:30:28 -07:00
Andrew Ferlitsch 2074fb56a9 feat: add example of instance schema 2022-10-31 20:29:16 +00:00
Andrew FerlitschandGitHub 1bdbb7921a fix: reduce visibility of proto code (#1202) 2022-10-31 16:00:27 -04:00
7154a722ba Update Experiments notebook for log_classification_metrics (#1182)
* Update build_model_experimentation_lineage_with_prebuild_code.ipynb

* Update build_model_experimentation_lineage_with_prebuild_code.ipynb

* Update build_model_experimentation_lineage_with_prebuild_code.ipynb

* Update build_model_experimentation_lineage_with_prebuild_code.ipynb

* Update build_model_experimentation_lineage_with_prebuild_code.ipynb

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-10-31 12:27:27 -07:00
halio-gandGitHub 99d4a8c31a Adding Open Source Vizier converstion sample[Updated] (#1187)
* Add a colab to show how to integrate the training job with Dask.

* Reformat the notebook xgboost_data_parallel_training_on_cpu_using_dask

* Add the code owner of the sample training/xgboost_data_parallel_training_on_cpu_using_dask.ipynb

* Changed the project id to [your-project-id].

* Fixed the issue for Non colab.

* Adding the sample of converting the Vertex Vizier SDK with Open source Vizier.

* Add the owner for conversions_vertex_vizier_and_open_source_vizier.ipynb

* Addressed the comments in the xgboost_data_parallel_training_on_cpu_using_dask

* Fixed the format of xgboost_data_parallel_training_on_cpu_using_dask

* Addressed the comments in the training/xgboost_data_parallel_training_on_cpu_using_dask.ipynb

* Add explanation that Docker is not available on Colab.

* Add  before docker command.

* add timeout in the worker to wait for the scheduler.

* Addressed the comments in the pr.

* Addressed the comments in the pr.
2022-10-28 15:26:14 -07:00
f9cedf2850 Added notebook demonstrating hyperparameter tuning (#1168)
* Added notebook demonstrating hyperparameter tuning

* fix lint errors

* fix failing test

* ran linter

* ran linter

* resolved editorial comments

* small editorial edits

* fix failing test

* fix linter

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-10-28 09:53:22 -07:00
f4f0112a6a Pipelines xgboost (#1196)
* feat: add notebook

* feat: add notebook

* fix: typos in text

Co-authored-by: gericdong <itseric@google.com>
2022-10-27 20:18:20 -04:00
Kevin NaughtonandGitHub e441568c38 Quick typo update in model_monitoring.ipynb (#1197)
The Monitoring Interval is in hours, not seconds.
2022-10-27 17:10:42 -07:00
Andrew FerlitschandGitHub fee8c969e4 feat: add xgboost pipeline notebook (#1194)
* feat: add notebook

* feat: add notebook
2022-10-27 15:20:10 -04:00
Andrew FerlitschandGitHub bdac091e3f feat: add sklearn pipeline notebook (#1193)
* feat: add notebook

* feat: add notebook

* fix: typo in text for dataset-url
2022-10-27 13:32:09 -04:00
kthytangandGitHub ff9338ed3c chore: remove preview note from CPR notebooks (#1192) 2022-10-26 11:31:42 -07:00
Andrew FerlitschandGitHub 1a538fd249 fix: multi-class vs binary classifier (#1191) 2022-10-26 08:28:35 -07:00
4f09c94b5f fix: textual corrections and Upgrade the gcpc version for automl_video_classification_model_evaluation notebook. (#1169)
* added model evaluation component

* linter test cases

* linter test cases

* model_name param issues resolved

* linter test case

* import issues resloved

* linter test cases

* made review changes

* made review changes

* ran linter test

* made review changes

* made review changes

* made review changes

* linter test

* ran linter test

* made review changes

* ran linter test

* made review changes

* ran linter test

* linter test

* review changes

* ran linter test

* added The links for Colab, Github and Workbench

* added The links for Colab, Github and Workbench

* ran linter test

* added The links for Colab, Github and Workbench

* ran linter test

* added The links for Colab, Github and Workbench

* ran linter test

* notebook title changed

* ran linter test

* text changes and made review changes

* ran linter test

* made review changes

* linter test

* made review changes

* linter test

* content changes

* ran linter test

* textual corrections and links

* ran linter test

Co-authored-by: Ivan Cheung <ivans.mailbox@gmail.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
Co-authored-by: Soheila Zangeneh <49654056+soheilazangeneh@users.noreply.github.com>
2022-10-25 17:32:44 -04:00
bcf3e6b0f5 Updated file custom_tabular_regression_model_evaluation (#1180)
* made text corrections

* ran linter

* modified notebook

* modified notebook

* ran linter

* modified installation step

* ran linter

Co-authored-by: Soheila Zangeneh <49654056+soheilazangeneh@users.noreply.github.com>
2022-10-25 12:42:48 -04:00
Bo zhengandGitHub fbcf783064 feat: change E2E AutoML dataset to use bank marketing data
* Change E2E AutoML dataset to use bank marketing data

* Remove vs code config
2022-10-24 22:15:43 -07:00
halio-gandGitHub 2f5fe80f34 Adding the official version for Dask parallel training on cpu (#1153)
* Add a colab to show how to integrate the training job with Dask.

* Reformat the notebook xgboost_data_parallel_training_on_cpu_using_dask

* Add the code owner of the sample training/xgboost_data_parallel_training_on_cpu_using_dask.ipynb

* Changed the project id to [your-project-id].

* Fixed the issue for Non colab.

* Addressed the comments in the xgboost_data_parallel_training_on_cpu_using_dask

* Fixed the format of xgboost_data_parallel_training_on_cpu_using_dask

* Addressed the comments in the training/xgboost_data_parallel_training_on_cpu_using_dask.ipynb

* Add explanation that Docker is not available on Colab.

* Add  before docker command.

* add timeout in the worker to wait for the scheduler.
2022-10-24 10:37:13 -07:00
a850f3a88a fix: missed bad links (#1183)
* fix: missed bad links

* fix: missed bad links

Co-authored-by: gericdong <itseric@google.com>
2022-10-21 11:09:11 -04:00
Andrew FerlitschandGitHub de91feaca1 Update README.md (#1181)
added missing link
2022-10-21 07:15:38 -07:00
Andrew FerlitschandGitHub a7fd0734dc feat: XGBoost online serving (#1175)
* feat: xgboost online serving

* fix: review comments and added pipeline example

* fix: review comments
2022-10-19 08:49:31 -07:00
Soheila ZangenehandGitHub ce1b167f08 Edit folder and file name for model registry (#1178)
* Update folder and file name

* Update file name

* Update CODEOWNERS

* Update notebook links

* Update README

* Run linter
2022-10-18 14:40:52 -07:00
Soheila ZangenehandGitHub 65ff3cab60 Revert "Update folder and file names (#1176)" (#1177)
This reverts commit c7ef72f1d3.
2022-10-18 16:59:39 -04:00
Soheila ZangenehandGitHub c7ef72f1d3 Update folder and file names (#1176)
* Rename folder

* Rename file

* Update the links

* Update CODOWNERS

* Run linter
2022-10-18 16:42:36 -04:00
Andrew FerlitschandGitHub bd58428857 fix: issue 1122 (#1173) 2022-10-18 15:09:35 -04:00
Andrew FerlitschandGitHub a4a6ed848b fix: working on abstract class (#1156)
* fix: working on abstract class

* fix: working on abstract class
2022-10-13 10:56:17 -04:00
Andrew FerlitschandGitHub b753bc58d3 fix: enum and cell index naming (#1152) 2022-10-12 14:54:57 -04:00
6279e12eea Bug fixes and automation improvements for google_cloud_pipeline_components_dataproc_tabular.ipynb (#1139)
* Bug fixes and improved automation

* Clean up notebook

* Add --quiet flag to gcloud call

* Add Python prediction and subnetwork parameter

Co-authored-by: Win Woo <wwoo@google.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-10-12 08:19:25 -07:00
Andrew FerlitschandGitHub fc0c34c905 Boilerplate 2 (#1148)
* fix: merge corruption

* fix: still fix post corruption

* tuning: boiler plate script

* tuning: boiler plate

* tuning: boiler plate

* tuning: boiler plate
2022-10-11 14:01:41 -07:00
Andrew FerlitschandGitHub ef388ecf30 Boilerplate 2 (#1147)
* fix: merge corruption

* fix: still fix post corruption

* tuning: boiler plate script

* tuning: boiler plate

* tuning: boiler plate
2022-10-11 13:57:40 -07:00
Andrew FerlitschandGitHub bafb2c6f59 Boilerplate 2 (#1146)
* fix: merge corruption

* fix: still fix post corruption

* tuning: boiler plate script

* tuning: boiler plate
2022-10-11 13:43:27 -07:00
Andrew FerlitschandGitHub f2d431c182 tuning: boiler plate (#1145)
* fix: merge corruption

* fix: still fix post corruption

* tuning: boiler plate script
2022-10-11 13:31:55 -07:00
Andrew FerlitschandGitHub 2e4b6a1b1b fix: structure (#1138) 2022-10-11 13:29:11 -07:00
95cebcbf8f Update google_cloud_pipeline_components_dataproc_tabular.ipynb (#1136)
Removed extraneous `$` from CWD variable causing scala-sbt build to fail

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-10-11 13:04:28 -07:00
Andrew FerlitschandGitHub 08f1b659c5 Boilerplate 1 (#1144)
* feat: boiler plate reduction

* feat: boiler plate reduction
2022-10-11 11:30:08 -07:00
Andrew FerlitschandGitHub 86ba71931d fix: merge corruption (#1143) 2022-10-11 11:19:05 -07:00
d811306fb9 minor fixes (#1140)
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-10-11 11:09:24 -07:00
Andrew FerlitschandGitHub 4173e6d561 Boilerplate 1 (#1142)
* feat: boiler plate reduction

* feat: boiler plate reduction
2022-10-11 10:27:04 -07:00
Andrew FerlitschandGitHub 499d25055a feat: boiler plate reduction (#1141) 2022-10-11 09:32:30 -07:00
Andrew FerlitschandGitHub 60776de953 fix: bad links and branding (#1137) 2022-10-10 15:57:22 -07:00
Andrew FerlitschandGitHub 182ebcf285 fix: script format (#1134)
* fix: script format

* fix: script format

* fix: script format

* fix: script format
2022-10-10 15:56:31 -07:00
MarcandGitHub 39359a5b21 switch mm ownership to Andy (#1133) 2022-10-10 09:48:12 -07:00
0d72cfe070 Modified file automl_forecasting_bqml_arima_plus_comparison (#1124)
* modified notebook

* ran linter

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-10-10 08:51:51 -07:00
64fef140a2 Vertex SDK AutoML Image Classification (#1123)
* tf library issues solved

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-10-07 15:14:53 -07:00
015809b948 Cleans up official/migration/UJ3 notebook and fixes the issue from regression logs (#1063)
* cleans up the notebook,replaces docker with cloud build, textual edits still in progress

* cleans up the notebook

* ran linter test

* changes tf train/serve version to 2.9

* ran linter test

* adds '=' to fix a typo

* ran linter test

* updates the opencv installation package

* ran linter test

* updates the opencv installation dependencies

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-10-07 09:37:12 -07:00
gericdongandGitHub faccdd081f fix: improved notebook comments and readme (#1131)
* fix: improved notebook comments

* fix: improved notebook comments and formatting
2022-10-07 08:00:02 -07:00
3e8a3cf28e updates: autoreview (#1126)
Co-authored-by: gericdong <itseric@google.com>
2022-10-06 16:11:13 -04:00
Andrew FerlitschandGitHub 821bba2776 fix: loose ends on objective conformance (#1125) 2022-10-06 15:46:31 -04:00
c82bdee299 fix: incorrect linking (#1119)
* feat: add autogen index

* fix: missed the REAME

* fix: update autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* fix: incorrect linking for index

* fix: incorrect linking

Co-authored-by: gericdong <itseric@google.com>
2022-10-06 10:11:45 -04:00
Andrew FerlitschandGitHub c27381139b fix: incorrect linking (#1121) 2022-10-05 18:28:32 -07:00
Andrew FerlitschandGitHub 01236836f2 fix: incorrect linking (#1120) 2022-10-05 18:12:30 -07:00
Andrew FerlitschandGitHub b8380650bd fix: incorrect linking (#1118)
* feat: add autogen index

* fix: missed the REAME

* fix: update autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* fix: incorrect linking for index
2022-10-05 17:52:45 -07:00
Andrew FerlitschandGitHub 69d266cb90 add: autogen index for official/vizier (#1117)
* feat: add autogen index

* fix: missed the REAME

* fix: update autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index
2022-10-05 17:25:04 -07:00
Andrew FerlitschandGitHub 530524ac6e feat: add autogen index for official/training (#1116)
* feat: add autogen index

* fix: missed the REAME

* fix: update autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index
2022-10-05 17:22:17 -07:00
Andrew FerlitschandGitHub ba66961fce feat: add autoindex for official/tensorboard (#1115)
* feat: add autogen index

* fix: missed the REAME

* fix: update autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index
2022-10-05 17:20:06 -07:00
Andrew FerlitschandGitHub aca7035482 add: add autogen index for official/tabular_workflows (#1114)
* feat: add autogen index

* fix: missed the REAME

* fix: update autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index
2022-10-05 17:17:15 -07:00
Andrew FerlitschandGitHub 3d270cde69 feat: add autoindex for official/tabnet (#1113)
* feat: add autogen index

* fix: missed the REAME

* fix: update autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index
2022-10-05 17:14:48 -07:00
Andrew FerlitschandGitHub 9754c265ff feat: add autoindex for official/structured_data (#1112)
* feat: add autogen index

* fix: missed the REAME

* fix: update autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index
2022-10-05 17:09:35 -07:00
Andrew FerlitschandGitHub f5d730c9f1 feat: add autoindex for official/sdk (#1111)
* feat: add autogen index

* fix: missed the REAME

* fix: update autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index
2022-10-05 17:02:06 -07:00
Andrew FerlitschandGitHub acd42a3a1b feat: add autogen index for official/reduction_server (#1110)
* feat: add autogen index

* fix: missed the REAME

* fix: update autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index
2022-10-05 16:58:46 -07:00
Andrew FerlitschandGitHub eb7cf4b6bc feat: add autoindex for official/pipelines (#1109)
* feat: add autogen index

* fix: missed the REAME

* fix: update autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index
2022-10-05 16:54:26 -07:00
Andrew FerlitschandGitHub 34b1011ac9 feat: add autoindex for official/model-registry (#1108)
* feat: add autogen index

* fix: missed the REAME

* fix: update autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index
2022-10-05 16:46:04 -07:00
Andrew FerlitschandGitHub 239d664990 feat: add autogen index for official/model_monitoring (#1107)
* feat: add autogen index

* fix: missed the REAME

* fix: update autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index
2022-10-05 16:43:16 -07:00
Andrew FerlitschandGitHub 920c771238 feat: add autogen index for official/model_evaluation (#1106)
* feat: add autogen index

* fix: missed the REAME

* fix: update autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index
2022-10-05 16:41:01 -07:00
Andrew FerlitschandGitHub e7c68ecb78 fix: autogen index for official/ml_metadata (#1105)
* feat: add autogen index

* fix: missed the REAME

* fix: update autogen index

* feat: add autogen index

* feat: add autogen index

* feat: add autogen index
2022-10-05 16:37:29 -07:00
Andrew FerlitschandGitHub cfeb118d8b feat: add autogen index for official/matching_engine (#1104)
* feat: add autogen index

* fix: missed the REAME

* fix: update autogen index

* feat: add autogen index

* feat: add autogen index
2022-10-05 16:30:00 -07:00
Andrew FerlitschandGitHub 2c9c8db15c feat: add autogen index for official/feature_store (#1103)
* feat: add autogen index

* fix: missed the REAME

* fix: update autogen index

* feat: add autogen index
2022-10-05 16:24:10 -07:00
Andrew FerlitschandGitHub 6778a2cfbf fix: update autogen index for official/automl (#1102)
* feat: add autogen index

* fix: missed the REAME

* fix: update autogen index
2022-10-05 16:14:24 -07:00
Andrew FerlitschandGitHub 26c5d56e6d feat: update autogen index for official/explainable_ai (#1101)
* feat: add autogen index

* fix: missed the REAME
2022-10-05 16:08:41 -07:00
Andrew FerlitschandGitHub 527fe79f15 feat: add autogen index (#1100) 2022-10-05 16:06:38 -07:00
Andrew FerlitschandGitHub 2a003fa9c3 add: autogen index (#1085) 2022-10-05 15:55:29 -07:00
Andrew FerlitschandGitHub 03b9b6026f feat: add index (#1084) 2022-10-05 15:55:09 -07:00
Andrew FerlitschandGitHub ff8d6a9d56 feat: add autogen index (#1083) 2022-10-05 13:21:55 -07:00
Andrew FerlitschandGitHub 874c881ad6 feat: add autogen index (#1080) 2022-10-05 13:21:24 -07:00
Andrew FerlitschandGitHub f484429a89 fix: auto regen index for curated (#1076)
* fix: auto regen index for curated

* fix: bad links
2022-10-05 13:20:22 -07:00
Andrew FerlitschandGitHub 7fa2502c09 PR: bad links and objective (#1099)
* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: bad links and objective

* fix: bad links and objective

* fix: bad links and objective

* fix: bad links and objective

* fix: bad links and objective

* fix: bad links and objective

* fix: bad links and objective

* fix: bad links and objective
2022-10-05 11:13:12 -07:00
Andrew FerlitschandGitHub 056791fadd fix: bad links and objective (#1098)
* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: bad links and objective

* fix: bad links and objective

* fix: bad links and objective

* fix: bad links and objective

* fix: bad links and objective

* fix: bad links and objective

* fix: bad links and objective
2022-10-05 11:10:35 -07:00
Andrew FerlitschandGitHub 154be75dce fix: bad links and objective (#1097)
* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: bad links and objective

* fix: bad links and objective

* fix: bad links and objective

* fix: bad links and objective

* fix: bad links and objective

* fix: bad links and objective
2022-10-05 11:07:09 -07:00
Andrew FerlitschandGitHub ed7e900a02 fix: bad links and objective (#1096)
* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: bad links and objective

* fix: bad links and objective

* fix: bad links and objective

* fix: bad links and objective

* fix: bad links and objective
2022-10-05 11:01:19 -07:00
Andrew FerlitschandGitHub f109fefbfa fix: bad links (#1095)
* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: bad links and objective

* fix: bad links and objective

* fix: bad links and objective

* fix: bad links and objective
2022-10-05 10:54:19 -07:00
Andrew FerlitschandGitHub 6f9c99d1df fix: bad links and objective (#1094)
* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: bad links and objective

* fix: bad links and objective

* fix: bad links and objective

* fix: bad links and objective
2022-10-05 10:49:41 -07:00
Andrew FerlitschandGitHub ed39d78005 fix: bad links and objective conformance (#1093)
* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: bad links and objective

* fix: bad links and objective
2022-10-05 10:25:02 -07:00
Andrew FerlitschandGitHub d6466ab1a6 fix: bad links and objective (#1092)
* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: bad links and objective
2022-10-05 10:15:36 -07:00
Andrew FerlitschandGitHub 65e310e4e6 fix: bad links and objective (#1091)
* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: objective conformance
2022-10-05 10:08:39 -07:00
Andrew FerlitschandGitHub 0e773ba90f fix: bad links and objective (#1090)
* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: objective conformance

* fix: objective conformance
2022-10-05 10:07:35 -07:00
Andrew FerlitschandGitHub 0747f9efb8 fix: objective (#1089)
* fix: objective conformance

* fix: objective conformance

* fix: objective conformance
2022-10-05 09:38:50 -07:00
Andrew FerlitschandGitHub 53785fb812 fix: objective section (#1088)
* fix: objective conformance

* fix: objective conformance
2022-10-05 09:33:13 -07:00
Andrew FerlitschandGitHub b85c24dca5 fix: objective conformance (#1087) 2022-10-05 09:21:49 -07:00
Andrew FerlitschandGitHub ea5c12c22a Autoreview 17 (#1082)
* fix: bad link

* fix: objective
2022-10-04 17:32:04 -07:00
Andrew FerlitschandGitHub 392c1b7361 fix: bad link (#1081) 2022-10-04 17:26:30 -07:00
Andrew FerlitschandGitHub c5980e636e Autoreview 15 (#1079)
* fix: tag handling

* fix: objective

* fix: bad links
2022-10-04 17:08:46 -07:00
Andrew FerlitschandGitHub 8859e9426d fix: tag handling (#1078) 2022-10-04 16:57:34 -07:00
Andrew FerlitschandGitHub db7cc9000a fix: bad links (#1077)
* fix: bad links

* fix: bad links and branding
2022-10-04 16:44:03 -07:00
Andrew FerlitschandGitHub d1fe50a1d9 fix: last tag handling (#1075) 2022-10-04 14:18:22 -07:00
Andrew FerlitschandGitHub 9e3597692f Autoreview text fixes (#1074)
* fix: bad links

* fix: bad links

* fix: objective intro

* fix: objective

* fix: objective statement

* fix: objective statement
2022-10-04 14:07:17 -07:00
Andrew FerlitschandGitHub 45c8deebe5 Autoreview text fixes (#1073)
* fix: bad links

* fix: bad links

* fix: objective intro

* fix: objective

* fix: objective statement
2022-10-04 14:03:10 -07:00
Andrew FerlitschandGitHub 6705c4e4ee Autoreview text fixes (#1072)
* fix: bad links

* fix: bad links

* fix: objective intro

* fix: objective
2022-10-04 13:54:50 -07:00
Andrew FerlitschandGitHub b7f06d948a Autoreview text fixes (#1071)
* fix: bad links

* fix: bad links

* fix: objective intro
2022-10-04 13:20:29 -07:00
Andrew FerlitschandGitHub 7f3c1a9a36 fix: bad links (#1070)
* fix: bad links

* fix: bad links
2022-10-04 13:12:54 -07:00
2e991c5b9d New notebook for PyTorch distributed training on reduction server (#1064)
* feat: added new notebook for PyTorch distributed training on reduction server

* Fixed linter errors

* Addressed review comments

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-10-04 13:07:43 -07:00
Andrew FerlitschandGitHub f8ac68ec10 Autoreview 10 (#1069)
* fix: handling of linkback for web output

* fix: tune markdown output
2022-10-04 13:06:38 -07:00
Andrew FerlitschandGitHub a591c39367 fix: handling of linkback for web output (#1068) 2022-10-04 12:08:46 -07:00
Andrew FerlitschandGitHub d938982aae feat: calculate links for new notebooks (#1065) 2022-10-04 12:08:18 -07:00
1397c9a64a Fixed line break (#1067)
* Added tags, links to corresponding documentation pages

* Fixed line break issue

Co-authored-by: Max Reznitskii <reznitskii@google.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-10-04 11:31:32 -07:00
da97ec2244 Added tags, links to corresponding documentation pages (#1066)
Co-authored-by: Max Reznitskii <reznitskii@google.com>
2022-10-04 11:20:08 -07:00
c3f1f8239b UJ15 Vertex SDK AutoML Object Tracking (#1055)
* resloved tf library issues

* ran linter test

* made review changes

* ran linter test

* made review changes

* ran linter

* made review changes

* linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-10-04 08:51:17 -07:00
Andrew FerlitschandGitHub 73878dcc01 update: support for multi-tags and desc for web output (#1061) 2022-10-04 09:32:20 -04:00
Andrew FerlitschandGitHub 13bad2e6a3 Autoreview readme (#1060)
* fix: re autogen index

* fix: descriptions

* fix: descriptions
2022-10-03 13:24:59 -07:00
Andrew FerlitschandGitHub 0172f2b11b fix: re autogen index (#1059) 2022-10-03 12:39:50 -07:00
Andrew FerlitschandGitHub 1ba0c17555 fix: tuning README output (#1058) 2022-10-03 15:14:32 -04:00
399c961074 Modified notebook chicago_taxi_fare_prediction according to notebook template (#1043)
* error resolved

* ran linter

* andrew comments resolved

* ran linter

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-10-03 08:35:59 -07:00
d44836db9d Modified notebook inventory_prediction (#1041)
* resolved error

* resolved error

* ran linter

* andrew comments resolved

* ran linter

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-10-03 08:34:47 -07:00
4e236fd553 Text classification evaluation (#959)
* Model evaluation for text classification using Automl

* Removed unused library

* Ran Linter Test

* Commented text

* Commented Text

* Ran Linter test

* Made changes suggested in review

* Removed unused import

* Ran Linter Test

* Removed dataflow parameters as mentioned in the review

* Ran Linter Test

* Made review changes and changed notebook links in the beginning of the notebook

* Ran Linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-10-02 13:49:06 -07:00
Andrew FerlitschandGitHub 352b1e2710 fix: error handling improvements (#1053) 2022-09-30 15:40:30 -04:00
13cc94d3b7 feat: Add notebook for Wide & Deep on Vertex Pipelines (#984)
* Add notebook for Wide & Deep on Vertex Pipelines

* Address comments

* Clear output

* Fix deletion logic

* Run linter

* Rename custom_job and hpt_job to pipeline_job

* Use Vertex SDK for deletion instead of gcloud

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-30 09:46:23 -07:00
632362ed80 Modified notebook fraud-detection-model notebook (#1052)
* resolved error

* ran linter

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-30 09:44:45 -07:00
90b5575b0c feat: Add notebook for TabNet on Vertex Pipelines (#726)
* Added notebook for TabNet on Vertex Pipelines

* Added notebook for TabNet on Vertex Pipelines

* Added notebook for TabNet on Vertex Pipelines

* Run linter

* Ran linter

* Ran linter again

* Addressed comments

* Addressed more comments

* Remove parameter definitions, reference documentation, add details under CustomJob/HPT job sections

* Address more comments

* Fix tests

* Bug fix

* Rework TabNet HPT job section

* Addressed more comments

* Update documentation links

* Fix tests

* Fix tests

* Linter and some changes

* Address more comments

* Update CustomJob description to align with documentation

* Use bank-marketing dataset instead of safedriver

* Rename variables

* Rename variables

* Update gcs location to official one

* Changes to make notebook run with updated SDK

* Bug fix

* Rewording

* Fix workbench link

* Update notebook format to align with template

* Fix deletion logic

* Run linter

* Rename custom_job and hpt_job to pipeline_job

* Use Vertex SDK for deletion instead of gcloud

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
Co-authored-by: Ivan Cheung <ivans.mailbox@gmail.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-29 16:58:53 -07:00
2d96cc0af1 Rapid prototyping bqml automl (#877)
* Made changes in accordance with Notebook template

* Ran Linter Test

* Attached UUID to BQ_DATSET and use bq to delete dataset

* Removed unused imports

* Ran Linter Test

* Fixed BQ_DATASET

* Fixed BQ_DATASET

* Ran linter test

* Made review changes

* Removed unused library

* Ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-29 13:17:14 -07:00
aadc80752b UJ6 Vertex SDK AutoML Text Classification (#1039)
* add The links for Colab, Github and Workbench

* added The links for Colab, Github and Workbench

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-29 13:15:10 -07:00
e8745a750b Modified notebook telecom-subscriber-churn-prediction (#874)
* modified notebook telecom-subscriber-churn-prediction.ipynb

* ran linter

* changes suggested by andrew are done

* ran linter

* changes suggested by andrew done

* ran linter

* resolved error

* ran linter

* fixed a monor bug

* ran linter

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-29 13:13:40 -07:00
Andrew FerlitschandGitHub 67b54685be fix: bad link (#1050)
* fix: bad link

* fix: bad link
2022-09-29 12:07:27 -07:00
Andrew FerlitschandGitHub 738dc1e01c fix: bad links (#1049)
* fix: bad link

* fix: bad link
2022-09-29 12:02:54 -07:00
Andrew FerlitschandGitHub 3b481a43a9 fix: bad links (#1048)
* fix: bad links

* fix: bad links
2022-09-29 12:02:08 -07:00
Andrew FerlitschandGitHub 35d0dee5a0 fix: bad link (#1047)
* fix: bad link

* fix: bad link
2022-09-29 11:47:25 -07:00
Andrew FerlitschandGitHub 90a0bb9b4c fix: bad link (#1046)
* fix: bad link

* fix: bad link
2022-09-29 11:47:01 -07:00
Andrew FerlitschandGitHub e59d5462b4 fix: improve args and add webdoc generation (#1045) 2022-09-29 14:15:52 -04:00
Andrew FerlitschandGitHub f94bf3c7e1 fix: bad link (#1044)
* fix: bad links

* fix: bad links
2022-09-29 09:36:59 -07:00
Andrew FerlitschandGitHub dd215b8cf0 corrections to official notebook (#978)
* fix: corrections

* fix: corrections

* fix: missing bq client

* fix: missing bq client

* fix: installs

* fix: installs

* fix: add missing imports

* fix: add missing imports
2022-09-29 09:10:44 -07:00
Andrew FerlitschandGitHub 784c94a72f fix: bad link, title (#1023)
* fix: bad link, title

* fix: bad link, title
2022-09-29 09:10:08 -07:00
Andrew FerlitschandGitHub dccfed9743 fix: broken link (#1033)
* fix: bad link

* fix: bad link
2022-09-29 09:05:29 -07:00
8346855cfe automl_video_classification_model_evaluation (#1035)
* added model evaluation component

* linter test cases

* linter test cases

* model_name param issues resolved

* linter test case

* import issues resloved

* linter test cases

* made review changes

* made review changes

* ran linter test

* made review changes

* made review changes

* made review changes

* linter test

* ran linter test

* made review changes

* ran linter test

* made review changes

* ran linter test

* linter test

* review changes

* ran linter test

* added The links for Colab, Github and Workbench

* added The links for Colab, Github and Workbench

* ran linter test

* added The links for Colab, Github and Workbench

* ran linter test

* added The links for Colab, Github and Workbench

* ran linter test

Co-authored-by: Ivan Cheung <ivans.mailbox@gmail.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-29 09:13:24 -04:00
Andrew FerlitschandGitHub 64ad5123d0 fix: bad link (#1008)
* fix: bad link

* fix: bad link
2022-09-28 19:26:37 -07:00
Andrew Ferlitsch 0025e56323 fix: Objective 2022-09-29 02:23:03 +00:00
Andrew Ferlitsch 8fd9f35aca fix: Objective 2022-09-29 02:22:33 +00:00
Andrew FerlitschandGitHub 658abd6d5b fix: title in link (#1029)
* fix: bad links

* fix: bad links
2022-09-28 18:52:04 -07:00
Andrew FerlitschandGitHub 1243f736e2 fix: bad link (#1007)
* fix: bad link

* fix: bad link
2022-09-28 17:01:53 -07:00
Andrew FerlitschandGitHub dd0b07163f fix: bad links (#1031)
* fix: bad links

* fix: bad links
2022-09-28 16:54:38 -07:00
Andrew FerlitschandGitHub c6b268ba89 fix: bad links (#1028)
* fix: bad links

* fix: bad links
2022-09-28 15:53:01 -07:00
Andrew FerlitschandGitHub fd4f7d2641 fix: bad links (#1030)
* fix: bad links

* fix: bad links
2022-09-28 15:52:39 -07:00
Andrew FerlitschandGitHub 5c513e20c9 fix: parsing links (#1032) 2022-09-28 15:45:15 -07:00
Andrew FerlitschandGitHub d78dba7941 fix: bad links (#1025)
* fix: bad links

* fix: bad links
2022-09-28 15:37:55 -07:00
Andrew FerlitschandGitHub 42fa88547b fix: bad links (#1027)
* fix: bad links

* fix: bad links
2022-09-28 15:33:47 -07:00
Andrew FerlitschandGitHub c4cda29095 fix: bad links (#1026)
* fix: bad links

* fix: bad links
2022-09-28 15:33:25 -07:00
Andrew FerlitschandGitHub 47725449b5 fix: bad link (#1005)
* fix: bad link

* fix: bad link
2022-09-28 15:01:44 -07:00
Andrew FerlitschandGitHub 2eba462437 fix: bad link (#1010)
* fix: bad link

* fix: bad link
2022-09-28 14:31:37 -07:00
Andrew FerlitschandGitHub 97a3f4d3dd fix: add abbr (#1024) 2022-09-28 14:28:34 -07:00
Andrew FerlitschandGitHub 531e567358 fix: bad links (#1009)
* fix: bad link

* fix: bad link
2022-09-28 14:12:58 -07:00
Andrew FerlitschandGitHub 1f7c7105bb fix: link, title, format (#1018)
* fix: link, title, format

* fix: link, title, format
2022-09-28 14:12:29 -07:00
Andrew FerlitschandGitHub b109183d52 fix: bad links (#1011)
* fix: bad link

* fix: bad link
2022-09-28 13:53:45 -07:00
Andrew FerlitschandGitHub 72ed00fe0f fix: bad links (#1012)
* fix: bad link

* fix: bad link
2022-09-28 13:53:27 -07:00
Andrew FerlitschandGitHub e8d9137a50 fix: bad links (#1013)
* fix: bad link

* fix: bad link
2022-09-28 13:52:51 -07:00
Andrew FerlitschandGitHub 872e98c544 fix: bad links (#1014)
* fix: bad link

* fix: bad link
2022-09-28 13:52:17 -07:00
Andrew FerlitschandGitHub 0966fc56a4 fix: bad links, missing title (#1015)
* fix: bad link, missing title

* fix: bad link, missing title
2022-09-28 13:51:56 -07:00
Andrew FerlitschandGitHub e8d1e58fc6 fix: bad link, title (#1016)
* fix: bad link, correct title

* fix: bad link, correct title
2022-09-28 13:50:44 -07:00
Andrew FerlitschandGitHub f73ff8a44f fix: bad link, title (#1017)
* fix: bad link, correct title

* fix: bad link, correct title
2022-09-28 13:49:53 -07:00
Andrew FerlitschandGitHub 48c5810bd7 fix: bad link, title (#1019)
* fix: bad link, title

* fix: bad link, title
2022-09-28 13:49:25 -07:00
Andrew FerlitschandGitHub 9821d8986c fix: bad link, title (#1020)
* fix: bad link, title

* fix: bad link, title
2022-09-28 13:48:57 -07:00
Andrew FerlitschandGitHub 207d5db3e9 fix: bad link, title (#1021)
* fix: bad link, title

* fix: bad link, title
2022-09-28 13:48:29 -07:00
Andrew FerlitschandGitHub 9deb05e3e7 fix: bad link (#1022)
* fix: bad links

* fix: bad links
2022-09-28 13:47:59 -07:00
Andrew FerlitschandGitHub 8dafc25aab fix: bad link (#1006)
* fix: bad link

* fix: bad link
2022-09-28 13:47:25 -07:00
ef10e7db53 Vertex AI Model Registry - AutoML model management notebook (#995)
* new notebook

* linter test passed

* linter test passed

* andy review

* linter test passed

* add codeowner

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-28 09:41:50 -07:00
Andrew FerlitschandGitHub cba907ddf8 fix: tuning the script (#1004) 2022-09-28 12:21:47 -04:00
16c3d7fe25 automl_video_classification_model_evaluation (#960)
* added model evaluation component

* linter test cases

* linter test cases

* model_name param issues resolved

* linter test case

* import issues resloved

* linter test cases

* made review changes

* made review changes

* ran linter test

* made review changes

* made review changes

* made review changes

* linter test

* ran linter test

* made review changes

* ran linter test

* made review changes

* ran linter test

* linter test

* review changes

* ran linter test

Co-authored-by: Ivan Cheung <ivans.mailbox@gmail.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-28 07:33:08 -07:00
60e1f92ef4 Vertex AI Model Registry - BQML and custom model management notebook (#991)
* add new notebook

* linter test passed

* clean text

* linter test passed

* add code owner new model registry notebook

* add more description

* linter test passed

* align with new template

* linter test passed

* andy reviews

* linter test passed

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-28 00:05:41 -07:00
Andrew FerlitschandGitHub fb392c6375 Issue 937 (#998)
* fix: issue 937

* fix: issue 937

* fix: wrong method for service account

* fix: wrong method for service account
2022-09-27 21:33:12 -07:00
b4d10bc5aa Modified SDK_Custom_Training_Python_Package_Managed_Text_Dataset_Tensorflow_Serving_Container.ipynb (#996)
* modified notebook, resolved error and modified notebook according to template

* ran linter

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-27 19:51:55 -07:00
4049250bad chore: Fix Workbench links. (#983)
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-27 15:24:51 -07:00
923db816e1 Added changes such as timestamp, removed colab references, added markup text mentioning usage of flag -q in a command for the file SDK_Custom_Container_Prediction (#503)
* Added changes in notebook

* Ran linter test

* Replaced Timestamp with UUID; Added 'delete-bucket' in cleanup; Added condition for repo creation and few other minor changes

* Ran Linter Test

* Made some minor changes to install packages

* Made minor changes to fix linter failed tests

* ran linter test

* Made some minor changes

* ran linter test

* addresses the review comments: fixes container build steps, license year, updates according to the template

* ran linter test

* removes beta from gcloud to avoid timeouts

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
Co-authored-by: SamyuktaDR <samyukta.dontireddy@springml.com>
Co-authored-by: SamyuktaDR <45586340+SamyuktaDR@users.noreply.github.com>
Co-authored-by: Krishna Chaitanya Movva <krishr2d2@gmail.com>
Co-authored-by: krishr2d2 <krishna.movva@springml.com>
2022-09-27 15:13:29 -07:00
Andrew FerlitschandGitHub 872f1561cd fix: argument handling improvements (#999) 2022-09-27 16:51:41 -04:00
8d7832de6e fix: issue 241479124 (#997)
* fix: issue 241479124

* fix: issue 241479124

Co-authored-by: gericdong <itseric@google.com>
2022-09-27 15:08:10 -04:00
Michael HuandGitHub f840017cda fix: bump gcpc version for bqml arima notebook (#985)
* fix: bump gcpc version for bqml arima notebook

* pr fixes
2022-09-27 11:02:38 -07:00
de3f35b8a6 Modified notebook sdk_automl_tabular_forecasting_batch.ipynb (#896)
* modified notebook

* ran linter

Co-authored-by: Ivan Cheung <ivans.mailbox@gmail.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-26 20:17:58 -07:00
b746bc80d4 Resolves shell-output issue in google_cloud_pipeline_components_model_upload_predict_evaluate.ipynb notebook (#878)
* resolves the shell-output issue + updates the structure based on the template

* ran linter test

* fixes issues from review: textual updates, delete_bucket=False

* ran linter test

Co-authored-by: Ivan Cheung <ivans.mailbox@gmail.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-26 16:27:29 -07:00
2001604d37 Modified pricing-optimization.ipynb (#867)
* modified notebook according to notebook_template.

* ran linter

* Added create dataset step

* ran linter

* replaced hardcoded dataset name with a variable

* ran linter

* changes suggested by nadrew done

* ran linter

* followed prolong lin comments, data cleaning now done in bigquery

* ran linter

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
Co-authored-by: Ivan Cheung <ivans.mailbox@gmail.com>
2022-09-26 15:37:48 -07:00
faa148f66e Bqml vertex model registry (#993)
* Add bqml-vertexai-model-registry notebook

* Run linter

* Add notebook to CODEOWNERS file

* Update the links

* Ran linter again

* Rename bigquey-ml folder to model-registry

* Add bigquery-ml folder

* Moved the notebook

* Deleted folder

* Resolve comments

* Use UUID

* Remove using existing endpoint

* Remove try statement

* Get model sample based on model's name

* Use job.result to check query job status

* Run linter

* Fix dataset not found error by adding region in bq client creation

* Revert changes

* Fix bq bugs

* Run linter

* Resolve comments

* Display dataframe

* Updated the codeowner file

* Updated the links and editted text

* Run linter

* Remove repeated resources

* Run linter

* Resolve comments

* Run linter

* Install pyarrow

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-26 18:22:57 -04:00
f184411666 Create a function to get notebook python version for execution (#828)
* Create a function to get notebook python version for execution

* Inject python version to yaml file

* Fix python version references

* Add python string to python version variable

* add python version extraction script (untested)

* Create a function to get notebook python version for execution

* Inject python version to yaml file

* Fix python version references

* Add python string to python version variable

* Remove one notebook condition

* Remove extra check and use python 3 as default version

* Use python3.9 as default version

* Update python version notebook parser

* Add python version to the notebook template

* Fix bug

* Update python version parser function

* Add python version to a notebook for testing

* Run linter

* Use regex in python version parser function

* Add new notebook for testing

* Use better variable name

* fix typo

* Use f string instead +

* Use python from env instead of using _PYTHON_VERSION

* Use simpler regex

* Add python version test notebook

* Fixed a mistake

* Updated notebook template with python version

* Fixed python version format

* Print log contents to stdout

* Remove failing notebook

* Run linter

* Remove extra steps in the printed log

* Edit comments

* Run linter

* Run linter

* Revert test changes

Co-authored-by: AG Sol <aarongabriel@google.com>
2022-09-26 14:32:53 -07:00
bdad774100 Vertex SDK AutoML Text Sentiment Analysis (#824)
* new changes for sentiment analysis notebook

* new changes for sentiment analysis notebook

* changed back to year 2021 text

* changed back to year 2021 text

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-25 08:37:58 -07:00
9abe9a643b Added Custom tabular regression model evaluation file (#942)
* added file

* removed unnecessary imports

* ran linter

* removed extra batch prediction component

* ran linter

* moved file to official

* changed links to point to official

* ran linter

* Jason comments addressed

* ran linter

* comments addressed

* ran linter

* comments addresed

* ran linter

* added predictionschema instance schema files

* ran linter

* Followed Karen Lin's comments

* ran linter

* replaced old prebuilt containers with latest ones

* ran linter

Co-authored-by: Ivan Cheung <ivans.mailbox@gmail.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-24 11:12:06 -07:00
ab230ca06f add fixes to sdk-feature-store.ipynb (formatting, link edits) (#913)
* fix sdk-feature-store.ipynb Workbench link

* adding changes

* fixing links

* lint issues:

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-24 09:37:06 -07:00
dcbd3702d2 Made uuid changes and cleaned Uj6 vertex sdk auto ml text classification notebook (#904)
* Made some minor changes to notebook

* Ran linter test

* Ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-24 09:03:11 -07:00
0505d0c04c Vizier sdk (#981)
* update: replace GAPIC with SDK

* update: replace GAPIC with SDK

Co-authored-by: gericdong <itseric@google.com>
2022-09-23 16:27:36 -04:00
a47e0aacbb Model monitor batch (#980)
* fix: batch monitoring notebook

* fix: batch monitoring notebook

Co-authored-by: gericdong <itseric@google.com>
2022-09-23 15:10:54 -04:00
15912adeaf Update the vizier sample to replace the gapic library with new Vertex Vizier SDK. (#979)
* Update the vizier codelab to replace the gapic library with new Vertex Vizier SDK.

* Added the [project_id] and [region] in the parameter field.

* Fixed the lint errors for vizier sample.

Co-authored-by: Ivan Cheung <ivans.mailbox@gmail.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-23 11:12:28 -07:00
Ivan NardiniandGitHub 35fdba7e1c Vertex AI Experiments - Title fix (#982)
* title fix

* linter test passed
2022-09-23 07:17:58 -07:00
f403fa9051 Made UUID changes for Sdk automl tabular regression batch bq (#976)
* Made UUID changes

* Ran lintertest

Co-authored-by: Ivan Cheung <ivans.mailbox@gmail.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-22 14:45:45 -07:00
0d346b136e Vertex AI Experiments - Comparing local trained models notebook - update (#971)
* clean and update comparing_local_trained_models based on feedback

* linter test passed

* fix libraries

* linter test passed

* andy review fixes

* linter test passed

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-22 12:21:22 -07:00
Andrew FerlitschandGitHub 60d71d29cc update: add explain example (#974) 2022-09-22 09:35:13 -07:00
28c872f4b6 chore(deps): update python docker tag to v3.10 (#977)
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-21 17:09:31 -07:00
Andrew FerlitschandGitHub c637d693b7 tune: pricing, branding, combining text cells (#966)
* tune: pricing, branding, combining text cells

* fix: lint
2022-09-21 13:20:01 -07:00
Andrew FerlitschandGitHub 5c3a216eb7 feat: Add notebook for automl text model online predict (#973) 2022-09-21 14:34:10 -04:00
Ivan CheungandGitHub 0b7831b0f4 Added Dockerfile for linter (#975)
Updated Dockerfile
2022-09-21 09:26:42 -07:00
Andrew FerlitschandGitHub 6a6f077ae4 update: add explain (#972) 2022-09-20 18:40:49 -04:00
Andrew FerlitschandGitHub 27f0a4bb63 feat: notebook for automl tabular online serving (#961)
* feat: notebook for automl tabular online serving

* feat: notebook for AutoML tabular model online prediction

* updates: add explain
2022-09-20 12:54:46 -07:00
1476453603 Moves Sentiment-Analysis notebook from community to official folder (#868)
* moves the sentiment_analysis notebook from community to official folder after making the updates

* removes unused modules

* ran linter test

* updates the dataset's GCS links and notebook links in the heading

* ran linter test

* fixes the typo(=)

* ran linter test

* removes wait() calls and IS_TESTING condition

* ran linter test

Co-authored-by: Ivan Cheung <ivans.mailbox@gmail.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-20 07:35:15 -07:00
dbafcb47ea Modified notebook UJ4 Vertex SDK AutoML Tabular Binary Classification (#891)
* modified notebook

* ran linter

* tensorflow was used only for file reading.So replaced tensorflow with pandas

* ran linter

* made text changes

* ran linter

* latest andrew domments addressed

* ran linter

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-19 14:46:22 -07:00
f20700f25a Model monitoring (#964)
* Changed protobuf version

* ran linter test

* Cleared execution outputs

* Ran Linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-19 11:31:01 -07:00
Andrew FerlitschandGitHub d1ca1cd7f8 fix: reported issues (#968) 2022-09-19 14:11:56 -04:00
Andrew FerlitschandGitHub 9b03fb7f8e fix: install issues (#969) 2022-09-19 09:43:07 -07:00
aac271eacc Sdk metric parameter tracking for custom jobs (#844)
* Replaced timestamp with UUID

* Ran Linter test

* Removed local kernel from metadata

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
Co-authored-by: Ivan Cheung <ivans.mailbox@gmail.com>
2022-09-16 11:43:45 -07:00
68b53e0d32 UJ11 Vertex SDK Hyperparameter Tuning (#957)
* library issues resolved

* library issues resolved

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-16 11:02:37 -07:00
Andrew FerlitschandGitHub bf354adfd3 fix: filename consistency (#952)
* fix: filename consistency

* fix: package name
2022-09-16 09:56:02 -07:00
Andrew FerlitschandGitHub 55ad5701e4 fix: pip dependency fixes (#965) 2022-09-16 12:51:05 -04:00
Andrew FerlitschandGitHub 918564dcc7 fix: missing delete dataset (#963) 2022-09-16 12:44:17 -04:00
19b3b5da0f Add Vertex AI hyperparameter tuning notebook for R using custom containers (#958)
* add unfinished notebook on hpt using R

* clear output

* add working version of notebook

* finish R HPT notebook

* update CODEOWNERS

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-15 08:37:16 -07:00
2bdab9a9b8 Fix export_additional_model_without_custom_ops argument in AutoML Tabular Workflows notebook (#914)
Co-authored-by: Helin Wang <helin@google.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-15 08:09:25 -07:00
Andrew FerlitschandGitHub 88e5d5d236 feat: notebook for automl image online prediction (#953) 2022-09-14 15:20:56 -04:00
Andrew FerlitschandGitHub 79730d191f fix: add details on dataset input formats (#951) 2022-09-13 18:43:08 -04:00
Andrew FerlitschandGitHub 019040e4cb fix: links (#950) 2022-09-13 15:15:43 -04:00
Andrew FerlitschandGitHub 4fd3514d6d feat: add index to batch features/notebooks (#949) 2022-09-13 14:29:46 -04:00
Andrew FerlitschandGitHub bb17381b03 fix: detecting copyright cell (#948) 2022-09-13 11:14:19 -07:00
Andrew FerlitschandGitHub 3f06f48282 fix: filename rename (#943)
* fix: filename rename

* fix: lint issues
2022-09-13 10:01:22 -07:00
33abd1e427 Move model evaluation notebooks from community to official (#940)
* Add automl regression model eval first draft

* Remove extra file

* Pring evaluation results

* adds the automl-tabular-classification notebook in model_evaluation folder

* removes unnecessary imports

* adjusts the imports inside the pipeline

* adjusts the imports

* elaborates imports inside pipeline

* modified regression notebook

* renamed pipeline displayname to resolve error

* Add automl regression model eval first draft

* Remove extra file

* Pring evaluation results

* modified some text

* added suggested updates from review: remove dataflow params, add/change textual descriptions, add UUID

* removes the output from the notebooks

* removes the extra matplotlib import

* ran linter test

* addressed soheila's comments

* ran linter

* addresses the review comments

* ran linter test

* removes the artifacts comment

* ran linter test

* reviewed comments

* ran linter

* addresses review comments: textual updates, removes unnecessary parameters

* ran linter test

* addressed comments

* ran linter

* removed unwanted variables

* ran linter

* addresses the tech-writer's comments + updates the pipeline image with data-sampler task

* ran linter test

* Update text

* Move model eval folder to official

* Update CODEOWNERS

* Run linter

* Removed problem_type parameter

* Run linter

* addresses Andrew's review comments: textual updates and removes additional gcpc installation

* ran linter test

* comments addressed

* ran linter

* removed trailing comma on last parameter of trainingjob.run

* ran linter

Co-authored-by: krishr2d2 <krishna.movva@springml.com>
Co-authored-by: sudarshan-SpringML <sudarshan.c@springml.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-13 09:28:16 -07:00
Peter PingandGitHub 1d9bfe9934 Stream Update v2 (#946)
* Stream Update v2

* correct codeowner name
2022-09-12 18:24:53 -04:00
fb9defa985 Merge to sparkml branch (#881) (#882)
* Merge to sparkml branch (#881)

* feat: initial commit

* feat: WIP

* feat: still WIP, need to work on EDA

* fix: change name, still WIP

* fix: initial draft

* install geopandas in the notebook

* fix: add codeowners

* fix: install pyarrow

* fix: add condition for testing env

* fix: indentation

* fix: add dependencies for gpd

* fix: install seaborn

* fix: isort and codeowner

* fix: description

* fix: add debriefing the result

* fix: decrease sample size for testing

* fix: code review wip

* fix: code review

* fix: change dataset to 2017

* fix: code review

* fix: not using sql

* fix: lint

* fix: delete outputs

* fix: code review

* fix: typo

* fix: make sample pandas df if not testing

* Update spark_ml.ipynb (#884)

(Tech writer edit) Editing for syntax and clarification.

* small text updates

* lint fixes

* constraining plotting to non-test environments

* lint fixes

* put plotting back into tests

* address review feedback

* added comment to rerun cell if URLError thrown

Co-authored-by: Hyunuk Lim <hyunuklim@google.com>
Co-authored-by: aman-ebay <amancuso@google.com>
2022-09-12 17:28:09 -04:00
Soheila ZangenehandGitHub 824fb689e4 Bqml vertex model registry (#945)
* Add bqml-vertexai-model-registry notebook
2022-09-12 16:44:46 -04:00
Andrew FerlitschandGitHub c48dd8662b Issue 235883443 (#944)
* fix: remove obsoleted case

* fix: remove obsoleted case
2022-09-12 15:49:52 -04:00
gericdongandGitHub f251721d23 Enable Cloud Resource Manager API (#939)
* Enable Cloud Resource Manager API

* Reformatted file
2022-09-09 14:05:36 -07:00
Andrew FerlitschandGitHub e949eb128f fix: autoreview of mlops notebooks (#936)
* fix: tune for autoreview

* fix: tune for autoreview
2022-09-09 12:02:50 -04:00
df48e74f59 feat: Batch prediction for custom text model (#934)
* feat: notebook for custom text model batch prediction

* feat: notebook for custom text model batch prediction

Co-authored-by: gericdong <itseric@google.com>
2022-09-09 09:26:13 -04:00
MarcandGitHub ce9e6ecf62 add back pip install of xai sdk (#935) 2022-09-09 01:02:56 +01:00
9ab5f4274a Add automl regression and classification with model evaluation (#911)
* Add automl regression model eval first draft

* Remove extra file

* Pring evaluation results

* adds the automl-tabular-classification notebook in model_evaluation folder

* removes unnecessary imports

* adjusts the imports inside the pipeline

* adjusts the imports

* elaborates imports inside pipeline

* modified regression notebook

* renamed pipeline displayname to resolve error

* Add automl regression model eval first draft

* Remove extra file

* Pring evaluation results

* modified some text

* added suggested updates from review: remove dataflow params, add/change textual descriptions, add UUID

* removes the output from the notebooks

* removes the extra matplotlib import

* ran linter test

* addressed soheila's comments

* ran linter

* addresses the review comments

* ran linter test

* removes the artifacts comment

* ran linter test

* reviewed comments

* ran linter

* addresses review comments: textual updates, removes unnecessary parameters

* ran linter test

* addressed comments

* ran linter

* removed unwanted variables

* ran linter

* addresses the tech-writer's comments + updates the pipeline image with data-sampler task

* ran linter test

Co-authored-by: krishr2d2 <krishna.movva@springml.com>
Co-authored-by: sudarshan-SpringML <sudarshan.c@springml.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-08 14:42:04 -07:00
Andrew FerlitschandGitHub 29e584a422 feat: add batch automl video notebook (#933)
* feat: batch for automl video

* feat: batch for automl video

* feat: batch for automl video
2022-09-08 11:34:29 -07:00
MarcandGitHub beabb87cff fix import problem described in b/245553683 (#932)
* fix aiplatform import problem

* lint fix

* build fix, missing tensforflow

* lint fixes
2022-09-08 16:47:20 +01:00
e3f6717ff6 community -> official for bqml-online-prediction.ipynb (#788)
* move bqml-vertex notebook from community to official

* add to CODEOWNERS official

* fix errors for execution-test

* fix project_id line

* fix linting

* fixes re: comments from sarahcdugan

* fix links at top of notebook from community/ to official/

* added UUID to model name

* fix linting

* fix error in TIMESTAMP --> UUID

* fixing linting double space

* fixes re: ivanmkc comments

* fixed notebook after linting issues

* linting via cloud shell

* simplified run_bq_query function

* linting

Co-authored-by: Ivan Cheung <ivans.mailbox@gmail.com>
2022-09-07 18:20:02 -04:00
fd30c4014a Minor fixes for CPR Pytorch sample (#744)
* Minor fixes for CPR Pytorch sample: Add missing test data, add auth info to readme, scrub private project and bucket names from config, tolerate missing config.json in unit tests.

* Minor fixes for CPR Pytorch sample: Add missing test data, add auth info to readme, scrub private project and bucket names from config, tolerate missing config.json in unit tests.

* Fix merge conflicts

* fix typo

* Point CPR links to main branch of SDK repo.

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-07 13:02:55 -07:00
Andrew FerlitschandGitHub 4be8b0a59a fix: finetuning of batch notebooks (#930)
* fix: fine-tuning

* fix: fine-tuning
2022-09-07 10:44:44 -07:00
Andrew FerlitschandGitHub aa09d46265 feat: batch prediction for AutoML text models (#929)
* feat: Automl text model batch predict

* feat: Automl text model batch predict

* feat: Automl text model batch predict
2022-09-07 13:14:16 -04:00
Andrew FerlitschandGitHub 5667967131 feat: add BQ input example (#926)
* feat: add notebook for custom tabular batch predict

* feat: add notebook for custom tabular batch predict

* feat: add example for BQ input

* feat: add example for BQ input

* feat: add example for BQ input

* feat: add example for BQ input
2022-09-07 08:38:36 -07:00
4e4f532658 feat: batch prediction for automl tabular models (#928)
* feat: notebook for AutoML tabular batch prediction

* feat: notebook for AutoML tabular batch prediction

Co-authored-by: gericdong <itseric@google.com>
2022-09-06 15:53:54 -04:00
Andrew FerlitschandGitHub 14b2ce4f2e feat: notebook for batch predict for automl image models (#927)
* feat: batch predict for automl image model

* feat: batch predict for automl image model
2022-09-06 11:45:04 -04:00
Chun-Hsiang WangandGitHub c14b98c92d samples: Minor fix for the wording. (#924) 2022-09-05 10:42:25 -07:00
8275ea6c49 fix: correct the download_url (#923)
* fix: correct the download_url

* fix: fixed formatting issue

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-02 17:04:42 -04:00
40fbffcc95 Sdk automl image object detection batch (#869)
* changed to andrew comments

* changes according to andrew comments

* changes according to andrew comments

* review changes

* review changes

* review changes

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-02 13:34:25 -07:00
Andrew FerlitschandGitHub 08bb513488 feat: Batch prediction for custom tabular model (#920)
* feat: add notebook for custom tabular batch predict

* feat: add notebook for custom tabular batch predict
2022-09-01 20:33:34 -04:00
Chun-Hsiang WangandGitHub b298f83cd3 Vertex Prediction PyTorch Experimental: Add a sample for pre-built PyTorch deployments. (#898)
* samples: Add a new sample for pre-built Pytorch deployments. It's
borrowed from the examples in community-content/pytorch_text_classification_using_vertex_sdk_and_gcloud.

* samples: Removed all training related stuff in the notebooks.

* samples: Fixed comments.

* samples: Updated readme.

* samples: Updated emails for Pytorch launch.
2022-09-01 11:48:59 -07:00
Andrew FerlitschandGitHub 659cbb54c4 feat: add model monitoring with custom container (#919)
* feat: add notebook using custom deployment container

* feat: add notebook using custom deployment container
2022-09-01 10:22:05 -07:00
6ddcaa540a fix: tf serving workaround (#917)
* fix: pin TF serving image

* fix: pin TF serving image

Co-authored-by: gericdong <itseric@google.com>
2022-09-01 12:58:27 -04:00
1656c57b18 feat: extend image batch notebook (#916)
* feat: add notebook for custom image model batch prediction

* feat: add notebook for custom image model batch prediction

* fix: review comments

* fix: review comments

* feat: extend image batch notebook

* feat: extend image batch notebook

Co-authored-by: gericdong <itseric@google.com>
2022-09-01 09:56:36 -07:00
6cac60f74a Sdk feature store ver1 (#790)
* Added condition to create Featurestore if it doesn't exist

* Ran Linter Test

* Made changes mentioned in review

* Ran Linter Test

* Attached uuid to featurestore_id to avoid error while creating featurestore with existing name

* Ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-09-01 08:57:16 -07:00
Andrew FerlitschandGitHub 55e37f795c feat: notebook for batch prediction with custom image model (#915)
* feat: add notebook for custom image model batch prediction

* feat: add notebook for custom image model batch prediction

* fix: review comments

* fix: review comments
2022-08-31 10:38:31 -07:00
c030d7ef74 use dataset instead of datasets (#892)
less chance for an error and confusion in name clashing with the `datasets` pypi package also used in the notebook.

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-31 07:44:46 -07:00
Andrew FerlitschandGitHub 96be449c69 feat: add notebook for MM autoML (#912)
* feat: model monitoring for AutoML

* feat: model monitoring for AutoML

* fix: correction on AutoML

* fix: correction on AutoML
2022-08-30 12:45:45 -07:00
e40ddab4d5 Upgrade to DataprocPySparkBatch v1 component and add Vertex AI placeholder features (#910)
* Fix typo in notebook heading.

* Fix linting issues.

* Use gcpc v1 components and use Vertex AI for model upload and serving.

* Notebook cleanup

* Minor heading cleanup

* Fix linting issues

* Fix linting issues

* Fix linting issues

* Fix linting issues

Co-authored-by: Win Woo <wwoo@google.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-30 10:46:21 -07:00
Michael HuandGitHub d02bc2d56b pin arima notebook dependencies (#905)
Pins the versions of packages installed in the notebook in anticipation for a breaking change to the GCPC package.
2022-08-29 19:35:54 -04:00
76b641b23d fix: private endpoint example (#909)
* fix: remove gcloud usage

* fix: remove gcloud usage

* fix: review comments

* fix: review comments

Co-authored-by: nayaknishant <nishantnayak@google.com>
2022-08-29 12:16:18 -07:00
Andrew FerlitschandGitHub bbf4345e76 fix: remove Pantheon links (#908)
* fix: issue 194103604

* fix: issue 194103604
2022-08-28 11:24:32 -04:00
058358a795 Vertex SDK AutoML Image Object Detection (#808)
* new notebook Vertex SDK AutoML Image Object Detection

* new notebook Vertex SDK AutoML Image Object Detection

* new notebook of Vertex SDK AutoML Image Object Detection

* new notebook of Vertex SDK AutoML Image Object Detection

* linter test

* linter test

* andrew commented changes

* andrew commented changes

* review changes

* review changes

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-26 15:56:46 -07:00
Andrew FerlitschandGitHub 1c2f75f680 update: GetVertexModelOp (#907)
* update: use GetVertexModelOp

* update: use GetVertexModelOp
2022-08-26 12:12:09 -07:00
Andrew FerlitschandGitHub 999866fad1 feat: model monitoring custom (#906)
* feat: notebook for custom models

* feat: notebook for custom models

* fix: refining

* fix: refining

* fix: review updates

* fix: review updates
2022-08-26 08:58:54 -07:00
89f4571a2c Create explore_data_in_bigquery_with_workbench.ipynb (#885)
* Create explore_data_in_bigquery_with_workbench.ipynb

Adding in notebook for exploratory data analysis as part of "Data to AI" effort. See this Colab for what this notebook looks like after it is run: https://colab.research.google.com/drive/1JeNeMtj2A_5P5vo9wxSkrwHQM5JQSoAu. Submitting it with outputs shown since a lot of this about interactive visualization, which can inspire folks to use/read the notebook beyond just the code.

* Update CODEOWNERS

Adding owner for forthcoming exploratory data analysis notebook

* Update CODEOWNERS

* Updating exploratory data analysis notebook with latest updates from linter/review

* Updated notebook formatting to try to pass format test

* Trying again to pass notebook formatting test

* Trying again to pass notebook formatting test

* Trying again to pass notebook formatting test

* Linted version of notebook & better project picker

* Uploading linted version from ivanmkc@

* Update CODEOWNERS with EDA notebook

* Updated notebook w/ Tech Writer edits, re-ran all

* 1-2 minor text updates, try to pass linter again

* Trying w/ updated linted file from ivanmkc@

Co-authored-by: Ivan Cheung <ivans.mailbox@gmail.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-26 08:46:17 -07:00
eaff81fd97 New Build model experimentation lineage with prebuild code (#785)
* new changes of build model notebook

* new changes of build model notebook

* linter test issues

* linter test issues

* review changes

* review changes

* review changes

* review changes

* review changes

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-26 08:42:15 -07:00
976ed94cf2 metrics_viz_run_compare_kfp (#847)
* added new cell for is_colab condition

* added new cell for is_colab condition

* changes andrew comments

* changes andrew comments

* review changes

* review changes

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-26 08:26:58 -07:00
haomengchaoandGitHub 8ab8ef9ca9 update featurestore api version (#861)
* update api version

* fix tests

* remove unused import

* Run lint to format the change
2022-08-25 10:05:45 -07:00
eaff80a920 Fraud detection notebook2 (#821)
* Made minor changes

* Ran linter test

* Made changes mentioned in the review

* Ran Linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-25 09:49:24 -07:00
Andrew FerlitschandGitHub 8646285c26 fix: fine-tuning (#902)
* feat: new mm notebook

* feat: new mm notebook

* fix: fine-tuning

* fix: fine-tuning

* fix: review comments

* fix: review comments

* fix: review comments

* fix: review comments
2022-08-25 08:34:34 -07:00
7cad8680e1 Sdk automl tabular binary classification batch explain (#829)
* Changed prediction_output format from csv to jsonl to support generate_explanations

* ran linter test

* Made the changes as mentioned in the review

* Ran Linter Test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-25 08:05:21 -07:00
4f66324883 Google cloud pipeline components automl tabular (#843)
* Removed try except blocks from cleanup section

* Ran Linter test

* Made changes mentioned in review and removed globals

* Removed an unused variable

* Ran Linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-24 21:55:50 -07:00
468fd144d2 New auto ml tabular classification bean (#787)
* new notebook of classification beans

* new notebook of classification beans

* changes on andrew comments

* changes on andrew comments

* json file issues

* json file issue

* fixes issues from reviews: adds parameter descriptions, fixes clean up, textual updates and replaces gapic functionality

* ran linter test

* adds the missing machine-type parameter

* ran linter test

* retreives the metrics using dict method

* removes unused variables

* ran linter test

* replaces old code for resource-name with new one

* ran linter test

* updates fetching the resourceName from the training artifacts

* ran linter test

* adds wait method for endpoint deployment

* ran linter test

* removes the wait method

* ran linter test

* adds wait gcp resources component

* ran linter test

* updates colab link, removes wait component, sets force to true in delete endpoint step

* ran linter test

* adds endpoint.wait() method

* ran linter test

* moves model deletion down the endpoint deletion and removes endpoint.wait() method

* ran linter test

Co-authored-by: Krishna Chaitanya Movva <krishr2d2@gmail.com>
Co-authored-by: Krishna Chaitanya Movva <krishna.movva@springml.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-24 13:30:48 -07:00
Rosie ZouandGitHub 2503c3411c chore: fix typo in notebook (#900)
This fix was previously made by Yang Pan in https://github.com/googleapis/python-aiplatform/pull/1437 but closed due to the notebook being moved out of the main Vertex SDK repo.
2022-08-24 11:03:22 -07:00
Andrew FerlitschandGitHub 94b27550e8 feat: model monitor notebook (#899)
* feat: new mm notebook

* feat: new mm notebook
2022-08-24 08:56:18 -07:00
Soheila ZangenehandGitHub 3542e0b0a3 Add bqml vertexai model registry notebook (#842)
* Add bqml-vertexai-model-registry notebook

* Run linter

* Add notebook to CODEOWNERS file

* Update the links

* Ran linter again

* Rename bigquey-ml folder to model-registry

* Add bigquery-ml folder

* Moved the notebook

* Deleted folder

* Resolve comments

* Use UUID

* Remove using existing endpoint

* Remove try statement

* Get model sample based on model's name

* Use job.result to check query job status

* Run linter

* Fix dataset not found error by adding region in bq client creation

* Revert changes

* Fix bq bugs

* Run linter

* Resolve comments

* Display dataframe

* Updated the codeowner file
2022-08-24 10:58:46 -04:00
Andrew FerlitschandGitHub 5cf3b64618 fix: add BQ batch format info (#895)
* fix: add more info on BQ batch format

* fix: add more info on BQ batch format
2022-08-23 09:56:04 -07:00
885bfd56e5 Vertex AI Pipelines - Dataproc Serverless components - Notebook review (#866)
* review dataproc serverless notebook

* linter passed

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-23 09:44:34 -07:00
3a5eec64af Vertex AI Experiments - Compare pipeline runs - Notebook review (#854)
* experiments cuj1 review

* linter test passed

* typo

* linter test passed

* add correct library. add IAM roles

* linter test passed

* minor fix

* linter test passed

* add api

* linter test passed

* remove library

* linter test passed

* fix

* linter passed

* check

* linter passed

* add text

* linter passed

* minor changes

* andy reviews

* linter passed

* fix link. fix warnings

* linter passed

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-23 07:57:41 -07:00
8cdc7f1f79 Modified notebook multi_node_ddp_gloo_vertex_training_with_custom_container.ipynb (#886)
* modified notebook according to template

* ran linter

Co-authored-by: gericdong <itseric@google.com>
2022-08-22 10:57:24 -04:00
Ivan CheungandGitHub 84fd10f408 fix: Fixed kernel spec by forcing it to use python3 (#889) 2022-08-19 18:43:07 -07:00
Andrew FerlitschandGitHub 7804c860c5 fix: replace tabs with spaces in JSON template (#888)
* fix: replace tabs with spaces in JSON template

* fix: replace tabs with spaces in JSON template
2022-08-19 11:11:08 -07:00
Andrew FerlitschandGitHub ed0c1c74a6 fix: typo in serving_container_uri parameter (#887) 2022-08-19 08:49:12 -07:00
Andrew FerlitschandGitHub 5127a59e92 Model monitoring (#883)
* fix: notebook template tuning

* fix: notebook template tuning

* fix: possible confusion on when to wait for the email notification

* fix: possible confusion on when to wait for the email notification
2022-08-19 08:38:29 -07:00
d8df732d6b Replace GAPIC with SDK - Model Monitoring Notebook (#879)
* Replace GAPIC with SDK

* Run linter

* Remove unused variables

* Run linter

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-18 11:41:11 -07:00
9c10899db8 AutoML Video Classificaton (#871)
* changes according to andrew review comments

* changes according to andrew review comments

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-18 07:25:14 -07:00
Ivan NardiniandGitHub 80770188ec Vertex AI Experiments - Model training - Notebook review (#853)
* experiments cuj1 review

* linter test passed

* add IAM role

* linter test passed

* add rm local dir

* linter test passed

* add api

* linter test passed

* remove libraries

* linter test passed

* solve build error

* fix issue

* clean

* linter passed

* fix dependency

* linter passed

* add dependency

* linter passed

* add dependency

* linter passed

* delete bucket flag fix

* linter passed
2022-08-17 10:43:34 -04:00
fa91e45018 Adds the updated managed_notebooks/predictive_maintenance notebook to the official folder (#521)
* adds the updated predictive-maintenance (managed)notebook from community to official folder

* ran linter test

* resubmitting during phase2

* ran linter test

* addresses the review comments: updates based on the new template, sets delete_bucket to False

* ran linter test

* replaces timestamp with uuid

* ran linter test

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-16 09:39:07 -07:00
fa27309134 Fixes the issues from the regression tests (#822)
* fixes tensorflow version, replaces timestamp with uuid, adds service-account and minor textual changes

* removes second defnition of random library

* ran linter test

* uncomments the user flag and updates the installation command

* ran linter test

* removes the extra backslash

* ran linter test

* updates the installation step to fix long running compatibility checks

* ran linter test

* updates the METADATA path during installation steps

* ran linter test

* adds google-api-core version in the installation

* ran linter test

* removes METADATA step during installation

* ran linter test

* updates google api-core & auth versions

* ran linter test

* fixes tensorflow version, replaces timestamp with uuid, adds service-account and minor textual changes

* removes second defnition of random library

* ran linter test

* uncomments the user flag and updates the installation command

* ran linter test

* removes the extra backslash

* ran linter test

* updates the installation step to fix long running compatibility checks

* ran linter test

* updates the METADATA path during installation steps

* ran linter test

* adds google-api-core version in the installation

* ran linter test

* removes METADATA step during installation

* ran linter test

* updates google api-core & auth versions

* ran linter test

* fixes the issues from review: cell descriptions, parameter definitions, tense changes, 3rd person --> 2nd person, list model after pipeline run

* ran linter test

* removes the METADATA hack and updates the installations

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-16 09:11:30 -07:00
udaypunnaandGitHub 7b85f76384 custom_model_training_and_batch_prediction (#873)
* changed based on andrew review comments

* changed based on andrew review comments

* import library issues

* import library issues

* import issues

* import issues
2022-08-16 08:40:33 -07:00
40a0477b08 modified notebook automl-text-classification.ipynb (#757)
* modified notebook

* modified notebook

* added new notebook

* added new notebook

* new auto_ml_text_classifiation

* new auto_ml_text_classifiation

* new automl text classification

* linter test

* linter test

* changes on andrew comments

* changes on andrew comments

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-15 17:53:52 -07:00
839c7dddb8 Vertex AI Experiments - Compare Models - Notebook review (#852)
* experiments cuj1 review

* linter test passed

* typo

* linter test passed

* add andy reviews

* linter test passed

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-15 09:49:50 -07:00
Andrew FerlitschandGitHub 578cfb7da7 fi: Issue 850 (#863)
* fix: add missing end_run() for experiment

* fix: add missing end_run() for experiment
2022-08-15 08:57:07 -07:00
Ivan CheungandGitHub b129c0bf43 Update CODEOWNERS (#864)
Use proper Github username.
2022-08-12 17:21:39 -04:00
07b4c37135 Automl links fix (#742)
* fixing links to open notebook - main and images

* linter test changes

* fixes the papermill execution error(hard-coded bucket link was the cause)

* ran linter test

* adds minor textual changes

* ran linter test

* fixes issues from review: future tense, copyright year, section placement, latest sdk methods, new updates from the template

* ran linter test

Co-authored-by: Manuel Amunategui <manuel.amunategui@springml.com>
Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-12 12:34:53 -07:00
f48fb1c650 Modified file churn_prediction_for_game_developers (#809)
* made changes

* made changes

* ran linter test

* made changes

* ran linter

* made changes

* ran linter

* changes suggested by andrew done

* ran linter

* replaced timestamp with uuid

* ran linter

* changed bucket creation command according to template

* ran linter

* changed text in overview

* changed region cell from markdown to code

* made changes

* replaced dataset from constant to a variable

* replaced constant dataset_id with a variable

* ran linter

* changed suggested by andrew done

* ran linter

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-12 08:40:38 -07:00
3bbd59311c Made UUID Changes to SDK_BigQuery_Custom_Container_Training.ipynb (#849)
* MAde UUID changes

* Ran Linter test

* made some minor changes

* Ran Linter Test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-12 08:08:32 -07:00
Krishna Chaitanya MovvaandGitHub 15bb4cea73 Fixes the issues(missing variable) from regression tests, adds minor updates from the template. (#823)
* adds the missing delete_bucket variable, adds steps to configure SERVICE_ACCOUNT

* removes unnecessary random import

* ran linter test

* removes the src folder dependency to run on Colab, adds the pipeline.wait step, updates the cleanup steps

* ran linter test

* fixed issues from review: section posistions, tense changes, section descriptions, template updates

* ran linter test
2022-08-12 08:07:11 -07:00
Andrew FerlitschandGitHub 1511cc9fd1 fix: branding updates from autoreview (#862)
* autoreview: branding fixes

* fix: improve installation detection

* cleanup: rm tmp file

* fix: lint issues

* fix: 2nd try at lint fixes
2022-08-11 18:32:47 -07:00
2885a7a70f Migrated matching engine notebook to official and added VPC network support to CI (#836)
* Added matching engine notebook official

* Ran linter

* Added matching engine to .cloud-build/test_notebook_vm.txt

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-11 18:30:22 -07:00
ea36f5c43e Vertex SDK Custom Image Classification with pre-built training container (#833)
* new notebook of custom image classification

* new notebook of custome image classification

* andrew commented changes

* andrew commented changes

* andrew commented changes

* andrew commented changes

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-11 14:58:49 -07:00
a905a6305f fixed cleanup cell, cosmetic and doc improvements, and removed load test (to avoid flakiness), (#859)
* fix cleanup cell and print out more info on xai prediction test

* lint fix

* remove load test

* lint fixes

* lint fix

* fix andrews comments

* lint fix

* missing newline

* lint fixes

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-11 14:04:28 -07:00
Ivan CheungandGitHub aeaeddcc75 Update PULL_REQUEST_TEMPLATE.md (#860)
Updated PR template to emphasize need for a summary and checklist. Otherwise, people tend to skip this standard practice.
2022-08-11 16:18:54 -04:00
161965cfb0 Fixes the exception in batch-explain notebook in the official folder (#810)
* fixes exception(reg-test), replaces timestamp with uuid, minor changes

* ran linter test

* resolved review comments: license year, Vertex AI SDK, dataset after objective and future tense

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-11 10:25:51 -07:00
b9d4457474 Modified notebook forecasting-retail-demand (#827)
* deleted file in community and added file in official folder

* renamed file

* ran linter test

* renamed file

* ran linter

* made changes

* ran linter test

* made changes

* ran linter test

* made changes

* ran linter test

* made changes

* ran linter

* made change

* ran linter test

* changes suggested by andrew done

* ran linter

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-11 09:31:27 -07:00
a5b6bcfab1 those two files are moved to official folder.Deleting them in community content (#855)
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-11 09:14:02 -07:00
5d55f5b0d2 Modified notebook pricing-optimization.ipynb (#834)
* modified notebook according to notebook_template.

* ran linter

* Added create dataset step

* ran linter

* replaced hardcoded dataset name with a variable

* ran linter

* changes suggested by nadrew done

* ran linter

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-11 09:00:13 -07:00
36ace6f4a6 deleted inventory_prediction_folder,folder moved to official (#856)
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-11 08:24:39 -07:00
32d9b416c1 UUID changes done comparing_pipeline_runs.ipynb (#759)
* done UUID changes

* ran lintertest

* made changes in cleanup section

* ran lintertest

* done UUID changes

* ran lintertest

* made changes in cleanup section

* ran lintertest

* made changes in cleanup section

* Ran linter test

* made UUID changes

* RAN linter test

* Made Some minor Chanages notebook

* Ran Linter Test

* small changes made

* Ran Linter Test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-11 08:07:17 -07:00
1c6309f401 Modified notebook SDK_AutoML_Video_Classification.ipynb (#839)
* modified notebook according to template, tensorflow library is used only for file opening so instead of tf we used bucket.blob.download_as_string()

* ran linter

* all changes requested by andrew are done

* cleared all outputs

* making changes to run linter test

* making changes to run linter test

* ran linter

* removed region text in create bucket step

* ran linter

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-10 19:05:41 -07:00
728dec8526 Updates the custom-tabular-bq-managed-dataset notebook according to the new template (#780)
* updates the configuring steps, replaces timestamp with uuid, expands the imports

* ran linter test

* separates the vertex-ai and bigquery initialization steps

* adds comment to cell_24

* adds blank line to cell_24:7:1

* adds blank line to cell_24:7:1

* ran linter test

* fixes aiplatform+bigquery installation compatibility issue

* ran linter test

* fixes installation dependencies

* ran linter test

* fixes the issues from the review: future tense, section positions, updates from the latest template

* ran linter test

* fixes the issues from the review: Code formatting, delete redundant cells, resource name changes

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-10 08:41:50 -07:00
sudarshan-SpringMLandGitHub 7692f902dd Added minor changes to training-multi-class-classification-model-for-ads-targeting-usecase notebook (#735)
* added new file

* ran linter test

* made small changes

* ran linter

* added file

* ran linter

* changes requested by andrew done

* ran linter
2022-08-10 08:03:42 -07:00
9281403198 fix cleanup cell to undeploy models before deleting endpoint and remove BQ table and dataset (#846)
* fix artifact cleanup

* lint fixes

* remove extraneous echo

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-09 20:09:25 -07:00
2be602fbef Update comparing_local_trained_models.ipynb (#704)
Install from Pypi

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-09 15:39:54 -07:00
b140077eb1 Change REGION_NAME to REGION to match flag set earlier in notebook (#734)
Co-authored-by: Ivan Cheung <ivans.mailbox@gmail.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-09 14:54:22 -07:00
d3139f7df8 Added colab , installed some packages, added some code based on standard template and made changes in cleanup section for the file inventory_prediction.ipynb (#533)
* Added notebook

* Ran linter test

* added pyarrow to install

Co-authored-by: Andrew Ferlitsch <aferlitsch@gmail.com>
Co-authored-by: sudarshan-SpringML <82567512+sudarshan-SpringML@users.noreply.github.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-09 14:49:40 -07:00
72baced988 model monitoring notebook fixes (#841)
* fix model monitoring notebook

* lint fixes

* fixed Soheila's review comments

* fix Andrew's comments

* lint fixes

* clean up install packages per review request

* lint fixes

* fix more comments from Andrew

* lint fixes

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-09 14:16:54 -07:00
Soheila ZangenehandGitHub 5232654705 Update folder name to training (#845) 2022-08-09 12:29:34 -07:00
Andrew FerlitschandGitHub 125fe32eb2 feat: notebook for DASK training (#837)
* feat: tune template

* feat: tune template

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* feat: auto review

* feat: auto review

* feat: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* feat: auto review script

* tune: project ID and Region

* tune: project ID and Region

* fix: set MODEL_DIR for HPT

* fix: set MODEL_DIR for HPT

* feat: add batch example

* feat: add batch example

* feat: add batch example

* feat: add batch example

* feat: add notebook for DASK training

* feat: add notebook for DASK training
2022-08-08 16:17:28 -07:00
Andrew FerlitschandGitHub 614f4154dc fix: owner names 2022-08-08 15:50:33 -07:00
Andrew FerlitschandGitHub 970415398b fix: owner username 2022-08-08 15:46:57 -07:00
Hyunuk LimandGitHub a052a3d361 A new notebook for Spark Sample (#720)
* Created spark notebook with test code

* Implemented experimental code for poly_view

* implemented the table

* WIP-notebook

* moved experimental to tutorial

* delete experimental code and rename the notebook

* clear all outputs

* fix: delete outputs again

* fix: changed template to the newer one

* fix: modify link on workbench

* add creating a cluster

* Completed Before you begin part

* Change execution sequence

* completed write back process

* change order that switching kernel goes top

* modify pie chart to bar chart

* Completed write up part

* WIP: adding description and comments.

* WIP: delete outputs

* fix: nbqa done

* Completed the first draft

* Delete %%time from cells

* Apply changes as per the code review from Brad except SparkSql

* delete outputs

* Change SparkSQL to Spark API

* change label to xlabel

* fix: description in Dataset

* fix: change BUCKET_NAME to DATASET_NAME, link for the region, and add descriptions and examples for frequency table

* fix: move normalize_name to top of the cell

* fix: refactor udf functions and descriptions

* fix: add link for udf

* fix: description in Dataset

* fix: grammer

* fix: add declared in the sentence

* fix: small changes on grammar

* fix: delete string

* fix: change UserDefinedFunction to udf

* fix: as per TW's code review

* fix: reorder REGION and TIMESTAMP under Creating a GCS bucket

* fix: lint

* chore: add bmiro@ as a codeowner of this doc

* fix: change the variable to fix a bug

* fix: as per TW's second review

* fix: add installation part to pass the ci test

* fix: url for links to main

* fix: delete disabling API since it doesn't affect to the pricing

* fix: add conditions for CI test

* fix: changed jar for testing

* fix: add gcs connector

* fix: change writing method to direct

* fix: delete gcs connector

* fix: specify java folder

* fix: change java_home location

* fix: change unzip instruction

* fix: delete mono_ranking_avg_bytes from testing env

* fix: delete frequency_table from testing env

* fix: delete GCS bucket part

* fix: as per Brad's review

* fix: lint

* fix: add version

* fix: change comment

* fix: add package due to switching the kernel

* fix: delete dataproc cluster command

* fix: change link

* fix: change link

* fix: revert cluster deletion command

* fix: change parenthesis to encoded character

* fix: change the name of the notebook

* fix: change timestamp to UUID

* fix: change the link and add description

* fix: change metadata
2022-08-08 16:23:16 -04:00
Krishna Chaitanya MovvaandGitHub f8203b9f46 UUID replaces Timestamp in the notebook template (#745)
* replaces timestamp with uuid #create *task #tag1 replace the TIMESTAMP with uuid in other official notebooks

* ran linter test

* updates the uuid code

* fixes the comment style highlighted through linter-test

* ran linter test

* adds length argument to uuid function defaulted to 8

* ran linter test
2022-08-08 11:20:33 -04:00
Andrew FerlitschandGitHub fac8c4c9b1 fix: improve batch description (#830)
* feat: tune template

* feat: tune template

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* feat: auto review

* feat: auto review

* feat: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* feat: auto review script

* tune: project ID and Region

* tune: project ID and Region

* fix: set MODEL_DIR for HPT

* fix: set MODEL_DIR for HPT

* feat: add batch example

* feat: add batch example

* feat: add batch example

* feat: add batch example
2022-08-05 13:50:14 -07:00
Andrew FerlitschandGitHub d6c13c201e Ml ops v9v4 (#817)
* feat: tune template

* feat: tune template

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* feat: auto review

* feat: auto review

* feat: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* feat: auto review script

* tune: project ID and Region

* tune: project ID and Region

* fix: set MODEL_DIR for HPT

* fix: set MODEL_DIR for HPT

* feat: add batch example

* feat: add batch example
2022-08-05 09:40:11 -07:00
Soheila ZangenehandGitHub 8db9ce0415 Move download link up (#813) 2022-08-04 15:05:18 -04:00
Ivan CheungandGitHub 8c7fb38136 Added missing dependency (#814) 2022-08-04 14:53:17 -04:00
Andrew FerlitschandGitHub acec861ad5 tune: notebook template (#812)
* feat: tune template

* feat: tune template

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* feat: auto review

* feat: auto review

* feat: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* feat: auto review script

* tune: project ID and Region

* tune: project ID and Region
2022-08-04 10:51:08 -07:00
Andrew FerlitschandGitHub b5cc2b425e feat: auto review script tuning (#811)
* feat: tune template

* feat: tune template

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* feat: auto review

* feat: auto review

* feat: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* feat: auto review script
2022-08-04 09:30:13 -07:00
Soheila ZangenehandGitHub 710e6ea0d8 Run commands in quiet mode (#789)
* Run commands in quiet mode in both yaml files
* Test CI against single and multiple notebooks
2022-08-04 11:00:49 -04:00
4dce246b57 Add single notebook test file and remove broken notebook from the list (#801)
Co-authored-by: Ivan Cheung <ivans.mailbox@gmail.com>
2022-08-04 10:39:09 -04:00
Andrew FerlitschandGitHub 696efb00ee fix: auto review (#807)
* feat: tune template

* feat: tune template

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* feat: auto review

* feat: auto review

* feat: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review
2022-08-03 21:19:10 -07:00
Andrew FerlitschandGitHub fea73bb9c0 obsolete 2022-08-03 20:28:16 -07:00
Andrew FerlitschandGitHub f50ea24dd1 fix: auto review (#806)
* feat: tune template

* feat: tune template

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* feat: auto review

* feat: auto review

* feat: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review
2022-08-03 20:27:45 -07:00
Andrew FerlitschandGitHub 473e673d0a fix: auto review (#805)
* feat: tune template

* feat: tune template

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* feat: auto review

* feat: auto review

* feat: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review
2022-08-03 17:22:25 -07:00
Andrew FerlitschandGitHub 127297ee4e tune: grammar 2022-08-03 15:38:44 -07:00
Chun-Hsiang WangandGitHub fb528b60c6 samples: Minor fix for CPR existing image use cases. (#778) 2022-08-03 15:23:35 -07:00
Andrew FerlitschandGitHub 1c1a2b2097 fix: auto review (#804)
* feat: tune template

* feat: tune template

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* feat: auto review

* feat: auto review

* feat: auto review

* fix: auto review
2022-08-03 14:56:26 -07:00
Andrew FerlitschandGitHub 8cb2a26817 fix: auto review (#803)
* feat: tune template

* feat: tune template

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* feat: auto review

* feat: auto review
2022-08-03 14:38:14 -07:00
Andrew FerlitschandGitHub 3bf098b361 feat: auto review (#802)
* feat: tune template

* feat: tune template

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review
2022-08-03 14:19:49 -07:00
433cffbf76 Tabnet (#732)
* Start a new branch for TabNet tutorial.

* format lint

* Clean version Created using Colaboratory

* Remove unused import

* Remove unused import

* Created using Colaboratory

* add import

* Add visualization for TabNet

* add gcs

* run format

* reformat

* reformat

* Rmove the - file

* run linter

* run linter

* Update the objective and data section

* Update the link.

* Update data description.

* Update data description.

Co-authored-by: Long Le <longtle@google.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-03 13:42:06 -07:00
0ec2f4fbe8 bugfix: pass Dataflow related parameters correct for AutoML Tabular pipeline notebook (#725)
Also corrected the required Roles for the service account.

Co-authored-by: Helin Wang <helin@google.com>
Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-03 13:39:32 -07:00
a9af97f1b9 Added notebook demonstrating Tensorboard Custom Training with custom container. (#611)
* Added notebook demonstrating Tensorboard Custom Training with custom container.

* Added notebook demonstrating Tensorboard Custom Training with custom container.

* update codeowners file

* call Vertex API instead of gapic API

* resolve comments for custom container

* resolve comments and format

* resolve comments

* using --quiet for delete doctor repository

* address more comments

Co-authored-by: gericdong <itseric@google.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-03 13:37:14 -07:00
d6431fab4c Added notebook demonstrating Tensorboard Custom Training with prebuilt container. (#603)
* Added notebook demonstrating Tensorboard Custom Training with prebuilt container

* Added notebook demonstrating Tensorboard Custom Training with prebuilt container

* small fix

* address comments

* format

* update project id to be [your-project-id], and populate tensorboard resource name automatically

* Added notebook demonstrating Tensorboard Custom Training with prebuilt container

* Added notebook demonstrating Tensorboard Custom Training with prebuilt container

* small fix

* address comments

* format

* fix typo for service account

* use vertex api instead of gapic api

* address comments

* minor fix

* minor fix for link

* minor fix

* resolve more comments

* a minor fix for comment

* format the notebook

* resolve comments

* address more comments

Co-authored-by: gericdong <itseric@google.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-03 13:35:41 -07:00
dcfde86928 Added colab , installation packages and few other changes to chicago_taxi_fare_prediction.ipynb file (#515)
* Added notebook

* Made changes in installing packages code cell

* Ran linter test

* fixes the installation issues and updates some textual content

* fixes the # formatting for comments

* ran linter test

* adds pyarrow to the packages

* ran linter test

* replaces timestamp with uuid

* ran linter test

* updates the uuid code

* fixes the comment style highlighted through linter-test

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
Co-authored-by: krishr2d2 <krishna.movva@springml.com>
2022-08-03 13:33:08 -07:00
5d747ffa0d Refresh of PyTorch Image Classification Multi-Node Distributed Data Parallel Training on GPU using Vertex Training with Custom Container (#509)
* notebook refresh from vertex ai sdk project

* linter test

* notebook refresh from vertex ai sdk project with trainer folder

* linter test

* add pyarrow

* modified notebook

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@gmail.com>
Co-authored-by: sudarshan-SpringML <sudarshan.c@springml.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-03 13:32:44 -07:00
53f25201cc Made minor changes to SDK_Custom_Training_Python_Package_Managed_Text_Dataset_Tensorflow_Serving_Container notebook (#507)
* modified notebook

* small changes done

* modified notebook and moved notebook to official folder

* ran linter test

* resolved comments

* ran linter test

* sentence case heading added for some more text

* ran linter test

* made changes

* ran linter test

* made changes

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-03 13:32:01 -07:00
9b17db3025 Refresh of PyTorch Image Classification Multi-Node Distributed Data Parallel Training on CPU using Vertex Training with Custom Container Notebook (#489)
* multi_node_ddp_gloo_vertex_training_with_custom_container refresh and related trainer folder

* linter test

* various fixes and colab update

* linter test

* modified notebook

* modified notebook

* ran linter test

* Update multi_node_ddp_gloo_vertex_training_with_custom_container.ipynb

Co-authored-by: sudarshan-SpringML <sudarshan.c@springml.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@gmail.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-03 13:24:45 -07:00
423f7ac584 Adding PrivateEndpoint CUJ notebook to notebooks/community (#721)
* moving REGION up

* moving REGION up and csv file name

* fix: changed bucket URL to console

* removing TODOs from Tabnet notebook

* adding notebook and editing CODEOWNERS file

* fixing links

* adding to community because of test issue

* removing CODEOWNERS

* reverting CODEOWNERS

* linting?

* adding fixes

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-08-03 12:54:46 -07:00
aec82c7e5b inardini -- bqml new operators release update to v1 (#717)
* update to v1

* linter test passed

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-03 12:51:46 -07:00
b227509fbb chore(deps): update dependency black to v22.6.0 (#696)
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-03 12:43:54 -07:00
Andrew FerlitschandGitHub e715e68273 fix: auto review (#800)
* feat: tune template

* feat: tune template

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review
2022-08-03 12:39:06 -07:00
406de6fe9a Adds the updated sdk-feature-store-pandas notebook to official from community folder (#488)
* adds the updated sdk-feature-store-pandas notebook to official and removes it from the community

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
Co-authored-by: nayaknishant <nishantnayak@google.com>
Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-08-03 12:30:10 -07:00
Andrew FerlitschandGitHub eacc49d911 fix: auto review (#798)
* feat: tune template

* feat: tune template

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auto review

* fix: auto review
2022-08-03 12:26:12 -07:00
Andrew FerlitschandGitHub b95959e7a1 cleanup 2022-08-03 10:58:57 -07:00
Andrew FerlitschandGitHub cc2cf876de fix: auto review (#797)
* feat: tune template

* feat: tune template

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review
2022-08-03 10:58:27 -07:00
Andrew FerlitschandGitHub 1047237335 Ml ops v9v4 (#796)
* feat: tune template

* feat: tune template

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review
2022-08-03 10:11:23 -07:00
Andrew FerlitschandGitHub 791d589d41 Ml ops v9v4 (#795)
* feat: tune template

* feat: tune template

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review
2022-08-03 09:53:21 -07:00
Andrew FerlitschandGitHub f7bdf75d90 fix: auto-review (#794)
* feat: tune template

* feat: tune template

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review
2022-08-03 09:37:14 -07:00
Andrew FerlitschandGitHub 785ca9f864 fix: auto review (#793)
* feat: tune template

* feat: tune template

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review
2022-08-03 09:22:59 -07:00
Andrew FerlitschandGitHub aaa7d5c259 fix: auto review (#792)
* feat: tune template

* feat: tune template

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auti review

* fix: auti review
2022-08-03 09:01:37 -07:00
Andrew FerlitschandGitHub e21cb948d6 feat: auto review (#784)
* feat: tune template

* feat: tune template

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review
2022-08-02 18:46:08 -07:00
Andrew FerlitschandGitHub 5551c5f895 fix: auto review (#783)
* feat: tune template

* feat: tune template

* fix: auto review

* fix: auto review
2022-08-02 18:29:21 -07:00
Andrew FerlitschandGitHub e8853475bc feat: tune template (#782)
* feat: tune template

* feat: tune template
2022-08-02 17:33:32 -07:00
Andrew FerlitschandGitHub 33cb8139da Update get_started_vertex_training_lightgbm.ipynb 2022-08-02 16:33:03 -07:00
Andrew FerlitschandGitHub 0288fa3703 fix: link 2022-08-02 16:32:25 -07:00
Andrew FerlitschandGitHub d48edc2cb4 fix: links 2022-08-02 16:27:45 -07:00
Andrew FerlitschandGitHub 7b26f01671 fix: link 2022-08-02 16:25:45 -07:00
Andrew FerlitschandGitHub 59cd2cda3c fix: link 2022-08-02 16:23:46 -07:00
Andrew FerlitschandGitHub 3ac469f57c fix: link 2022-08-02 16:12:59 -07:00
Andrew FerlitschandGitHub 008833422c fix: link 2022-08-02 14:47:08 -07:00
Andrew FerlitschandGitHub 59c85c3085 fix: link 2022-08-02 14:44:57 -07:00
Andrew FerlitschandGitHub f2b5d0924e fix: link title 2022-08-02 14:35:38 -07:00
Andrew FerlitschandGitHub 772cd44cef fix: link 2022-08-02 14:28:58 -07:00
Andrew FerlitschandGitHub 379a4c6a1c fix: link 2022-08-02 14:27:16 -07:00
Andrew FerlitschandGitHub 5cea72848e fix: link 2022-08-02 14:25:47 -07:00
Andrew FerlitschandGitHub 9c12dd811b fix: links 2022-08-02 14:22:38 -07:00
Andrew FerlitschandGitHub 844cf5b047 fix: links 2022-08-02 14:19:52 -07:00
Andrew FerlitschandGitHub 1492051560 fix: link 2022-08-02 14:06:43 -07:00
Andrew FerlitschandGitHub 40bdd5fce3 fix: link 2022-08-02 14:03:36 -07:00
Andrew FerlitschandGitHub d1cc60e8d7 fix: link 2022-08-02 13:50:36 -07:00
Andrew FerlitschandGitHub 7ca4cf9912 fix: links 2022-08-02 13:34:59 -07:00
Andrew FerlitschandGitHub 294e40cb61 fix: link 2022-08-02 13:27:09 -07:00
Andrew FerlitschandGitHub f69e43d3d6 fix: link 2022-08-02 13:24:41 -07:00
Andrew FerlitschandGitHub 582c479dbe fix: link 2022-08-02 13:23:07 -07:00
Andrew FerlitschandGitHub f83660cf62 fix: link 2022-08-02 13:15:55 -07:00
Andrew FerlitschandGitHub e948fae793 fix: link 2022-08-02 13:13:57 -07:00
Andrew FerlitschandGitHub cd51333ff1 fix: link 2022-08-02 13:13:00 -07:00
Andrew FerlitschandGitHub cf5d266bd7 fix: link 2022-08-02 13:09:57 -07:00
Andrew FerlitschandGitHub 8ef840affb fix: link 2022-08-02 12:59:31 -07:00
Andrew FerlitschandGitHub 4dcc3d0183 fix: link 2022-08-02 12:31:11 -07:00
Andrew FerlitschandGitHub 0bcb6a8d8e fix: title 2022-08-02 12:24:32 -07:00
Andrew FerlitschandGitHub d26b385ec7 fix: title 2022-08-02 12:23:44 -07:00
Andrew FerlitschandGitHub d5a2766aa4 Update get_started_with_matching_engine.ipynb 2022-08-02 12:22:14 -07:00
Andrew FerlitschandGitHub 7abfbb5473 fix: title 2022-08-02 12:21:41 -07:00
Andrew FerlitschandGitHub 096423da33 fix: notice 2022-08-02 12:11:17 -07:00
Andrew FerlitschandGitHub 89a133549c fix: pinning (#779)
* feat: import automl tabular model

* feat: import automl tabular model

* feat: HPT for non-TF

* feat: HPT for non-TF

* fix: split guidelines from template

* fix: split guidelines from template

* fix: split guidelines from template

* upgrade: updates for new release

* upgrade: updates for new release

* update: tune title

* update: tune title

* feat: auto-discover

* fix: title

* fix: title

* fix: title

* fix: title

* fix: title

* fix: title

* feat: autodiscover

* feat: autodiscover

* fix: title

* fix: title

* feat: autodiscover

* fix: title

* fix: title

* feat: autodiscover

* fix: title

* fix: title

* feat: autodiscover

* fix: title

* fix: title

* fix: title

* fix: title

* feat: autodiscover

* fix: pinning

* fix: pinning
2022-08-01 19:56:29 -07:00
648f1c34e0 Add notebook to show how to deploy BQML models for online prediction via Vertex AI Model Registry (#736)
* adding new notebook on BQML online pred via Model Registry

* minor changes

* fixes to linting

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-08-01 08:42:51 -07:00
Andrew FerlitschandGitHub 3f21907c31 feat: autodiscover (#775)
* feat: import automl tabular model

* feat: import automl tabular model

* feat: HPT for non-TF

* feat: HPT for non-TF

* fix: split guidelines from template

* fix: split guidelines from template

* fix: split guidelines from template

* upgrade: updates for new release

* upgrade: updates for new release

* update: tune title

* update: tune title

* feat: auto-discover

* fix: title

* fix: title

* fix: title

* fix: title

* fix: title

* fix: title

* feat: autodiscover

* feat: autodiscover

* fix: title

* fix: title

* feat: autodiscover

* fix: title

* fix: title

* feat: autodiscover

* fix: title

* fix: title

* feat: autodiscover

* fix: title

* fix: title

* fix: title

* fix: title

* feat: autodiscover
2022-07-29 22:23:59 -07:00
Andrew FerlitschandGitHub fce66b3e57 fix: title (#774)
* feat: import automl tabular model

* feat: import automl tabular model

* feat: HPT for non-TF

* feat: HPT for non-TF

* fix: split guidelines from template

* fix: split guidelines from template

* fix: split guidelines from template

* upgrade: updates for new release

* upgrade: updates for new release

* update: tune title

* update: tune title

* feat: auto-discover

* fix: title

* fix: title

* fix: title

* fix: title

* fix: title

* fix: title

* feat: autodiscover

* feat: autodiscover

* fix: title

* fix: title

* feat: autodiscover

* fix: title

* fix: title

* feat: autodiscover

* fix: title

* fix: title

* feat: autodiscover

* fix: title

* fix: title

* fix: title

* fix: title
2022-07-29 22:19:45 -07:00
Andrew FerlitschandGitHub 3b140f9caa fix: title (#773)
* feat: import automl tabular model

* feat: import automl tabular model

* feat: HPT for non-TF

* feat: HPT for non-TF

* fix: split guidelines from template

* fix: split guidelines from template

* fix: split guidelines from template

* upgrade: updates for new release

* upgrade: updates for new release

* update: tune title

* update: tune title

* feat: auto-discover

* fix: title

* fix: title

* fix: title

* fix: title

* fix: title

* fix: title

* feat: autodiscover

* feat: autodiscover

* fix: title

* fix: title

* feat: autodiscover

* fix: title

* fix: title

* feat: autodiscover

* fix: title

* fix: title

* feat: autodiscover

* fix: title

* fix: title
2022-07-29 21:57:11 -07:00
Andrew FerlitschandGitHub 89325d7e52 feat: autodiscover (#772)
* feat: import automl tabular model

* feat: import automl tabular model

* feat: HPT for non-TF

* feat: HPT for non-TF

* fix: split guidelines from template

* fix: split guidelines from template

* fix: split guidelines from template

* upgrade: updates for new release

* upgrade: updates for new release

* update: tune title

* update: tune title

* feat: auto-discover

* fix: title

* fix: title

* fix: title

* fix: title

* fix: title

* fix: title

* feat: autodiscover

* feat: autodiscover

* fix: title

* fix: title

* feat: autodiscover

* fix: title

* fix: title

* feat: autodiscover

* fix: title

* fix: title

* feat: autodiscover
2022-07-29 19:58:21 -07:00
Andrew FerlitschandGitHub e4d44f02d6 feat: autodiscover (#771)
* feat: import automl tabular model

* feat: import automl tabular model

* feat: HPT for non-TF

* feat: HPT for non-TF

* fix: split guidelines from template

* fix: split guidelines from template

* fix: split guidelines from template

* upgrade: updates for new release

* upgrade: updates for new release

* update: tune title

* update: tune title

* feat: auto-discover

* fix: title

* fix: title

* fix: title

* fix: title

* fix: title

* fix: title

* feat: autodiscover

* feat: autodiscover

* fix: title

* fix: title

* feat: autodiscover

* fix: title

* fix: title

* feat: autodiscover

* fix: title

* fix: title
2022-07-29 19:54:08 -07:00
Andrew FerlitschandGitHub 78993c4729 fix: title (#770)
* feat: import automl tabular model

* feat: import automl tabular model

* feat: HPT for non-TF

* feat: HPT for non-TF

* fix: split guidelines from template

* fix: split guidelines from template

* fix: split guidelines from template

* upgrade: updates for new release

* upgrade: updates for new release

* update: tune title

* update: tune title

* feat: auto-discover

* fix: title

* fix: title

* fix: title

* fix: title

* fix: title

* fix: title

* feat: autodiscover

* feat: autodiscover

* fix: title

* fix: title

* feat: autodiscover

* fix: title

* fix: title
2022-07-29 16:28:15 -07:00
Andrew FerlitschandGitHub c29e7d86bd feat: autodiscover (#769)
* feat: import automl tabular model

* feat: import automl tabular model

* feat: HPT for non-TF

* feat: HPT for non-TF

* fix: split guidelines from template

* fix: split guidelines from template

* fix: split guidelines from template

* upgrade: updates for new release

* upgrade: updates for new release

* update: tune title

* update: tune title

* feat: auto-discover

* fix: title

* fix: title

* fix: title

* fix: title

* fix: title

* fix: title

* feat: autodiscover

* feat: autodiscover

* fix: title

* fix: title

* feat: autodiscover
2022-07-29 16:18:24 -07:00
Andrew FerlitschandGitHub a8793fb00a fix: title (#768)
* feat: import automl tabular model

* feat: import automl tabular model

* feat: HPT for non-TF

* feat: HPT for non-TF

* fix: split guidelines from template

* fix: split guidelines from template

* fix: split guidelines from template

* upgrade: updates for new release

* upgrade: updates for new release

* update: tune title

* update: tune title

* feat: auto-discover

* fix: title

* fix: title

* fix: title

* fix: title

* fix: title

* fix: title

* feat: autodiscover

* feat: autodiscover

* fix: title

* fix: title
2022-07-29 16:08:49 -07:00
Andrew FerlitschandGitHub bb60a7d0db Ml ops v9v3 (#767)
* feat: import automl tabular model

* feat: import automl tabular model

* feat: HPT for non-TF

* feat: HPT for non-TF

* fix: split guidelines from template

* fix: split guidelines from template

* fix: split guidelines from template

* upgrade: updates for new release

* upgrade: updates for new release

* update: tune title

* update: tune title

* feat: auto-discover

* fix: title

* fix: title

* fix: title

* fix: title

* fix: title

* fix: title

* feat: autodiscover

* feat: autodiscover
2022-07-29 15:08:27 -07:00
Andrew FerlitschandGitHub eef758c719 feat: autodiscover index (#766)
* feat: import automl tabular model

* feat: import automl tabular model

* feat: HPT for non-TF

* feat: HPT for non-TF

* fix: split guidelines from template

* fix: split guidelines from template

* fix: split guidelines from template

* upgrade: updates for new release

* upgrade: updates for new release

* update: tune title

* update: tune title

* feat: auto-discover

* fix: title

* fix: title

* fix: title

* fix: title

* fix: title

* fix: title
2022-07-29 15:06:34 -07:00
Andrew FerlitschandGitHub 486ef17ab8 fix: title (#765)
* feat: import automl tabular model

* feat: import automl tabular model

* feat: HPT for non-TF

* feat: HPT for non-TF

* fix: split guidelines from template

* fix: split guidelines from template

* fix: split guidelines from template

* upgrade: updates for new release

* upgrade: updates for new release

* update: tune title

* update: tune title

* feat: auto-discover

* fix: title

* fix: title

* fix: title

* fix: title

* fix: title

* fix: title
2022-07-29 14:57:39 -07:00
Andrew FerlitschandGitHub 90dfef3db6 fix: title (#764)
* feat: import automl tabular model

* feat: import automl tabular model

* feat: HPT for non-TF

* feat: HPT for non-TF

* fix: split guidelines from template

* fix: split guidelines from template

* fix: split guidelines from template

* upgrade: updates for new release

* upgrade: updates for new release

* update: tune title

* update: tune title

* feat: auto-discover

* fix: title

* fix: title
2022-07-29 14:35:34 -07:00
Andrew FerlitschandGitHub d59c87b387 fix: title (#763)
* feat: import automl tabular model

* feat: import automl tabular model

* feat: HPT for non-TF

* feat: HPT for non-TF

* fix: split guidelines from template

* fix: split guidelines from template

* fix: split guidelines from template

* upgrade: updates for new release

* upgrade: updates for new release

* update: tune title

* update: tune title

* feat: auto-discover

* fix: title

* fix: title
2022-07-29 13:27:46 -07:00
Andrew FerlitschandGitHub 9d69b77ac6 feat: autodiscover index (#762)
* feat: import automl tabular model

* feat: import automl tabular model

* feat: HPT for non-TF

* feat: HPT for non-TF

* fix: split guidelines from template

* fix: split guidelines from template

* fix: split guidelines from template

* upgrade: updates for new release

* upgrade: updates for new release

* update: tune title

* update: tune title

* feat: auto-discover
2022-07-29 13:04:48 -07:00
Andrew FerlitschandGitHub b0da5d69f8 update: tune title (#761)
* feat: import automl tabular model

* feat: import automl tabular model

* feat: HPT for non-TF

* feat: HPT for non-TF

* fix: split guidelines from template

* fix: split guidelines from template

* fix: split guidelines from template

* upgrade: updates for new release

* upgrade: updates for new release

* update: tune title

* update: tune title
2022-07-29 12:44:46 -07:00
Andrew FerlitschandGitHub 830e10e583 upgrade: updates for new release (#760)
* feat: import automl tabular model

* feat: import automl tabular model

* feat: HPT for non-TF

* feat: HPT for non-TF

* fix: split guidelines from template

* fix: split guidelines from template

* fix: split guidelines from template

* upgrade: updates for new release

* upgrade: updates for new release
2022-07-29 12:17:43 -07:00
kthytangandGitHub db904b424e chore: Update CPR notebooks. (#756)
* chore: Update CPR notebooks to pip install latest released Vertex SDK pypi package.

* Update CPR notebooks wording for experimental -> preview.

* Update Objectives wording

* Update github links to main branch.

* Update Sklearn interface.

* Fix formatting and typos.

* Update Predictor interface
2022-07-28 17:13:50 -07:00
Andrew FerlitschandGitHub c371f05bfa fix: split guidelines from template (#754)
* feat: import automl tabular model

* feat: import automl tabular model

* feat: HPT for non-TF

* feat: HPT for non-TF

* fix: split guidelines from template

* fix: split guidelines from template

* fix: split guidelines from template
2022-07-28 08:13:04 -07:00
Andrew FerlitschandGitHub 5f7de16e2d fix: split off authoring guidelines (#753)
* feat: import automl tabular model

* feat: import automl tabular model

* feat: HPT for non-TF

* feat: HPT for non-TF

* fix: split guidelines from template
2022-07-28 08:08:55 -07:00
Andrew FerlitschandGitHub 3908580ad6 feat: add notebook for non-TF HPT (#751)
* feat: import automl tabular model

* feat: import automl tabular model

* feat: HPT for non-TF

* feat: HPT for non-TF
2022-07-27 14:57:24 -07:00
Andrew FerlitschandGitHub 77d2cac20a Update README.md 2022-07-27 13:39:38 -07:00
Andrew FerlitschandGitHub a92d5ce473 Update README.md 2022-07-27 13:38:51 -07:00
Andrew FerlitschandGitHub 416ec74af3 add entry 2022-07-27 13:37:51 -07:00
Andrew FerlitschandGitHub 8443bbfe44 feat: notebook for importing automl tabular model (#750)
* feat: import automl tabular model

* feat: import automl tabular model
2022-07-27 13:35:04 -07:00
kthytangandGitHub 23a599068a Update CPR notebooks. (#741)
* Update CPR notebooks.

- Update interfaces
- Fix missing timestamp
- Rename some variables

* Update cpr preprocess notebook.

- Change preprocessor import path.

* Update SDK_Custom_Predict_SDK_Integration.ipynb

* Update SDK_Custom_Predict_and_Handler_SDK_Integration.ipynb

* Update SDK_Pytorch_Custom_Predict.ipynb

* Update SDK_Triton_PyTorch_Local_Prediction.ipynb

* Fix lint and revert path change for pickle dumping preprocessor.
2022-07-27 10:58:28 -07:00
gericdongandGitHub c63bb4c464 New notebook to demonstrate how to enable TensorBoard Profiler (#719)
* New notebook to demonstrate how to enable TensorBoard Profiler

* Reformatted with Lint

* Changed service account handling and added a step to monitor job state

* Addressed review comments

* Addressed technical writerreview comments

* Addressed Ivan review comments

* Switched from GAPIC to Vertex SDK

* Removed an unused package

* Addressed review comments
2022-07-26 14:39:37 -04:00
Ivan CheungandGitHub 2226e915c0 Update CODEOWNERS 2022-07-25 16:24:10 -04:00
Ivan CheungandGitHub cd9f8b1d89 Update CODEOWNERS 2022-07-25 15:01:46 -04:00
Ivan CheungandGitHub aae9ad0422 Update CODEOWNERS 2022-07-25 15:00:33 -04:00
Ivan CheungandGitHub 89d50579a6 Add @GoogleCloudPlatform/caiis-tw to CODEOWNERS
Add @GoogleCloudPlatform/caiis-tw to default.
2022-07-25 15:00:01 -04:00
Ivan CheungandGitHub 2d6afa8313 Added better download instructions (#738)
* Improve download instruc
tions

* Added web download to notebook results list
2022-07-22 18:21:05 -04:00
Ivan CheungandGitHub 00cfb20c36 Notebook CI: Fixed variable replacement to handle numbers (#739)
* Removed replacement of variable comparisons

* Fixed issue with numbers in replacement content
2022-07-22 11:50:39 -04:00
Ivan CheungandGitHub 14c87ae702 Removed replacement of variable comparisons (#737) 2022-07-21 19:21:02 -04:00
e2a6610c2d Add an example use case for custom prediction routines. (#709)
* Add an example use case for custom prediction routines.

* Addressing some PR comments: reworded the readme in a few places, added a 'probe' command to build.py that sends a sample predict request, and pinned versions in requirements. Also fixed a bug where the artifacts_uri passed in during deployment on Vertex AI was not recognized as a directory.

* Autoformat code with black and fix a couple of typing errors.

* Addressing PR comments: Add deployment machine type to the config and add docstring to probe_prediction method.

* Update example to work with new LocalModel interface.

* Update example to work with new LocalModel interface.

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-07-21 12:42:31 -07:00
Ivan CheungandGitHub 145cdd0928 Added a service account injection (#695)
* Added a service account injection

* Revert this

* Added service account injection

* Fixed cloud build file

* Added gcloud version debug info

* Fixed sa injection

* Removed test file

* Revert CODEOWNERS
2022-07-21 15:04:10 -04:00
Michael HuandGitHub 04e1697bca fix workbench link in new tables notebooks (#714) 2022-07-21 09:29:06 -04:00
Ivan CheungandGitHub be785d0389 Allow outputs (#733) 2022-07-20 17:31:12 -04:00
MarcandGitHub 976e346a3d rm open in cloud notebook until tested there, also fix open links to use community for now (#731) 2022-07-20 21:48:07 +01:00
e37caca496 chore(deps): update dependency nbqa to v1.4.0 (#727)
Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-07-19 13:06:00 -05:00
MarcandGitHub 7a48fe8850 add community notebook (#729) 2022-07-19 07:52:03 +01:00
Ivan NardiniandGitHub 915a1edba8 inardini - vertex explainable ai example based api example using sdk gapic (#716)
* new notebook

* linter test passed.

* add codeowners

* review

* reviews

* linter test passed.

* last review. linter test passed
2022-07-16 19:12:46 -04:00
MarcandGitHub 424f947b04 avoid linter reformatting that breaks this notebook in colab (#715)
* fix formatting for colab

* disable black formatting selectively
2022-07-12 16:23:29 -07:00
Andrew FerlitschandGitHub c95f73c1a8 fix: bad link (#712)
* feat: notebook on model registry

* feat: notebook on model registry

* feat: workflow notebook

* feat: workflow notebook

* feat: workflow notebook

* fix: objective

* fix: objective

* fix: link

* fix: link
2022-07-07 12:51:14 -07:00
Andrew FerlitschandGitHub 9da033c887 Update README.md 2022-07-06 14:40:51 -07:00
Andrew FerlitschandGitHub f61f9bfdc2 feat: notebook for automl tabular workflow (#710)
* feat: notebook on model registry

* feat: notebook on model registry

* feat: workflow notebook

* feat: workflow notebook

* feat: workflow notebook
2022-07-06 14:26:45 -07:00
b2a17dfc83 inardini - New 20+ Pipeline Operators for BQML notebook (#706)
* google_cloud_pipeline_components_bqml_pipeline_demand_forecasting notebook

* linter test to check with andy

* google_cloud_pipeline_components_bqml_pipeline_demand_forecasting notebook

* linter test to check with andy

* merge

* linter test minor fails. check with andy

* add code owner

* minor changes

* remove components

* linter test passed

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-07-06 08:38:28 -07:00
sasha-gitgandGitHub 7072219d8b Update build_model_experimentation_lineage_with_prebuild_code.ipynb (#703)
Switch to install from Pypi
2022-07-01 14:40:52 -07:00
Andrew FerlitschandGitHub 57db2f4014 Update README.md 2022-07-01 11:45:37 -07:00
Andrew FerlitschandGitHub 4604b0a0a9 Update README.md 2022-07-01 11:44:38 -07:00
Andrew FerlitschandGitHub c8c26a12ba fix: finish objective cell (#708)
* feat: notebook on model registry

* feat: notebook on model registry
2022-07-01 11:40:28 -07:00
Andrew FerlitschandGitHub 3a8fa3e312 feat: notebook for model registry (#707)
* update: refine experiment notebook

* update: refine experiment notebook

* update: new feature release

* update: new feature release

* update: new feature release

* update: new feature release

* feat: notebook on model registry

* feat: notebook on model registry
2022-07-01 11:25:20 -07:00
bbfba5aaaf add initial automl tables on vertex pipelines notebook (#694)
* add initial automl tables on vertex pipelines notebook

* apply template

* update bucket variable name

* reviewer requested changes

* update notebook with the updated API

* fix typo

* add stage_1_tuning_result_artifact_uri to skip architecture search pipeline

* update parameter for skip architecture search pipeline

* default evaluation to True; update data splits

* update dataset to gs://cloud-samples-data/vertex-ai/tabular-workflows/datasets/safe-driver/train.csv

Co-authored-by: Helin Wang <helin@google.com>
Co-authored-by: Ivan Cheung <ivans.mailbox@gmail.com>
2022-07-01 09:54:39 -07:00
Andrew FerlitschandGitHub e30b2182b0 Update get_started_with_vertex_endpoints.ipynb 2022-06-30 20:35:07 -07:00
4c4dade55a samples: Add Prediction CPR preprocess sample. (#662)
* samples: Add Prediction CPR preprocess sample.

* chore: Refined wording and used notebook template for CPR preprocessing
sample.

* samples: Fixed comments for CPR Preprocess sample.

* samples: Fixed wording.

Co-authored-by: Ivan Cheung <ivans.mailbox@gmail.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-06-30 20:14:35 -07:00
5690d50430 samples: Add Prediction CPR Triton sample. (#661)
* samples: Add Prediction CPR Triton sample.

* chore: Refined wording and used notebook template for CPR Triton sample.

* samples: Fixed comments for CPR Triton samples.

* samples: Fixed wording.

Co-authored-by: Ivan Cheung <ivans.mailbox@gmail.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-06-30 20:13:00 -07:00
Chun-Hsiang WangandGitHub 10c33f934f samples: Add Prediction CPR SDK sample. (#660)
* samples: Add Prediction CPR SDK sample.

* chore: Refined wording and used notebook template for CPR SDK sample.

* samples: Fixed comments for CPR SDK sample.

* samples: Fixed wording.
2022-06-30 20:07:29 -07:00
Andrew FerlitschandGitHub 0c43cbd563 update: remove install from git branch 2022-06-30 16:24:20 -07:00
Andrew FerlitschandGitHub b640a8f545 update: new feature release (#702)
* update: refine experiment notebook

* update: refine experiment notebook

* update: new feature release

* update: new feature release

* update: new feature release

* update: new feature release
2022-06-30 11:57:50 -07:00
Ivan CheungandGitHub a575528b11 Tweaks to matching engine notebook (#701)
* Tweaks to notebook

* Ran linter

* More tweaks
2022-06-30 11:59:05 -04:00
Andrew FerlitschandGitHub 42a2c4d082 fix: doc link 2022-06-30 08:36:57 -07:00
Andrew FerlitschandGitHub 0bcf44e9fa Update get_started_bqml_training.ipynb 2022-06-30 08:33:06 -07:00
Andrew FerlitschandGitHub 9ac2774ece Update README.md 2022-06-29 21:25:19 -07:00
Andrew FerlitschandGitHub 975c9fe6bc update: refine experiments notebook (#699)
* update: refine experiment notebook

* update: refine experiment notebook
2022-06-29 21:14:11 -07:00
Andrew FerlitschandGitHub 417410f382 Fix: remove hardwired project number (#698)
* fix: remove hardwired project number

* fix: remove hardwired project number
2022-06-29 14:42:51 -07:00
Andrew FerlitschandGitHub 8fdfbe4e31 fix: link 2022-06-29 14:20:04 -07:00
Andrew FerlitschandGitHub 80f977546c fix: title 2022-06-29 09:54:29 -07:00
Ivan NardiniandGitHub c5fe281e32 inardini - experiments cuj2 notebook release (#637)
* experiments cuj2 notebook release

* add andy reviews

* linter test passed

* align notebooks

* linter test passed

* minor changes

* karl bug review fix

* linter test passed

* add -q to install

* linter test passed

* debug

* linter test passed

* PR build fix

* linter test passed. delete debug notebook

* import import tempfile

* linter test passed

* remove pandas install

* linter test passed

* add sklearn

* linter test passed

* test pandas dep

* linter test passed

* minor changes

* linter test passed

* ivan fix
2022-06-29 12:38:16 -04:00
49a2ddaf08 fix: removing TODOs from TabNet notebook (#652)
* moving REGION up

* moving REGION up and csv file name

* fix: changed bucket URL to console

* removing TODOs from Tabnet notebook

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-06-28 07:26:01 -07:00
e9cba94bb4 inardini - experiments cuj3 notebook release (#638)
* experiments cuj3 notebook release

* add andy reviews

* linter test passed

* align notebooks

* linter test passed

* align notebooks

* linter test passed

* update CODEOWNERS

* sasha bug review fix

* linter test passed

* minor changes

* add -q to install

* linter test passed

* ivan dep fix

* linter test passed

Co-authored-by: Ivan Cheung <ivans.mailbox@gmail.com>
2022-06-27 19:15:13 -04:00
fc83cfcea5 samples: Add Prediction CPR PyTorch sample. (#659)
* samples: Add Prediction CPR PyTorch sample.

* chore: Refined wording and used notebook template for PyTorch sample.

* added missing bucket cleanup

Co-authored-by: Andrew Ferlitsch <aferlitsch@gmail.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-06-27 12:23:31 -07:00
e3aa9e8f35 samples: Add Prediction CPR handler sample. (#658)
* samples: Add Prediction CPR handler sample.

* chore: Refined wording and used notebook template.

* added missing bucket cleanup sequence

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@gmail.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-06-27 12:09:20 -07:00
Ivan CheungandGitHub 37c52abc11 Added a virtualenv to the notebook execution tests which should help with dependency issues (#693)
* Added a virtualenv

* Added a virtualenv for the single yaml

* Debug

* Fixed diff logic for all notebooks case

* Added missing -c
2022-06-26 13:31:52 -04:00
Ivan CheungandGitHub c8320c8764 Revert "Add notebook for co-hosting model (#666)" (#692)
This reverts commit aa5464151d.
2022-06-24 18:26:28 -04:00
b5d51e61b6 inardini - experiments cuj1 notebook release (#636)
* experiments cuj1 notebook release

* add andy reviews

* linter test passed

* align notebooks

* linter test passed

* minor changes

* linter test passed

* minor changes

* linter test passed

Co-authored-by: Ivan Cheung <ivans.mailbox@gmail.com>
2022-06-24 15:35:32 -04:00
Ziye XingandGitHub aa5464151d Add notebook for co-hosting model (#666)
* Add notebook for co-hosting model

* Add co-hosting model notebook codeowner
2022-06-24 10:36:26 -07:00
Andrew FerlitschandGitHub 386cecf4c2 upgrade: current notebook standard (#677)
* upgrade: notebook standard

* upgrade: notebook standard

* Update custom_model_training_and_batch_prediction.ipynb
2022-06-24 09:59:49 -07:00
dffdb15c17 Add default kernel_name for notebook execution (#497)
Currently, there is no kernel_name. Hence, the execution test cannot run for notebooks that don't have kernels defined in their .ipynb file.

Side-note: We should use lint to remove the kernel_name from .ipynb as well, as it could include info specific to the author's environment.

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-06-23 19:18:49 -04:00
Andrew FerlitschandGitHub 2f3691eb71 fix: workbench link 2022-06-23 13:55:29 -07:00
Andrew FerlitschandGitHub f456d86555 fix: open in workbench link 2022-06-23 13:52:39 -07:00
Andrew FerlitschandGitHub f534b4e7a5 upgrade: fine tune notebook standard 2022-06-23 13:28:00 -07:00
Andrew FerlitschandGitHub de247cd78b upgrade: current notebook standards (#681)
* upgrade: notebook standard

* upgrade: notebook standard

* fix: formatting
2022-06-23 12:03:55 -07:00
Andrew FerlitschandGitHub 22ad74eb8d Update README.md 2022-06-23 10:06:28 -07:00
Andrew FerlitschandGitHub baf69999fc update: fine-tuning notebook (#689)
* update: touchups

* update: touchups
2022-06-23 10:02:02 -07:00
Mohammad Al-AnsariandGitHub d5057da9bb Added new notebook that creates Vertex AI AutoML text entity extraction dataset from PDFs using Vision API (#683)
* Added new Stage 1 notebook to create unlabelled
Vertex AI AutoML text entity extraction dataset
from collection of PDF files on Google Cloud Storage

* Linted notebook

* Removed TODOs

* Updates per PR comments

* Revered to multiple imports per line
2022-06-23 08:38:14 -07:00
24904a5999 feat: adding code owners and updating graph_paysim (#645)
* adding code owners and updating graph_paysim

* formatted

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
Co-authored-by: Ivan Cheung <ivans.mailbox@gmail.com>
2022-06-22 21:31:55 -05:00
Ivan CheungandGitHub 881a2b45c5 Improved git diff logic (#687) 2022-06-22 21:49:09 -04:00
Andrew FerlitschandGitHub 41fc83ad03 upgrade: current notebook standards (#655)
* update: current standards

* update: current standards

* Update sdk_custom_image_classification_batch_explain.ipynb

* fix: bucket nit
2022-06-22 16:59:39 -07:00
Andrew FerlitschandGitHub 9928276dc3 upgrade: current notebook standard (#653)
* upgrade: current notebook standard

* upgrade: current notebook standard

* Update sdk_automl_tabular_binary_classification_batch_explain.ipynb

* fix: bucket nit
2022-06-22 16:58:42 -07:00
Andrew FerlitschandGitHub 6607f93f5e upgrade: updated curated notebook to current standards (#648)
* upgrade: current standards

* upgrade: current standards

* fix: missed nits

* fix: missed nits

* Update automl-text-classification.ipynb

* Update automl-text-classification.ipynb

* rm extra comma
2022-06-22 16:56:38 -07:00
Andrew FerlitschandGitHub dcc0cfe06e upgrade: current notebook standards (#686)
* upgrade: notebook standard

* upgrade: notebook standard
2022-06-22 16:50:13 -07:00
Andrew FerlitschandGitHub 00d5c5c4bf Update README.md 2022-06-22 15:34:01 -07:00
Andrew FerlitschandGitHub f8152dde19 Update README.md 2022-06-22 15:24:14 -07:00
Andrew FerlitschandGitHub 0586e04c21 upgrade: current notebook standards (#656)
* update: current standards

* update: current standards

* fix: bucket nit
2022-06-22 15:06:01 -07:00
Andrew FerlitschandGitHub 3de18a7fab upgrade: current notebook standards (#674)
* upgrade: current notebook standard

* upgrade: current notebook standard

* fix: bucket

* fix: bucket
2022-06-22 15:03:54 -07:00
Andrew FerlitschandGitHub dc0bf24cc5 Update README.md 2022-06-22 14:58:28 -07:00
Andrew FerlitschandGitHub 8ce4c3070c Update README.md 2022-06-22 14:53:54 -07:00
Andrew FerlitschandGitHub 13c3acb976 Update README.md 2022-06-22 14:50:45 -07:00
Andrew FerlitschandGitHub c1150ff584 Update README.md 2022-06-22 14:39:06 -07:00
Andrew FerlitschandGitHub 4f11d70f7e Update README.md 2022-06-22 14:34:02 -07:00
Andrew FerlitschandGitHub 2bf9a2b317 Update README.md 2022-06-22 14:24:53 -07:00
Andrew FerlitschandGitHub b1e0ad0c4f Update README.md 2022-06-22 14:15:22 -07:00
Andrew FerlitschandGitHub 5624f92f02 Update README.md 2022-06-22 14:12:18 -07:00
Andrew FerlitschandGitHub 1335032954 Update README.md 2022-06-22 14:05:24 -07:00
Andrew FerlitschandGitHub 0b13c66e07 Update README.md 2022-06-22 14:01:55 -07:00
Andrew FerlitschandGitHub ef25b54926 update: add index (#684) 2022-06-22 13:58:06 -07:00
Andrew FerlitschandGitHub 064dbfeefa fix: bucket nit 2022-06-22 12:34:50 -07:00
Andrew FerlitschandGitHub 044c69e7a5 upgrade: current notebook standards (#654)
* update: current standards

* update: current standards
2022-06-22 12:33:26 -07:00
Andrew FerlitschandGitHub 32a46e7471 upgrade: current standards (#649)
* upgrade: current standards

* upgrade: current standards

* fix: missed nits

* fix: missed nits
2022-06-22 12:30:16 -07:00
Andrew FerlitschandGitHub b52d59822d upgrade: current notebook standards (#657)
* update: current standards

* update: current standards

* update: current standards

* update: current standards

* Update sdk_custom_tabular_regression_batch_explain.ipynb

* fix: indent issue

* fix: indent issue

* fix: bucket

* fix: bucket

* fix: image

* fix: image

* fix: cleanup

* fix: cleanup

* fix: cleanup
2022-06-22 11:47:17 -07:00
Andrew FerlitschandGitHub 529995ecde upgrade: current notebook standard (#671)
* upgrade: current notebook standard

* upgrade: current notebook standard

* Update google_cloud_pipeline_components_automl_tabular.ipynb

* fix: bucket

* fix: bucket
2022-06-22 11:35:38 -07:00
Andrew FerlitschandGitHub 0726328c92 upgrade: current notebook standard (#667)
* upgrade: current notebook standard

* upgrade: current notebook standard

* Update model_monitoring.ipynb

* Update model_monitoring.ipynb
2022-06-22 11:21:32 -07:00
Andrew FerlitschandGitHub 090e83c286 fix: more broken links 2022-06-22 11:19:17 -07:00
Andrew FerlitschandGitHub c3802626b9 fix: links issue 672 2022-06-22 11:18:08 -07:00
Andrew FerlitschandGitHub 9570c2477f upgrade: current notebook standards (#682)
* upgrade: current notebook standards

* upgrade: current notebook standards
2022-06-22 11:09:27 -07:00
Andrew FerlitschandGitHub 2b1a898b2a upgrade: current notebook standards (#680)
* upgrade: current notebook standards

* upgrade: current notebook standards
2022-06-22 11:09:04 -07:00
Andrew FerlitschandGitHub f2a42aa66e upgrade: current notebook standard (#679)
* upgrade: notebook standard

* upgrade: notebook standard

* fix: bucket

* fix: bucket
2022-06-22 11:08:37 -07:00
Andrew FerlitschandGitHub 30a03f1fd1 upgrade: current notebook standards (#678)
* upgrade: notebook standard

* upgrade: notebook standard

* Update google_cloud_pipeline_components_model_train_upload_deploy.ipynb

* fix: bucket nits

* fix: bucket
2022-06-22 11:08:08 -07:00
Andrew FerlitschandGitHub ca25448f59 upgrade: current notebook standard (#673)
* upgrade: current notebook standard

* upgrade: current notebook standard

* fix: bucket nit

* fix: bucket nit
2022-06-22 11:07:37 -07:00
Andrew FerlitschandGitHub 8f922710b0 upgrade: current notebook standard (#670)
* upgrade: current notebook standard

* upgrade: current notebook standard

* Update google_cloud_pipeline_components_automl_images.ipynb

* fix: bucket

* fix: bucket
2022-06-22 11:06:31 -07:00
Andrew FerlitschandGitHub 9509c6ab9d upgrade: current notebook standard (#669)
* upgrade: current notebook standard

* upgrade: current notebook standard

* Update lightweight_functions_component_io_kfp.ipynb

* fix: nits

* fix: nits

* fix: nits

* fix: nits
2022-06-22 11:05:47 -07:00
Andrew FerlitschandGitHub ccba176979 upgrade: current notebook standard (#665)
* upgrade: notebook standard

* upgrade: notebook standard

* Update sdk-feature-store.ipynb

* Update sdk-feature-store.ipynb

* Update sdk-feature-store.ipynb

* fix: aip reference

* fix: nits

* fix: nits
2022-06-22 11:05:07 -07:00
Andrew FerlitschandGitHub 1b8f383897 upgrade: current notebook standard (#663)
* update: current standards

* update: current standards

* fix: bucket

* fix: bucket
2022-06-22 09:36:49 -07:00
Andrew FerlitschandGitHub e5cd9e86d2 upgrade: notebook to latest standard (#651)
* fix: missed nits

* fix: missed nits
2022-06-22 08:56:10 -07:00
Andrew FerlitschandGitHub a7e86a4f26 upgrade: current notebook standard (#668)
* upgrade: current notebook standard

* upgrade: current notebook standard

* Update sdk-metric-parameter-tracking-for-locally-trained-models.ipynb
2022-06-21 20:23:18 -07:00
Ivan CheungandGitHub 8f0c73b32c Fixed cleanup scripts (#676) 2022-06-21 20:13:37 -07:00
Andrew FerlitschandGitHub c7d7b48a91 upgrade: notebook to current standards (#650)
* upgrade: current standards

* upgrade: current standards
2022-06-21 18:25:25 -07:00
Karl WeinmeisterandGitHub 583eb90f07 fix: CONTRIBUTING.md did not have nbfmt as final step 2022-06-20 13:56:49 -05:00
c3a9249c0c Workaround tensorboard/GCS issue for Cloud Shell (#386)
* Workaround tensorboard/GCS issue for Cloud Shell

Without `--load_fast=false` there will be `401 Unauthorized` for GCS log loads. 
See https://github.com/tensorflow/tensorboard/issues/4784#issuecomment-868945650

* PR #386: Fix missing import

`import json` was missing.

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-06-19 10:07:09 -05:00
Karl WeinmeisterandGitHub 81b70e779c ci: Remove protobuf from requirements.txt 2022-06-19 09:38:45 -05:00
Karl WeinmeisterandGitHub 085713a818 ci: Add protobuf to requirements.txt 2022-06-18 17:20:45 -05:00
Karl WeinmeisterandGitHub 5af7c851dc Fix: update typo in GAPIC Feature Store notebook 2022-06-18 17:10:49 -05:00
691312d467 Add import feature analysis config sample code into gapic-feature-sto… (#548)
* Add import feature analysis config sample code into gapic-feature-store.ipynb

* Fixing linter for gapic-feature-store.ipynb

Co-authored-by: Ivan Cheung <ivans.mailbox@gmail.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-06-18 17:09:37 -05:00
650c256c13 Fixes link to colab (#627)
Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-06-18 16:26:36 -05:00
9b00c4380b chore(deps): update actions/setup-python action to v4 (#622)
Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-06-18 16:21:49 -05:00
Karl WeinmeisterandGitHub 4851457e93 ci: Add Python version to support setup-python v4 2022-06-18 16:19:09 -05:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Karl Weinmeister
1c54878fab build(deps): bump tensorflow (#595)
Bumps [tensorflow](https://github.com/tensorflow/tensorflow) from 2.5.3 to 2.7.2.
- [Release notes](https://github.com/tensorflow/tensorflow/releases)
- [Changelog](https://github.com/tensorflow/tensorflow/blob/master/RELEASE.md)
- [Commits](https://github.com/tensorflow/tensorflow/compare/v2.5.3...v2.7.2)

---
updated-dependencies:
- dependency-name: tensorflow
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-06-18 16:08:07 -05:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
c139b84454 build(deps): bump tensorflow (#593)
Bumps [tensorflow](https://github.com/tensorflow/tensorflow) from 2.5.3 to 2.7.2.
- [Release notes](https://github.com/tensorflow/tensorflow/releases)
- [Changelog](https://github.com/tensorflow/tensorflow/blob/master/RELEASE.md)
- [Commits](https://github.com/tensorflow/tensorflow/compare/v2.5.3...v2.7.2)

---
updated-dependencies:
- dependency-name: tensorflow
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-18 16:02:53 -05:00
15c38b4ca6 chore(deps): update dependency pyupgrade to v2.34.0 (#457)
Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-06-18 15:59:54 -05:00
Ivan CheungandGitHub 271c949a71 Update README.md (#642) 2022-06-17 14:59:05 -07:00
Andrew FerlitschandGitHub 09b5401434 update: fine-tuning notebook (#641)
* feat: add example of import from dataframe

* feat: add example of import from dataframe

* update: change in required perms

* update: change in required perms

* review: updates from review

* review: updates from review

* updates: fine tuning
2022-06-17 13:41:10 -07:00
dad76547f0 inardini - mobile gaming feature store blog review (#635)
* review content and image

* linter test passed

* andy review fixes

* linter test passed

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-06-17 10:39:18 -07:00
Andrew FerlitschandGitHub c14a110c81 Update get_started_with_custom_training_pipeline_components.ipynb 2022-06-16 14:24:08 -07:00
Andrew FerlitschandGitHub d1e16546cc Update get_started_with_bqml_pipeline_components.ipynb 2022-06-16 14:23:29 -07:00
Andrew FerlitschandGitHub f91bc3d0c9 Update get_started_with_bq_tfdv_pipeline_components.ipynb 2022-06-16 14:22:56 -07:00
Andrew FerlitschandGitHub 5168808b6c fix: colab link 2022-06-16 14:22:23 -07:00
Andrew FerlitschandGitHub 501cca7b5e fix: colab link 2022-06-16 14:21:31 -07:00
Andrew FerlitschandGitHub f19d40d858 Update mlops_experimentation.ipynb 2022-06-16 13:49:17 -07:00
Andrew FerlitschandGitHub 5a721ce01d Update get_started_with_visionapi_and_automl.ipynb 2022-06-16 13:48:31 -07:00
Andrew FerlitschandGitHub 66421fb4d8 fix: colab link 2022-06-16 13:47:47 -07:00
Andrew FerlitschandGitHub 3658ee8c88 Update get_started_with_tabnet.ipynb 2022-06-16 13:46:10 -07:00
Andrew FerlitschandGitHub afaab4bb02 Update get_started_with_cmek_training.ipynb 2022-06-16 13:45:08 -07:00
Andrew FerlitschandGitHub c1e004bdff fix: colab link 2022-06-16 13:44:22 -07:00
Andrew FerlitschandGitHub 874e5a3ef5 Update get_started_vertex_training_xgboost.ipynb 2022-06-16 13:43:11 -07:00
Andrew FerlitschandGitHub 51529f370c fix: broken table 2022-06-16 13:41:01 -07:00
Andrew FerlitschandGitHub 5ddf98866c Update get_started_vertex_training_sklearn.ipynb 2022-06-16 13:40:22 -07:00
Andrew FerlitschandGitHub fbb6830876 fix: colab link 2022-06-16 13:30:01 -07:00
Andrew FerlitschandGitHub ee1bb281da fix: colab link 2022-06-16 13:28:16 -07:00
Andrew FerlitschandGitHub da2f7e88fe fix: update location of public dataset bucket 2022-06-16 12:43:15 -07:00
Andrew FerlitschandGitHub 3fb28e353f fix: remove internal link 2022-06-16 12:40:02 -07:00
Andrew FerlitschandGitHub c8e7f44f0a fix: updates from review (#640)
* feat: add example of import from dataframe

* feat: add example of import from dataframe

* update: change in required perms

* update: change in required perms

* review: updates from review

* review: updates from review
2022-06-16 12:36:28 -07:00
3d9049aeeb remove old hard-coded instances for prediction (#633)
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-06-16 11:50:01 -07:00
Andrew FerlitschandGitHub 7b8726af24 fix: perms for using MR in BQML (#634)
* feat: add example of import from dataframe

* feat: add example of import from dataframe

* update: change in required perms

* update: change in required perms
2022-06-15 14:55:17 -07:00
Andrew FerlitschandGitHub 0443b05360 feat: add create tabular dataset from dataframe example (#632)
* feat: add example of import from dataframe

* feat: add example of import from dataframe
2022-06-14 11:44:30 -07:00
Ivan CheungandGitHub e422dbdef2 Added official version of tabular regression batch bq (#331)
* Added official version of tabular regression batch bq

* Ran linter

* Fixed cleanup

* Additional cleanup

* Added working version

* Refactored and made work

* Ran linter and cleaned up

* Renamed aip to aiplatform

* Replaced online with batch

* Renamed notebook

* Ran linter and cleaned up

* Fixed bug

* Fixed SQL by adding backticks

* Install google-cloud-bigquery[all]

* Refactored datasets

* Ran linter

* Removed GCS cells

* Fixed import file

* Fixed SQL issues and added cleanup of training dataset

* Fixed hardcorded table

* Fixed brand names

* Fixed header

* Fixed results table

* Addressed tech writing review comments

* Ran linter
2022-06-14 14:14:06 -04:00
Andrew FerlitschandGitHub ec5fc0b1c8 Update get_started_vertex_training_r.ipynb 2022-06-14 10:05:36 -07:00
Andrew FerlitschandGitHub c52e3f20ba Update get_started_vertex_training_pytorch.ipynb 2022-06-14 10:04:45 -07:00
Andrew FerlitschandGitHub e367dceceb Update get_started_vertex_training_lightgbm.ipynb 2022-06-14 10:04:11 -07:00
Andrew FerlitschandGitHub 19b8666808 Update get_started_vertex_training.ipynb 2022-06-14 10:03:24 -07:00
Andrew FerlitschandGitHub a2df0e9fca Update get_started_vertex_tensorboard.ipynb 2022-06-14 10:01:52 -07:00
Andrew FerlitschandGitHub 73b094550e Update get_started_vertex_feature_store.ipynb 2022-06-14 09:59:24 -07:00
Andrew FerlitschandGitHub d05ae109e1 Update get_started_vertex_experiments.ipynb 2022-06-14 09:57:55 -07:00
Andrew FerlitschandGitHub fdb25791d5 Update get_started_vertex_distributed_training.ipynb 2022-06-14 09:57:19 -07:00
Andrew FerlitschandGitHub 5a88492498 Update get_started_bqml_training.ipynb 2022-06-14 09:56:34 -07:00
Andrew FerlitschandGitHub f19a12b829 Update get_started_automl_training.ipynb 2022-06-14 09:55:53 -07:00
Andrew FerlitschandGitHub 3ed0ea73f4 Update get_started_bq_datasets.ipynb 2022-06-14 09:08:47 -07:00
Andrew FerlitschandGitHub b98fd24a72 Update get_started_bq_datasets.ipynb 2022-06-13 21:29:41 -07:00
Andrew FerlitschandGitHub eb4e9a0f91 Update get_started_vertex_datasets.ipynb 2022-06-13 21:27:16 -07:00
Andrew FerlitschandGitHub ec7c136b0a Update get_started_vertex_datasets.ipynb 2022-06-13 21:26:24 -07:00
Andrew FerlitschandGitHub ee7e43cc1a Update mlops_data_management.ipynb 2022-06-13 20:24:57 -07:00
Andrew FerlitschandGitHub ea9f5f3c5c Update get_started_with_data_labeling.ipynb 2022-06-13 20:24:22 -07:00
Andrew FerlitschandGitHub bd44798412 Update get_started_vertex_datasets.ipynb 2022-06-13 20:23:37 -07:00
Andrew FerlitschandGitHub 2af0cc0f80 fix: test for local execution 2022-06-13 20:22:57 -07:00
Andrew FerlitschandGitHub 5c0fa14d2d Update get_started_bq_datasets.ipynb 2022-06-13 20:21:44 -07:00
Andrew FerlitschandGitHub 7cc50d3203 Update README.md 2022-06-13 13:58:20 -07:00
Andrew FerlitschandGitHub 9c7da13177 Update gapic-vizier-multi-objective-optimization.ipynb 2022-06-13 08:39:33 -07:00
Andrew FerlitschandGitHub 45e0645f0b Update gapic-vizier-multi-objective-optimization.ipynb 2022-06-13 08:38:55 -07:00
Andrew FerlitschandGitHub cb884cc74a Update gapic-vizier-multi-objective-optimization.ipynb 2022-06-13 08:38:22 -07:00
Ivan CheungandGitHub d3a6475580 Fixed mistake in batch prediction request section (#617)
* Fixed mistake in batch prediction request section

* Fixed linter requirements
2022-06-10 17:13:45 -04:00
4e7061b2db added MLPerf benchmark reference and updated Criteo sample to use GRPC for stock containers (#630)
* added MLPerf benchmark reference and updated Criteo sample to use GRPC for stock containers

* addressed feedback for BERT sample and did similar changes to Criteo sample

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-06-10 12:06:25 -07:00
Ivan CheungandGitHub 0250879f65 Added notebook substitution for common case of 1 notebook (#625) 2022-06-10 14:44:43 -04:00
Andrew FerlitschandGitHub 5cee23ae68 Update get_started_with_autoscaling.ipynb 2022-06-09 15:02:28 -07:00
Andrew FerlitschandGitHub d518558b3d Update README.md 2022-06-09 15:01:55 -07:00
Andrew FerlitschandGitHub 5c085c843f feat: notebook on autoscaling (#629)
* feat: XAI + custom server

* feat: add DIY MLMD for AutoML

* feat: add DIY MLMD for AutoML

* fix: replace BLAH

* fix: replace BLAH

* update: AutoML + MLMD

* update: AutoML + MLMD

* co-hosting

* co-hosting

* feat: new R notebook

* feat: new R notebook

* feat: airflow+vertex

* feat: airflow+vertex

* feat: notebook on autoscaling

* feat: notebook on autoscaling
2022-06-09 14:57:41 -07:00
Michael HuandGitHub 936b434ac4 fix: typo in links in bqml arima notebook (#616)
Notebook used as template had incorrect link format. Apply the same fixes as #514 to the arima notebook.
2022-06-09 17:52:12 -04:00
Michael HuandGitHub 43059c9fd9 fix: pin protobuf version to 3.19.0 (#621) 2022-06-09 12:49:45 -07:00
Andrew FerlitschandGitHub 19f72d426d fix: typos 2022-06-08 11:59:37 -07:00
Andrew FerlitschandGitHub 14ecaf3023 Update README.md 2022-06-08 11:58:18 -07:00
Andrew FerlitschandGitHub 80c93a9b6d feat: airflow with vertex pipelines (#624)
* feat: XAI + custom server

* feat: add DIY MLMD for AutoML

* feat: add DIY MLMD for AutoML

* fix: replace BLAH

* fix: replace BLAH

* update: AutoML + MLMD

* update: AutoML + MLMD

* co-hosting

* co-hosting

* feat: new R notebook

* feat: new R notebook

* feat: airflow+vertex

* feat: airflow+vertex
2022-06-08 11:55:11 -07:00
Andrew FerlitschandGitHub 06a1b4dc57 Update README.md 2022-06-07 09:48:16 -07:00
Andrew FerlitschandGitHub 4e779eedf1 Update README.md 2022-06-07 09:45:10 -07:00
Andrew FerlitschandGitHub afb341f5fd feat: new R notebook (#618)
* feat: XAI + custom server

* feat: add DIY MLMD for AutoML

* feat: add DIY MLMD for AutoML

* fix: replace BLAH

* fix: replace BLAH

* update: AutoML + MLMD

* update: AutoML + MLMD

* co-hosting

* co-hosting

* feat: new R notebook

* feat: new R notebook
2022-06-07 09:39:44 -07:00
e34b0fa115 chore(deps): pin dependency protobuf to v (#606)
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-06-06 18:13:56 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
6fa0345f25 build(deps): bump tensorflow (#596)
Bumps [tensorflow](https://github.com/tensorflow/tensorflow) from 2.5.3 to 2.7.2.
- [Release notes](https://github.com/tensorflow/tensorflow/releases)
- [Changelog](https://github.com/tensorflow/tensorflow/blob/master/RELEASE.md)
- [Commits](https://github.com/tensorflow/tensorflow/compare/v2.5.3...v2.7.2)

---
updated-dependencies:
- dependency-name: tensorflow
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-06 18:09:52 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Andrew Ferlitsch
dd43ae6639 build(deps): bump tensorflow (#594)
Bumps [tensorflow](https://github.com/tensorflow/tensorflow) from 2.5.3 to 2.7.2.
- [Release notes](https://github.com/tensorflow/tensorflow/releases)
- [Changelog](https://github.com/tensorflow/tensorflow/blob/master/RELEASE.md)
- [Commits](https://github.com/tensorflow/tensorflow/compare/v2.5.3...v2.7.2)

---
updated-dependencies:
- dependency-name: tensorflow
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-06-06 18:08:37 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Ivan CheungAndrew Ferlitsch
840385e0a7 build(deps): bump tensorflow (#592)
Bumps [tensorflow](https://github.com/tensorflow/tensorflow) from 2.5.3 to 2.7.2.
- [Release notes](https://github.com/tensorflow/tensorflow/releases)
- [Changelog](https://github.com/tensorflow/tensorflow/blob/master/RELEASE.md)
- [Commits](https://github.com/tensorflow/tensorflow/compare/v2.5.3...v2.7.2)

---
updated-dependencies:
- dependency-name: tensorflow
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ivan Cheung <ivans.mailbox@gmail.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-06-06 18:07:48 -07:00
Michael HuandGitHub 9daaf51a1f add bqml arima and vertex forecasting comparison notebook (#581)
Adds a notebook that demonstrates how to compare a Vertex Forecasting model against a BQML ARIMA+ model trained using a first-party GCPC pipeline.
2022-06-06 20:48:30 -04:00
Andrew FerlitschandGitHub 9b2511e54e Update README.md 2022-06-06 13:38:55 -07:00
Andrew FerlitschandGitHub b6674e6540 feat: notebook for co-hosting models (#615)
* feat: XAI + custom server

* feat: add DIY MLMD for AutoML

* feat: add DIY MLMD for AutoML

* fix: replace BLAH

* fix: replace BLAH

* update: AutoML + MLMD

* update: AutoML + MLMD

* co-hosting

* co-hosting
2022-06-06 13:35:47 -07:00
Ivan CheungandGitHub a109cb6d44 fix: Added explanations output to forecasting notebook (#613)
* Added explanations output to forecasting notebook

* Simplified and added XAI

* Fix conflicts

* Ran linter

* Fixed batch prediction request explanation
2022-06-06 10:00:07 -07:00
Ivan CheungandGitHub f730d6b9de Added ability to test a single notebook (#608)
* Added ability to test a single notebook

* Added output_url to table

* Removed ML Ops notebooks
2022-06-06 10:30:31 -04:00
0947f2792d Made some minor changes to Sdk big query custom container training (#522)
* minor changes done

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-06-05 12:58:45 -07:00
dbf19acde4 Adds the updated telecom-subscriber-churn-prediction notebook to official and removes from community (#506)
* updates and adds the telecom-subscriber-churn-prediction notebook to official and removes from the community

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-06-05 12:53:21 -07:00
1aaa833153 Adds manual-scaling config and explanation to the Automl-forecasting-batch notebook in official folder (#514)
* adds manual-scaling config and explanation to the notebook

* ran linter test after installing linter requirement updates

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-06-05 12:50:23 -07:00
c73d995680 Made minor changes to sdk_automl_image_object_detection_batch.ipynb file (#513)
* modified notebook

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-06-05 12:45:55 -07:00
3fe5028724 Malansari automl vision api notebook update (#612)
* Delete revised version

* Copy notebook from /notebooks/official

* Renamed base notebook

* Added first version by mansari@

* Updated to revised version by andrewferlitsch@

* Added author / reviewer information

Added sample files

* Updated CODEOWNERS

* Fixed links for opening the notebook in Colab/Github/Vertex

Removed installation of and references to pandas

Fixed gcs_annotation_file_name string reference

* Fixed the links for opening notebook (again!)

* Added attribution and references

* Removed references as covered at top

* Updated installation commands to match

* Updated Vertex AI region name to be more clear

* Added db-types dependency for pandas operations
that are now failing

* Minor edits

* Combined package installation and
added a note to ignore the errors

* Minor edit to message

* Added special thanks to andrewferlitsch@

* Updated andrewferlitsch@ GithHub profile link

* Updated sample files URLs to absolute URLs

* Removed empty code block

* Added additional attribution (and the one that did not make it into previous commit!)

* Fixed multi-package import formatting
Switched to pandas instead of db-dtypes

* Fixed isort issue

* Removed unnecessary pandas import

* Formatted the notebook with nbfmt

* Additional notebook formatting

* Updated link to open in Vertex AI Workbench
to point to raw .ipynb file

* Fixed lint issues

* Formatting changes

Added additional APIs to be enabled

* Fixed sample dataset link to point to public version

* Fixed linting issues

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-06-04 09:14:23 -07:00
Andrew FerlitschandGitHub 44dd24f910 Update README.md 2022-06-02 15:57:04 -07:00
Andrew FerlitschandGitHub c20a9c4e63 update: AutoML + MLMD (#605)
* feat: XAI + custom server

* feat: add DIY MLMD for AutoML

* feat: add DIY MLMD for AutoML

* fix: replace BLAH

* fix: replace BLAH

* update: AutoML + MLMD

* update: AutoML + MLMD
2022-06-02 15:50:05 -07:00
Ivan CheungandGitHub edffdf34b7 Pin protobuf version to avoid broken dependencies. 2022-06-02 17:25:28 -04:00
340c24c5b4 Added custom container explainability notebook (#564)
* Commit for lint

* Commit after name change

* Commit of notebook and CODEOWNERS

Added custom container with xai notebook, and explainable_ai folder in the community folder

* Removed extra copy of file

* Remove extra file

* Updated per review from DPE

* Lint test updates

* linter ran

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-06-02 12:28:15 -07:00
Andrew FerlitschandGitHub 11f20f3f08 fix: replace BLAH (#600)
* feat: XAI + custom server

* feat: add DIY MLMD for AutoML

* feat: add DIY MLMD for AutoML

* fix: replace BLAH

* fix: replace BLAH
2022-06-01 11:19:02 -07:00
Andrew FerlitschandGitHub 199b330aa5 Update get_started_automl_mlmd.ipynb 2022-05-31 18:37:05 -07:00
Andrew FerlitschandGitHub 5143db1024 feat: Add DIY MLMD with AutoML (#598)
* feat: XAI + custom server

* feat: add DIY MLMD for AutoML

* feat: add DIY MLMD for AutoML
2022-05-31 18:35:23 -07:00
Andrew FerlitschandGitHub 2f0bd3de15 fix: correct reference to service 2022-05-31 13:50:51 -07:00
Andrew FerlitschandGitHub 4d6c541967 feat: XAI + custom server (#597) 2022-05-31 13:31:20 -07:00
Andrew FerlitschandGitHub 5228a5c978 Update README.md 2022-05-31 12:47:16 -07:00
Andrew FerlitschandGitHub c6118bd17d feat: start stage 7 (#591)
* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* feat: swivel and matching engine

* feat: swivel and matching engine

* feat: LightGBM

* feat: LightGBM

* feat: start stage7

* feat: start stage8
2022-05-31 09:48:49 -07:00
Andrew FerlitschandGitHub d2c9e84af4 Add files via upload 2022-05-26 09:30:17 -07:00
Andrew FerlitschandGitHub fe0a0ff055 Update README.md 2022-05-26 09:30:04 -07:00
Andrew FerlitschandGitHub 40e287245d Delete stage5v2.png 2022-05-26 09:29:50 -07:00
Andrew FerlitschandGitHub c79646a537 Add files via upload 2022-05-26 09:26:24 -07:00
Andrew FerlitschandGitHub e293e1c2fb Update README.md 2022-05-26 09:26:09 -07:00
Andrew FerlitschandGitHub f2ab65bd03 Delete stage4v2.png 2022-05-26 09:25:51 -07:00
Andrew FerlitschandGitHub aa686516d3 Add files via upload 2022-05-25 14:42:01 -07:00
Andrew FerlitschandGitHub 11c80a0251 Update README.md 2022-05-25 14:41:45 -07:00
Andrew FerlitschandGitHub c5e9e5812b Delete stage3v2.png 2022-05-25 14:41:29 -07:00
Andrew FerlitschandGitHub 98b126fa0b Update README.md 2022-05-25 14:34:29 -07:00
Andrew FerlitschandGitHub 55553f9e69 Update README.md 2022-05-25 14:33:56 -07:00
Andrew FerlitschandGitHub 563013c745 Add files via upload 2022-05-25 14:33:10 -07:00
Andrew FerlitschandGitHub fefb9778a7 Update README.md 2022-05-25 14:32:53 -07:00
Andrew FerlitschandGitHub be1831082c Update README.md 2022-05-25 14:11:47 -07:00
Andrew FerlitschandGitHub 9e15ee2e8a Add files via upload 2022-05-25 14:11:21 -07:00
Andrew FerlitschandGitHub ceff7d7271 Delete stage2v2.png 2022-05-25 14:10:51 -07:00
Andrew FerlitschandGitHub df9b5cd6f0 Add files via upload 2022-05-24 16:17:27 -07:00
Andrew FerlitschandGitHub bc57801525 Update README.md 2022-05-24 16:17:06 -07:00
Andrew FerlitschandGitHub 1b403373d3 Delete stage1.png 2022-05-24 16:16:49 -07:00
Andrew FerlitschandGitHub 987fb74ca6 Add files via upload 2022-05-24 15:13:15 -07:00
Andrew FerlitschandGitHub 65a209bc7b Update README.md 2022-05-24 15:12:55 -07:00
Andrew FerlitschandGitHub 16e6d9e90f Delete stage6c.png 2022-05-24 15:12:32 -07:00
Andrew FerlitschandGitHub 7ce6bee763 Delete stage6b.png 2022-05-24 15:12:18 -07:00
Andrew FerlitschandGitHub 6d7ca3eb55 Delete stage6a.png 2022-05-24 15:12:05 -07:00
Andrew FerlitschandGitHub 8e9f205e9a Add files via upload 2022-05-24 14:58:15 -07:00
Andrew FerlitschandGitHub 5fdb6c4368 Update README.md 2022-05-24 14:57:50 -07:00
Andrew FerlitschandGitHub 71ebfd402c Delete stage5.png 2022-05-24 14:57:33 -07:00
Andrew FerlitschandGitHub 6e4ca83531 Update README.md 2022-05-24 14:43:12 -07:00
Andrew FerlitschandGitHub 05793d6a3c Add files via upload 2022-05-24 14:42:39 -07:00
Andrew FerlitschandGitHub 3dc374b7db Delete stage4.png 2022-05-24 14:42:13 -07:00
Andrew FerlitschandGitHub 3ac8a4f617 Add files via upload 2022-05-24 14:22:20 -07:00
Andrew FerlitschandGitHub 21b4b5b063 Delete stage3v3.png 2022-05-24 14:22:11 -07:00
Andrew FerlitschandGitHub 9ffd921ca4 Update README.md 2022-05-24 14:21:38 -07:00
Andrew FerlitschandGitHub 14e6ebbb95 Add files via upload 2022-05-24 14:21:08 -07:00
Andrew FerlitschandGitHub 277b685a39 Delete stage3.png 2022-05-24 14:20:58 -07:00
Andrew FerlitschandGitHub 67e7715ed9 Update README.md 2022-05-24 13:59:19 -07:00
Andrew FerlitschandGitHub bb87900209 Add files via upload 2022-05-24 13:58:51 -07:00
Andrew FerlitschandGitHub 96ebe7286b Delete stage2.png 2022-05-24 13:58:24 -07:00
Andrew FerlitschandGitHub 0b3a5dde09 Add files via upload 2022-05-24 13:57:41 -07:00
Andrew FerlitschandGitHub 17a30360b4 Delete stage2.png 2022-05-24 13:57:24 -07:00
Andrew FerlitschandGitHub b386f51916 Update README.md 2022-05-24 13:40:25 -07:00
Andrew FerlitschandGitHub dd4f40c7f4 Add files via upload 2022-05-24 13:39:51 -07:00
Andrew FerlitschandGitHub d402fc085a Delete stage1.jpg 2022-05-24 13:39:38 -07:00
Andrew FerlitschandGitHub a12b9cd60f Add files via upload 2022-05-24 13:38:11 -07:00
Andrew FerlitschandGitHub bf1032d550 Delete stage1.jpg 2022-05-24 13:38:01 -07:00
Andrew FerlitschandGitHub dea05e1e36 Add files via upload 2022-05-24 13:36:59 -07:00
Andrew FerlitschandGitHub a9f0117c82 Update README.md 2022-05-23 17:09:39 -07:00
Andrew FerlitschandGitHub 83f1fe9ecd Add files via upload 2022-05-23 17:08:06 -07:00
Andrew FerlitschandGitHub 7344274037 Add files via upload 2022-05-23 17:06:53 -07:00
Andrew FerlitschandGitHub e36bfa9a3b Add files via upload 2022-05-23 17:03:27 -07:00
Andrew FerlitschandGitHub 950aa245b8 Update README.md 2022-05-23 16:55:52 -07:00
Andrew FerlitschandGitHub ac47b2e370 Update README.md 2022-05-20 13:01:42 -07:00
Andrew FerlitschandGitHub 6662fc809b Update README.md 2022-05-20 13:00:49 -07:00
Andrew FerlitschandGitHub 12b3171d5e feat: LightGBM (#583)
* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* feat: swivel and matching engine

* feat: swivel and matching engine

* feat: LightGBM

* feat: LightGBM
2022-05-20 12:58:37 -07:00
Andrew FerlitschandGitHub 579d4751bd Update README.md 2022-05-20 12:41:10 -07:00
Andrew FerlitschandGitHub d4c607323d feat: swivel + ME (#582)
* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* feat: swivel and matching engine

* feat: swivel and matching engine
2022-05-20 12:39:42 -07:00
nayaknishantandGitHub 3ad30738a7 docs: fixing CODEOWNERS and instructions hyperlinks (#580)
When opening a PR, the CODEOWNERS and instructions hyperlinks throw a 404 error because they point to a URL that has been changed. Fixing these hyperlinks.
2022-05-19 13:20:23 -07:00
Andrew FerlitschandGitHub 119273ae7e Ml.googleapis fix (#579)
* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis
2022-05-19 12:42:55 -07:00
Andrew FerlitschandGitHub 95bc39a685 fix: enable APIs stage5 (#578)
* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis
2022-05-19 12:30:11 -07:00
Andrew FerlitschandGitHub b054104851 fix: enable APIs stage4 (#577)
* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis
2022-05-19 12:23:49 -07:00
Andrew FerlitschandGitHub e0e0cf849a fix: enable APIs stage3 (#576)
* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis
2022-05-19 12:15:29 -07:00
Andrew FerlitschandGitHub c95b3d7088 fix : enable APIs stage2 (#575)
* fix: enable apis

* fix: enable apis

* fix: enable apis

* fix: enable apis
2022-05-19 11:51:49 -07:00
Andrew FerlitschandGitHub 19c2bdb008 fix: enable APIs stage1 (#574)
* fix: enable apis

* fix: enable apis
2022-05-19 11:36:12 -07:00
Andrew FerlitschandGitHub 3c815f3888 update: new template edition (#572)
* fix: new template review updates

* fix: new template review updates

* mport -> import

* fix: dummy code sample required an import

dummy code samples (not otherwise part of template) -- should be self contained since they will be deleted by the template user.

* fix: added install for self-contained code passes ingestion test

* fix: example code (not otherwise part of template) not self-contained.

* fix: continue update so code example is self-contained

* update: numpy already installed in test env
2022-05-19 11:24:19 -07:00
cfcd9b29fd Malansari automl vision api notebook (#573)
* Delete revised version

* Copy notebook from /notebooks/official

* Renamed base notebook

* Added first version by mansari@

* Updated to revised version by andrewferlitsch@

* Added author / reviewer information

Added sample files

* Updated CODEOWNERS

* Fixed links for opening the notebook in Colab/Github/Vertex

Removed installation of and references to pandas

Fixed gcs_annotation_file_name string reference

* Fixed the links for opening notebook (again!)

* Added attribution and references

* Removed references as covered at top

* Updated installation commands to match

* Updated Vertex AI region name to be more clear

* Added db-types dependency for pandas operations
that are now failing

* Minor edits

* Combined package installation and
added a note to ignore the errors

* Minor edit to message

* Added special thanks to andrewferlitsch@

* Updated andrewferlitsch@ GithHub profile link

* Updated sample files URLs to absolute URLs

* Removed empty code block

* Added additional attribution (and the one that did not make it into previous commit!)

* Fixed multi-package import formatting
Switched to pandas instead of db-dtypes

* Fixed isort issue

* Removed unnecessary pandas import

* Formatted the notebook with nbfmt

* Additional notebook formatting

* Updated link to open in Vertex AI Workbench
to point to raw .ipynb file

* Fixed lint issues

* Formatting changes

Added additional APIs to be enabled

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-05-19 11:14:17 -07:00
Ivan CheungandGitHub 4fca7d98b2 Increases notebook concurrency and linted CI files (#512)
* Fixed private pool issues

* Ran linter

* Added worker timeouts

* Tweaked timeout

* Removed gcloud requirement

* Removed unneeded file
2022-05-18 18:58:54 -04:00
Andrew FerlitschandGitHub dea950bcb6 fix: DPE styling (#570)
* fix: DPE-style tuning

* fix: DPE-style tuning

* fix: DPE-style tuning

* fix: DPE-style tuning

* fix: DPE-style tuning
2022-05-18 14:32:30 -07:00
Andrew FerlitschandGitHub 4c43755fb6 Mlops 8v3 (#569)
* fix: DPE-style tuning

* fix: DPE-style tuning

* fix: DPE-style tuning
2022-05-18 14:11:31 -07:00
Andrew FerlitschandGitHub 374942a9e9 fix: DPE-style tuning (#568) 2022-05-18 14:01:13 -07:00
Andrew FerlitschandGitHub 8add418428 Mlops 8v2 (#567)
* fix: two towers

* fix: two towers

* fix: typos in twotowers

* fix: typos in twotowers

* fix: DPE-style tuning

* fix: DPE-style tuning

* fix: DPE-style tuning

* fix: DPE-style tuning

* fix: DPE-style tuning

* fix: DPE-style tuning
2022-05-18 13:46:24 -07:00
Andrew FerlitschandGitHub 9d73cc4574 fix: DPE style tuning (#566)
* fix: two towers

* fix: two towers

* fix: typos in twotowers

* fix: typos in twotowers

* fix: DPE-style tuning

* fix: DPE-style tuning

* fix: DPE-style tuning

* fix: DPE-style tuning
2022-05-18 13:29:45 -07:00
Andrew FerlitschandGitHub 5edb4bb1bf fix: DPE-styling (#565)
* fix: two towers

* fix: two towers

* fix: typos in twotowers

* fix: typos in twotowers

* fix: DPE-style tuning

* fix: DPE-style tuning
2022-05-18 12:29:01 -07:00
Andrew FerlitschandGitHub 0e811868d3 fix: links 2022-05-18 11:33:56 -07:00
Andrew FerlitschandGitHub 9efcfa25e8 fix: links 2022-05-18 11:27:11 -07:00
48036cf581 vision api notebook - updated link to open in Vertex AI Workbench (#562)
* Delete revised version

* Copy notebook from /notebooks/official

* Renamed base notebook

* Added first version by mansari@

* Updated to revised version by andrewferlitsch@

* Added author / reviewer information

Added sample files

* Updated CODEOWNERS

* Fixed links for opening the notebook in Colab/Github/Vertex

Removed installation of and references to pandas

Fixed gcs_annotation_file_name string reference

* Fixed the links for opening notebook (again!)

* Added attribution and references

* Removed references as covered at top

* Updated installation commands to match

* Updated Vertex AI region name to be more clear

* Added db-types dependency for pandas operations
that are now failing

* Minor edits

* Combined package installation and
added a note to ignore the errors

* Minor edit to message

* Added special thanks to andrewferlitsch@

* Updated andrewferlitsch@ GithHub profile link

* Updated sample files URLs to absolute URLs

* Removed empty code block

* Added additional attribution (and the one that did not make it into previous commit!)

* Fixed multi-package import formatting
Switched to pandas instead of db-dtypes

* Fixed isort issue

* Removed unnecessary pandas import

* Formatted the notebook with nbfmt

* Additional notebook formatting

* Updated link to open in Vertex AI Workbench
to point to raw .ipynb file

* Fixed lint issues

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-05-18 11:20:39 -07:00
Andrew FerlitschandGitHub 79fd9b4049 Update README.md 2022-05-17 11:05:54 -07:00
Andrew FerlitschandGitHub 46b2181a4e fix: typos in two towers (#563)
* fix: two towers

* fix: two towers

* fix: typos in twotowers

* fix: typos in twotowers
2022-05-17 11:04:01 -07:00
Andrew FerlitschandGitHub d04f25a8bd Update README.md 2022-05-16 15:13:45 -07:00
Andrew FerlitschandGitHub 9f341c350c fix: two towers (#561)
* fix: two towers

* fix: two towers
2022-05-16 15:11:44 -07:00
Ivan CheungandGitHub f22f97f680 fix: Updated matching engine dependency and fixed cases (#557)
* fix: Updated dependency and fixed cases

* Ran linter

* Renamed to Vertex AI Workbench notebook

* Additional text fixes
2022-05-16 13:06:04 -04:00
Andrew FerlitschandGitHub fe75745d44 feat: WIP: twotowers+matching engine (#560)
* feat: using Vision API for preprocessing data

* feat: using Vision API for preprocessing data

* feat: component vs job resource settings

* feat: component vs job resource settings

* feat: triton server

* feat: triton server

* feat: triton server

* feat: triton server

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* update: ModelEvaluation SDK

* update: ModelEvaluation SDK

* feat: matching engine

* feat: matching engine

* feat: wip: twotowers

* feat: wip: twotowers
2022-05-13 14:03:43 -07:00
Andrew FerlitschandGitHub bbc9f1337e Update README.md 2022-05-13 08:56:39 -07:00
Andrew FerlitschandGitHub eb1fa9213a feat: add notebook for matching engine (#559)
* feat: using Vision API for preprocessing data

* feat: using Vision API for preprocessing data

* feat: component vs job resource settings

* feat: component vs job resource settings

* feat: triton server

* feat: triton server

* feat: triton server

* feat: triton server

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* update: ModelEvaluation SDK

* update: ModelEvaluation SDK

* feat: matching engine

* feat: matching engine
2022-05-12 15:55:21 -07:00
Mohammad Al-AnsariandGitHub a7033a6527 Updates to visionapi notebook (#556)
* Delete revised version

* Copy notebook from /notebooks/official

* Renamed base notebook

* Added first version by mansari@

* Updated to revised version by andrewferlitsch@

* Added author / reviewer information

Added sample files

* Updated CODEOWNERS

* Fixed links for opening the notebook in Colab/Github/Vertex

Removed installation of and references to pandas

Fixed gcs_annotation_file_name string reference

* Fixed the links for opening notebook (again!)

* Added attribution and references

* Removed references as covered at top

* Updated installation commands to match

* Updated Vertex AI region name to be more clear

* Added db-types dependency for pandas operations
that are now failing

* Minor edits

* Combined package installation and
added a note to ignore the errors

* Minor edit to message

* Added special thanks to andrewferlitsch@

* Updated andrewferlitsch@ GithHub profile link

* Updated sample files URLs to absolute URLs

* Removed empty code block

* Added additional attribution (and the one that did not make it into previous commit!)

* Fixed multi-package import formatting
Switched to pandas instead of db-dtypes

* Fixed isort issue

* Removed unnecessary pandas import

* Formatted the notebook with nbfmt

* Additional notebook formatting
2022-05-11 11:23:50 -07:00
Andrew FerlitschandGitHub 7e6c2d69c8 update: ModelEval as SDK (#555)
* feat: using Vision API for preprocessing data

* feat: using Vision API for preprocessing data

* feat: component vs job resource settings

* feat: component vs job resource settings

* feat: triton server

* feat: triton server

* feat: triton server

* feat: triton server

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* update: ModelEvaluation SDK

* update: ModelEvaluation SDK
2022-05-10 15:33:52 -07:00
Andrew FerlitschandGitHub 1a21b81804 fix: stage5 DPE style (#554)
* feat: using Vision API for preprocessing data

* feat: using Vision API for preprocessing data

* feat: component vs job resource settings

* feat: component vs job resource settings

* feat: triton server

* feat: triton server

* feat: triton server

* feat: triton server

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench
2022-05-10 14:11:31 -07:00
Andrew FerlitschandGitHub 2bbd520613 fix: stage4 DPE styling (#553)
* feat: using Vision API for preprocessing data

* feat: using Vision API for preprocessing data

* feat: component vs job resource settings

* feat: component vs job resource settings

* feat: triton server

* feat: triton server

* feat: triton server

* feat: triton server

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench
2022-05-10 13:58:44 -07:00
Andrew FerlitschandGitHub 8285e4ebd1 Mlops 8 (#552)
* feat: using Vision API for preprocessing data

* feat: using Vision API for preprocessing data

* feat: component vs job resource settings

* feat: component vs job resource settings

* feat: triton server

* feat: triton server

* feat: triton server

* feat: triton server

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench
2022-05-10 12:56:43 -07:00
Andrew FerlitschandGitHub 859849894e fix: stage3 workbench (#551)
* feat: using Vision API for preprocessing data

* feat: using Vision API for preprocessing data

* feat: component vs job resource settings

* feat: component vs job resource settings

* feat: triton server

* feat: triton server

* feat: triton server

* feat: triton server

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench
2022-05-10 12:38:52 -07:00
Andrew FerlitschandGitHub e74dd48ae0 fix: 2nd round workbench (#550)
* feat: using Vision API for preprocessing data

* feat: using Vision API for preprocessing data

* feat: component vs job resource settings

* feat: component vs job resource settings

* feat: triton server

* feat: triton server

* feat: triton server

* feat: triton server

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench

* fix: check for workbench
2022-05-10 12:12:27 -07:00
Andrew FerlitschandGitHub a14eb71210 fix: check for workbench (#549)
* feat: using Vision API for preprocessing data

* feat: using Vision API for preprocessing data

* feat: component vs job resource settings

* feat: component vs job resource settings

* feat: triton server

* feat: triton server

* feat: triton server

* feat: triton server

* fix: check for workbench

* fix: check for workbench
2022-05-10 11:37:44 -07:00
Mohammad Al-AnsariandGitHub 0b6a9718ff Added author / reviewer informationAdded sample files (#544)
* Delete revised version

* Copy notebook from /notebooks/official

* Renamed base notebook

* Added first version by mansari@

* Updated to revised version by andrewferlitsch@

* Added author / reviewer information

Added sample files

* Updated CODEOWNERS

* Fixed links for opening the notebook in Colab/Github/Vertex

Removed installation of and references to pandas

Fixed gcs_annotation_file_name string reference
2022-05-09 13:59:59 -07:00
Andrew FerlitschandGitHub 6ac0d8a029 Update README.md 2022-05-09 13:48:00 -07:00
Andrew FerlitschandGitHub 2ee013bcab Delete get_started_nvidia_triton_serving.ipynb 2022-05-09 13:47:18 -07:00
Andrew FerlitschandGitHub 1ebb3f5714 Mlops 8 (#547)
* feat: using Vision API for preprocessing data

* feat: using Vision API for preprocessing data

* feat: component vs job resource settings

* feat: component vs job resource settings

* feat: triton server

* feat: triton server

* feat: triton server

* feat: triton server
2022-05-09 13:46:35 -07:00
Andrew FerlitschandGitHub 11c5134961 Update README.md 2022-05-09 13:40:51 -07:00
Andrew FerlitschandGitHub e328b7268f feat: triton server (#546)
* feat: using Vision API for preprocessing data

* feat: using Vision API for preprocessing data

* feat: component vs job resource settings

* feat: component vs job resource settings

* feat: triton server

* feat: triton server
2022-05-09 13:38:37 -07:00
Andrew FerlitschandGitHub d297e99e5a Update get_started_with_machine_management.ipynb 2022-05-09 12:20:03 -07:00
Andrew FerlitschandGitHub 48c7a4c82e fix: spelling 2022-05-09 12:15:07 -07:00
Andrew FerlitschandGitHub eb3b52f863 Update README.md 2022-05-09 12:10:40 -07:00
Andrew FerlitschandGitHub 4e58cca127 Update get_started_with_machine_management.ipynb 2022-05-09 12:09:07 -07:00
Andrew FerlitschandGitHub 182a98768f feat: machine resource settings (#545)
* feat: using Vision API for preprocessing data

* feat: using Vision API for preprocessing data

* feat: component vs job resource settings

* feat: component vs job resource settings
2022-05-09 12:06:56 -07:00
Andrew FerlitschandGitHub f483447235 Update README.md 2022-05-06 19:07:16 -07:00
Andrew FerlitschandGitHub c59050608b feat: vision api and automl (#543)
* feat: using Vision API for preprocessing data

* feat: using Vision API for preprocessing data
2022-05-06 19:04:43 -07:00
Andrew FerlitschandGitHub 3b9844f92c update: add co-author (#542)
* feat: add colab code for docker

* feat: add colab code for docker

* fix: add colab support for docker

* fix: add colab support for docker

* fix: delete tmp BQ model

* fix: delete tmp BQ model

* feat: GAPIC->SDK for private endpoints

* feat: GAPIC->SDK for private endpoints

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* feat: more model eval work

* feat: more model eval work

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLABA

* feat: add notebook for TFX

* feat: add notebook for TFX

* feat: add notebook for TFX

* fix: mistakes

* fix: mistakes

* fix: vertex ai compatibility

* fix: vertex ai compatibility

* fix: workbench auth

* fix: workbench auth

* update: add co-author

* update: add co-author
2022-05-06 15:27:05 -07:00
Andrew FerlitschandGitHub ee301a22f6 clean: remove BLAH 2022-05-06 12:38:30 -07:00
Andrew FerlitschandGitHub b7d16f66aa fix: workbench auth (#541)
* feat: add colab code for docker

* feat: add colab code for docker

* fix: add colab support for docker

* fix: add colab support for docker

* fix: delete tmp BQ model

* fix: delete tmp BQ model

* feat: GAPIC->SDK for private endpoints

* feat: GAPIC->SDK for private endpoints

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* feat: more model eval work

* feat: more model eval work

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLABA

* feat: add notebook for TFX

* feat: add notebook for TFX

* feat: add notebook for TFX

* fix: mistakes

* fix: mistakes

* fix: vertex ai compatibility

* fix: vertex ai compatibility

* fix: workbench auth

* fix: workbench auth
2022-05-06 10:18:06 -07:00
Andrew FerlitschandGitHub 57aad5b802 fix: compat issue with Vertex AI and TFX Transform (#540)
* feat: add colab code for docker

* feat: add colab code for docker

* fix: add colab support for docker

* fix: add colab support for docker

* fix: delete tmp BQ model

* fix: delete tmp BQ model

* feat: GAPIC->SDK for private endpoints

* feat: GAPIC->SDK for private endpoints

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* feat: more model eval work

* feat: more model eval work

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLABA

* feat: add notebook for TFX

* feat: add notebook for TFX

* feat: add notebook for TFX

* fix: mistakes

* fix: mistakes

* fix: vertex ai compatibility

* fix: vertex ai compatibility
2022-05-05 19:04:13 -07:00
Andrew FerlitschandGitHub 9e311433ba fix: mistakes in tfx notebook (#539)
* feat: add colab code for docker

* feat: add colab code for docker

* fix: add colab support for docker

* fix: add colab support for docker

* fix: delete tmp BQ model

* fix: delete tmp BQ model

* feat: GAPIC->SDK for private endpoints

* feat: GAPIC->SDK for private endpoints

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* feat: more model eval work

* feat: more model eval work

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLABA

* feat: add notebook for TFX

* feat: add notebook for TFX

* feat: add notebook for TFX

* fix: mistakes

* fix: mistakes
2022-05-05 14:58:04 -07:00
Andrew FerlitschandGitHub 04b310927a Update README.md 2022-05-05 13:36:36 -07:00
Andrew FerlitschandGitHub 2fed3ad014 feat: add TFX pipeline (#538)
* feat: add colab code for docker

* feat: add colab code for docker

* fix: add colab support for docker

* fix: add colab support for docker

* fix: delete tmp BQ model

* fix: delete tmp BQ model

* feat: GAPIC->SDK for private endpoints

* feat: GAPIC->SDK for private endpoints

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* feat: more model eval work

* feat: more model eval work

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLABA

* feat: add notebook for TFX

* feat: add notebook for TFX

* feat: add notebook for TFX
2022-05-05 13:34:22 -07:00
Andrew FerlitschandGitHub 0ec94e0af6 fix: IS_COLAB (#535)
* feat: add colab code for docker

* feat: add colab code for docker

* fix: add colab support for docker

* fix: add colab support for docker

* fix: delete tmp BQ model

* fix: delete tmp BQ model

* feat: GAPIC->SDK for private endpoints

* feat: GAPIC->SDK for private endpoints

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* feat: more model eval work

* feat: more model eval work

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLABA
2022-05-04 13:55:11 -07:00
9470be0900 adds the updated service-account code to mlops/stage3/get_started_with_dataproc_serverless_pipeline_components notebook (#529)
* adds the updated service-account setting code to notebook

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-05-04 10:04:55 -07:00
479a0c6271 adds the updated service-account code to mlops/stage3/get_started_with_automl_pipeline_components notebook (#528)
* adds the updated service-account setting code to the notebook

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-05-04 10:04:13 -07:00
053f9c397f adds the updated service-account code to mlops/stage3/get_started_with_kubeflow_pipelines notebook (#527)
* adds updated service-account setting code to the notebook

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-05-04 10:03:39 -07:00
Andrew FerlitschandGitHub 2c82469756 fix: service account 2022-05-03 08:33:17 -07:00
Andrew FerlitschandGitHub fdfc7009d0 fix: correct IS_COLAB (#531)
* feat: add colab code for docker

* feat: add colab code for docker

* fix: add colab support for docker

* fix: add colab support for docker

* fix: delete tmp BQ model

* fix: delete tmp BQ model

* feat: GAPIC->SDK for private endpoints

* feat: GAPIC->SDK for private endpoints

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* feat: more model eval work

* feat: more model eval work

* fix: IS_COLAB

* fix: IS_COLAB
2022-05-02 14:25:08 -07:00
Andrew FerlitschandGitHub 59fcfe137d fix: typo in stage 2022-05-02 14:00:16 -07:00
Andrew FerlitschandGitHub 9b434b32bc feat: more eval examples (#530)
* feat: add colab code for docker

* feat: add colab code for docker

* fix: add colab support for docker

* fix: add colab support for docker

* fix: delete tmp BQ model

* fix: delete tmp BQ model

* feat: GAPIC->SDK for private endpoints

* feat: GAPIC->SDK for private endpoints

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* feat: more model eval work

* feat: more model eval work
2022-05-02 13:19:07 -07:00
fc27cd8628 Added service account fetch code for colab in get_started_with_rapid_prototyping_bqml_automl file (#520)
* made changes

* ran linter test

* added minor changes

* ran linter test

* made changes

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-05-02 09:21:45 -07:00
a62f03c396 Added service account fetch code for colab in get_started_with_custom_training_pipeline_components file (#519)
* made changes

* ran linter test

* made minor changes

* ran linter test

* made changes

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-05-02 09:21:08 -07:00
a270439814 Added service account fetch code for colab in get_started_with_bqml_pipeline_components file (#518)
* changes made

* ran linter test

* made minor changes

* ran linter test

* made changes

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-05-02 09:20:18 -07:00
sudarshan-SpringMLandGitHub a97af4a078 Added service account fetch code for colab in get_started_with_bq_tfdv_pipeline_components file (#517)
* added service account code for colab

* ran linter test

* made changes

* ran linter test
2022-05-02 09:19:29 -07:00
Andrew FerlitschandGitHub d7127cc22f fix: IS_COLAB (#526)
* feat: add colab code for docker

* feat: add colab code for docker

* fix: add colab support for docker

* fix: add colab support for docker

* fix: delete tmp BQ model

* fix: delete tmp BQ model

* feat: GAPIC->SDK for private endpoints

* feat: GAPIC->SDK for private endpoints

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB
2022-04-29 15:25:49 -07:00
Andrew FerlitschandGitHub 802ab4edd8 fix: DPE-styling (#525)
* feat: add colab code for docker

* feat: add colab code for docker

* fix: add colab support for docker

* fix: add colab support for docker

* fix: delete tmp BQ model

* fix: delete tmp BQ model

* feat: GAPIC->SDK for private endpoints

* feat: GAPIC->SDK for private endpoints

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: IS_COLAB

* fix: IS_COLAB

* fix: IS_COLAB
2022-04-29 15:10:19 -07:00
Andrew FerlitschandGitHub ae7f28fb31 fix: DPE-styling updates (#524)
* feat: add colab code for docker

* feat: add colab code for docker

* fix: add colab support for docker

* fix: add colab support for docker

* fix: delete tmp BQ model

* fix: delete tmp BQ model

* feat: GAPIC->SDK for private endpoints

* feat: GAPIC->SDK for private endpoints

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag
2022-04-29 14:06:59 -07:00
f63e3e6e4c Added colab link and made changes in the code in such a way that docker commands can run on colab environment for the file get_started_vertex_training_pytorch (#508)
* Added colab in the notebook

* Ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-29 11:55:51 -07:00
Andrew FerlitschandGitHub b9bb497ebc fix: IS_COLAB (#523)
* feat: add colab code for docker

* feat: add colab code for docker

* fix: add colab support for docker

* fix: add colab support for docker

* fix: delete tmp BQ model

* fix: delete tmp BQ model

* feat: GAPIC->SDK for private endpoints

* feat: GAPIC->SDK for private endpoints

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag

* fix: add IS_COLAB flag
2022-04-29 11:54:21 -07:00
Andrew FerlitschandGitHub 4368b9e7f8 feat: GAPIC->SDK for private endpoint (#516)
* feat: add colab code for docker

* feat: add colab code for docker

* fix: add colab support for docker

* fix: add colab support for docker

* fix: delete tmp BQ model

* fix: delete tmp BQ model

* feat: GAPIC->SDK for private endpoints

* feat: GAPIC->SDK for private endpoints
2022-04-28 09:59:49 -07:00
2e9cb5d2cf minor change for 'Get started with dataflow pipeline components' (#500)
* Add minor changes to get_started_with_dataflow_pipeline_components

* minor changes and tested

* remove variable dataflow_wait_op, since not used in other places.

* remove variable dataflow_wait_op, since not used in other places

* removed unused import

* Run linter test

* Add gcloud project set when using colab

* Run linter

* correct anem toColab logo Run in Colab

* run linter

* correct the list of items to remove

* Run linter

* Run liinter

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-27 16:45:20 -07:00
9ec8a93e05 Minor changes has been done to pipelines_intro_kfp (#494)
* minor changes done

* ran linter test

* chnanged the as per review coments

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-27 09:42:34 -07:00
3ed8778656 Made few changes to sdk-feature-store (#486)
* Added vertexai notebook

* Ran the linter test

* Made the required changes based on the comments

* Ran linter test again

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-27 09:39:03 -07:00
Andrew FerlitschandGitHub bf5e3cf870 fix: delete tmp BQ model (#510)
* feat: add colab code for docker

* feat: add colab code for docker

* fix: add colab support for docker

* fix: add colab support for docker

* fix: delete tmp BQ model

* fix: delete tmp BQ model
2022-04-27 09:30:35 -07:00
c23215893d minor changes on stage1 ml ops - Get started vertex datasets (#474)
* Add minor changes to get_started_vertex_datasets notebook

* run linter

* Run Linter test

* Add google authentication cell for colab execution

* run linter

* correct the project id definition

* Run linter

* Add project id cell

* run liner

* Added imports that are required

* run linter test

* Add gcloud project set

* Run linter

* add linter run

* Running linter test

* run linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-25 10:11:27 -07:00
Andrew FerlitschandGitHub 1c96f7ca71 fix: notebook run in colab (#505)
* feat: add colab code for docker

* feat: add colab code for docker

* fix: add colab support for docker

* fix: add colab support for docker
2022-04-22 18:50:29 -07:00
Andrew FerlitschandGitHub 0d5661835b feat: add docker support in Colab (#504)
* feat: add colab code for docker

* feat: add colab code for docker
2022-04-22 13:54:29 -07:00
fe1a3c0bc9 Adds Colab part and minor changes to ml_ops/stage2/get_started_bqml_training notebook (#491)
* adds the ml_ops/stage2/get_Started_bqml_training notebook to official and removes the same from community folder

* ran linter test

* updates the textual content

* ran linter test

* moves the updated stage2/get-started-bqml notebook back to the communit folder

* ran linter test

* updates the header according to the template

* ran linter test

* adds colab part and minor changes

* ran linter test

* retains the newly added code lost in conflicts

* ran linter test

* converts vertex to vertex ai

* ran linter test

* moves deletion of temporary BQ table outside delete_storage condition

* ran linter test

* adds bigquery-storage dependency to the notebook tested on Colab

* ran linter test

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-22 11:09:49 -07:00
82bffb87f1 Made some minor changes to sdk-metric-parameter-tracking-for-locally-trained-models (#480)
* Added to correct path

* Ran linter test

* Made some changes

* Ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-22 00:05:57 -07:00
sudarshan-SpringMLandGitHub 741c6732f1 Made minor changes to sdk-metric-parameter-tracking-for-custom-jobs file (#479)
* modified file

* modified file

* ran linter test

* deleted file in community folder

* ran linter test

* changed folder name in links

* ran linter test

* resolved comments

* ran linter test

* modified file

* ran linter test
2022-04-22 00:05:07 -07:00
9d8caf7888 Added markup text mentioning the role provided to service account used by notebook instance & provided key-version value while destroying it in notebook get_started_with_cmek_training (#495)
* Changes made to notebook

* Ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-21 23:37:19 -07:00
e63d354413 Made minor changes to rapid_prototyping_bqml_automl file and moved file from community to official (#496)
* added file

* modified notebook

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-21 22:44:18 -07:00
831c515477 Adding official version for Fraud detection notebook (#321)
* deleted file in community folder

* modified notebook

* ran linter test

* renamed managed_notebooks folder to workbench

* ran linter

* resolved comments

* ran linter test

* pulled new version of branch

* ran linter again

* resolved comments

* ran linter test

* removed %%time and added --user flag to all pip installs

* ran linter test

* added debug statements

* ran linter test

* added verbose

* ran linter test

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-21 22:07:58 -07:00
Andrew FerlitschandGitHub 06ba5d6804 fix: SaraRob installation updates (#501)
* feat: improve notebook for metric compare

* feat: improve notebook for metric compare

* feat: improve notebook for metric compare

* feat: improve notebook for metric compare

* feat: improve notebook for metric compare
2022-04-21 11:37:44 -07:00
0137cd106e adds Colab part and minor changes to ml_ops/stage2/get_started_vertex_experiments notebook in community folder (#493)
* updates the get-started-vertex-experiments notebook in the community folder

* ran linter test

* adds the costs section

* ran linter test

* adds colab part and minor changes

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-21 09:20:29 -07:00
8b3b63d714 Adds Colab part and minor changes to ml_ops/stage2/get_started_automl_training notebook (#492)
* updates the get-started-automl-training notebook

* ran linter test

* adds --user flag during installation step

* ran linter test

* updates the clean up step

* ran linter test

* adds colab part and minor changes

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-04-21 09:19:34 -07:00
bf79916f29 Adds Colab part to ml_ops/stage1/get_started_bq_datasets notebook (#490)
* adds the updated mlops-stage1-get_started_bq_datasets notebook to the official branch and removes it from the community branch

* removes second instance of create_bigquery_dataset() function

* ran linter test successfully

* adds costs section

* ran linter test successfully

* updates the dependency installation step and GCS bucket explanation

* ran linter test

* adds pyarrow to the installations

* ran linter test

* removes unnecessary installations + adds silent install + moves the notebook back from official to community folder + adds IS_TESTING condition during clean-up

* ran linter test

* resolves the move up?? comment and builtin comment

* ran linter test

* updates textual content about package installation

* ran linter test

* resolves the future-tense and  dependency installations comments

* ran linter test

* updates the header according to template

* ran linter test

* adds Colab part and minor changes

* ran linter test

* updates the enable apis step in setup project section

* ran linter test

* changes vertex to vertex ai

* ran linter test

* moves temporary BQ table deletion outside the delete_storage condition

* ran linter test

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-21 09:17:49 -07:00
6bf462f79d Notebook fix to handle GCS outputs and resolve (AutoML Tabular Forecasting notebook error: no row field 'name' #453) (#477)
* notebook fix to handle gcs output

* linter test

* minor bug fix and markup added

* linter test

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-21 09:13:52 -07:00
Andrew FerlitschandGitHub 106cdee495 feat: update model eval metrics for comparison (#498)
* feat: improve notebook for metric compare

* feat: improve notebook for metric compare

* feat: improve notebook for metric compare
2022-04-20 19:21:23 -07:00
dfb7301733 Inardini - feature store demo blog review (#484)
* review for blog

* linter code passed

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-18 15:17:17 -07:00
da707b2cbc Made minor changes to custom-tabular-bq-managed-dataset file (#473)
* modified notebook

* modified file

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-18 15:07:07 -07:00
873ba9dde9 Made minor changes to get_started_with_rapid_prototyping_bqml_automl file (#459)
* modified file

* made linter changes

* made changes

* linter test issues resolved

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-18 15:06:27 -07:00
Andrew FerlitschandGitHub 15c452f39d fix: Issue 451, add db-dtypes to requirements (#458)
* fix: issue 451

* fix: issue 451
2022-04-18 12:14:56 -07:00
Andrew FerlitschandGitHub be7111815b fix: getting SERVICE ACCOUNT 2022-04-18 10:59:44 -07:00
17db1a952b Tabnet - Add serving (#482)
* Start a new branch for TabNet tutorial.

* Clean version Created using Colaboratory

* Created using Colaboratory

* Remove unused import

* format lint

* Remove unused import

* Created using Colaboratory

* Remove unused import

* Fix the first iteration of reviewing except the image location

* add import

* Update the image to vertex

* Force delete the BQ to avoid waiting

* Add codeowner for TabNet

* Remove - from folder name

* Add deployment in Vertex AI

* Add delete the resource

Co-authored-by: Long Le <longtle@google.com>
Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-15 12:51:55 -07:00
Andrew FerlitschandGitHub 455143d0f0 Update README.md 2022-04-15 12:26:06 -07:00
Andrew FerlitschandGitHub f0892852cb Update README.md 2022-04-15 12:24:39 -07:00
Andrew FerlitschandGitHub ca48556d0c feat: add tabnet notebook (#483)
* feat: add BQML+MR example

* feat: add BQML+MR example

* feat: add TFE optimizzed

* feat: add TFE optimizzed

* feat: add raw predict example

* feat: add raw predict example

* feat: add tabnet notebook

* feat: add tabnet notebook
2022-04-15 12:21:51 -07:00
Aleksey VlasenkoandGitHub f961aa3174 Minor updates basing on team feedback (#481) 2022-04-15 10:56:46 -07:00
64c8eca7df Refresh of Distributed Hyperparameter Tuning for Colab (#461)
* notebook refresh from vertex ai sdk project

* linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-15 08:49:36 -07:00
b3332c1742 minro changes to get_started_with_hpt_pipeline_components (#465)
* minor changes made to notebook

* ran lintertest

* added coment

* ran lintertest

* made changes sujjested in git review

* ran linter test

* changes done as per review

* ran lintertest

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-14 17:02:23 -07:00
Aleksey VlasenkoandGitHub b35f697a75 Adding samples for Vertex AI Prediction optimized TensorFlow runtime (#475)
* adding Vertex AI optimized TensorFlow runtime samples

* updated URLs, added code to import benchmark.py

* fixed 'Open in Vertex AI Workbench' links

* final cleanup

* added @vlasesnkoalexey as an owner of notebooks/community/vertex_endpoints/optimized_tensorflow_runtime

* rerun linter
2022-04-14 10:14:27 -07:00
3bc32a1d48 Adds Colab part to the ml_ops/stage3/get_started_with_automl_pipelines notebook (#472)
* updates the get-started-automl-pipelines in the mlops/stage3 folder inside community folder

* replaces the unused variable deploy_op with _

* removes the unused Model import

* adds the costs section

* ran linter test

* adds Colab part to the notebook

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-12 11:52:06 -07:00
d66f851554 Adds Colab part to the ml_ops/stage3/get_started_with_kubeflow_pipelines notebook (#471)
* updates the mlops/stage3/get_started_with_kubeflow_pipelines.ipynb notebook

* fixes unused variables

* fixes conflicting function names

* ran linter test

* adds colab changes

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-12 11:51:34 -07:00
d733f107e1 Made minor changes to get_started_with_custom_training_pipeline_components file (#470)
* added colab related content

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-12 11:51:01 -07:00
805e2e1c83 Made minor changes to get_started_with_bqml_pipeline_components file (#469)
* made colab related changes

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-12 11:50:18 -07:00
03dc17d9d7 updates ml_ops/stage3/get_started_with_dataproc_serverless_pipelines notebook (adds delete-batch code + adds colab part + updates textual content) in community folder (#464)
* updates: adds delete-batch code  + adds colab part + updates textual content

* sets delete_bucket to False as default

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-12 11:49:26 -07:00
a4909f823e Adds changes for Colab support to the ml_ops/stage2/get-started-with-vertex-featstore notebook (#462)
* updates get-started-featurestore notebook in mlops/stage2

* ran linter test

* adds the colab changes and minor textual changes

* ran linter test

* adds the colab changes to the notebook and minor textual changes

* ran linter test

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-12 11:48:58 -07:00
e91b259595 Made minor changes to file get_started_vertex_training_xgboost.ipynb (#436)
* modified file

* run linter test

* run in colab

* added coment

* run lintertest

* changed as per review coments

* ran lintertest

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-12 10:08:04 -07:00
14284046e4 Made minor changes to get_started_vertex_tensorboard (#437)
* Adding a notebook

* Ran linter test

* Added Colab

* Ran the linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-12 10:07:24 -07:00
59a9a5e6ba Notebook Refresh E2E ML on GCP: MLOps stage 2 : experimentation: get started with Vertex Distributed Training (#434)
* notebook refresh from vertex ai sdk project

* update with linter test changes

* linter fix

* linter issue

* notebook colab workbench links

* linter test

* linter fix

* linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-12 10:06:01 -07:00
Andrew FerlitschandGitHub f3b0a9e0c0 Update README.md 2022-04-11 18:56:52 -07:00
Andrew FerlitschandGitHub 92b572a364 feat: add raw predict example (#468)
* feat: add BQML+MR example

* feat: add BQML+MR example

* feat: add TFE optimizzed

* feat: add TFE optimizzed

* feat: add raw predict example

* feat: add raw predict example
2022-04-11 18:53:45 -07:00
014be9b530 Made minor changes to get_started_with_data_labeling_2 (#463)
* added colab link and made colab related changes

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-11 16:07:13 -07:00
fa675e0082 inardini real time churn feature store demo fixes (#455)
* add new notebook version

* linter test done. passed

* simple fix

* add images

* linter test done

* fix image name

* fix file name in the notebook

* linter code run. done

* linter code run. done

* name fixes. linter code done. passed.

* fix project id and region

* test done

* format

* linter test done.

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-11 16:01:27 -07:00
Andrew FerlitschandGitHub 113cbb9709 Update README.md 2022-04-11 14:54:27 -07:00
Andrew FerlitschandGitHub b72bdc8112 Update README.md 2022-04-11 12:31:03 -07:00
Andrew FerlitschandGitHub 0842fa8354 Update README.md 2022-04-11 12:30:38 -07:00
Andrew FerlitschandGitHub 4e4f3f4095 Ml ops 7v6 (#467)
* feat: add BQML+MR example

* feat: add BQML+MR example

* feat: add TFE optimizzed

* feat: add TFE optimizzed
2022-04-11 12:16:47 -07:00
Andrew FerlitschandGitHub d014febeb9 Update README.md 2022-04-11 11:37:42 -07:00
Andrew FerlitschandGitHub a3264df643 feat: add BQML + MR example (#466)
* feat: add BQML+MR example

* feat: add BQML+MR example
2022-04-11 11:36:50 -07:00
f0208e3e37 Made minor changes to get_started_with_custom_training_pipeline_components (#456)
* modified file

* modified notebook

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-08 09:31:37 -07:00
f84e1b9cbc Updates ml_ops/stage3/get-started-kubeflow-pipeline-notebook in the community folder (#449)
* updates the mlops/stage3/get_started_with_kubeflow_pipelines.ipynb notebook

* fixes unused variables

* fixes conflicting function names

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-08 09:31:05 -07:00
16b2086031 Made minor changes to get_started_with_bqml_pipeline_components (#444)
* modified notebook

* linter modifications made

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-08 09:30:20 -07:00
0e24ba565d Updates ml_ops/stage3/get-started-automl-pipeline-notebook in the community folder (#440)
* updates the get-started-automl-pipelines in the mlops/stage3 folder inside community folder

* replaces the unused variable deploy_op with _

* removes the unused Model import

* adds the costs section

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-08 09:29:37 -07:00
49718b02a5 Made minor changes to get_started_with_bq_tfdv_pipeline_components (#439)
* modified notebook

* linter test issues resolved

* ran linter test

* added colab option

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-08 09:29:03 -07:00
63031ed364 Updates ml_ops/stage2/get_started_vertex_featurestore notebook in community folder. (#426)
* updates get-started-featurestore notebook in mlops/stage2

* ran linter test

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-08 09:26:57 -07:00
9fd325e25b Made minor changes to file get_started_with_data_labeling (#425)
* modified notebook

* ran linter test

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-04-08 09:22:12 -07:00
93af43419c Updates Mlops/stage2/get-started-automl-training notebook in the community folder (#409)
* updates the get-started-automl-training notebook

* ran linter test

* adds --user flag during installation step

* ran linter test

* updates the clean up step

* ran linter test

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-04-07 13:03:29 -07:00
c8f0cdb74a Refresh of Distributed Hyperparameter Tuning Notebook (#454)
* notebook refresh

* linter test

* notebook refresh added corrected cleanup

* linter test

* notebook refresh added corrected cleanup

* linter test

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-04-07 14:07:47 -05:00
19368fe5cc inardini google cloud pipelines dataproc tabular (#445)
* add dataproc components tabular notebook

* add src package

* add codeowner

* linter test done. almost ok except for the flake8 E231. need to follow up with andy

* fix typos based on andy review

* linter test done. review with andy

* hyperparameter_tuning_op fix

* project name

* add delete repo

* fix image

* linter test done

* fix image reference

* fix typo image reference

* minor fixes

* karl fixes

* karl fixes on links

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-04-07 10:10:33 -07:00
6a05e0eb6c inardini real time churn feature store demo (#448)
* add new notebook version

* linter test done. passed

* simple fix

* add images

* linter test done

* fix image name

* fix file name in the notebook

* linter code run. done

* linter code run. done

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-04-07 10:21:22 -05:00
40d643f11c Change bq://bigquery-public-data:iowa_liquor_sales_forecasting.2021_sales_predict for PREDICTION_DATASET_BQ_PATH (#423)
Co-authored-by: Jungwoon Lee <jungwoonlee@google.com>
Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-04-07 09:10:10 -05:00
Andrew FerlitschandGitHub 72009cd21b fix: misspelling of BigQuery 2022-04-06 20:15:07 -07:00
Andrew FerlitschandGitHub cc9a50f40b Update get_started_with_vertex_private_endpoints.ipynb 2022-04-06 19:56:51 -07:00
Andrew FerlitschandGitHub e3135e8875 Update README.md 2022-04-06 17:42:45 -07:00
Andrew FerlitschandGitHub 59eb297151 feat: add notebook for private endpoints (#450)
* feat: add notebook for FastAPI server

* feat: add notebook for FastAPI server

* feat: add notebook for FastAPI server

* feat: notebook for private endpoints

* feat: notebook for private endpoints
2022-04-06 17:41:10 -07:00
32b0c1c89e Mco mvmm (#420) - move model monitoring notebook from community to official
* license tweak

* remove unused import json

* fixed a missing import

* add sleep(300) to test my theory

* add missing newline

* put sleep behind a conditional

* revert new notebook name to previous name for compatibility with extant links

* fix quoting syntax error

* reformatted due to relint

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-04-06 22:37:53 +01:00
3328a8190d Adding sample to use (auto) scaling config for Feature Store online store (#367)
* Add example using auto scale

* Format with nbqa

* Complete sentence

* Give the sample for CreateFeaturestoreRequest only, instead of actual call to create FS to avoid duplicate resource or extra cleanup.

* Remove unused import

* Remove version pinning

* Add try block to avoid error when test was not cleanup properly.

* Lint

* Fix import

* Merge print lro result with the call in the same try block

* Fix typo

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
Co-authored-by: Morgan Du <morgandu@google.com>
2022-04-05 17:02:49 -07:00
7aa6acdca6 fix UnboundLocalError in TF-Agents Bandits Guide (#446)
In "Step by Step Guide to Building Reinforcement Learning Applications using Vertex AI", the replay_buffer was unbound if training_data_spec_transformation_fn was provided to the train() function

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-04-05 16:30:40 -05:00
Andrew FerlitschandGitHub 7926ff1264 Update README.md 2022-04-05 11:10:12 -07:00
Andrew FerlitschandGitHub 67b926dfb4 feat: add notebook for FastAPI server (#447)
* feat: add notebook for FastAPI server

* feat: add notebook for FastAPI server

* feat: add notebook for FastAPI server
2022-04-05 11:08:09 -07:00
327f9e7a4b Fix typo in notebook heading. (#443)
* Fix typo in notebook heading.

* Fix linting issues.

Co-authored-by: Win Woo <wwoo@google.com>
2022-04-05 08:43:47 -05:00
Andrew FerlitschandGitHub 8be220d089 fix missing + 2022-04-04 14:40:27 -07:00
Andrew FerlitschandGitHub 2dad40f49f bucket setting fine-tuning 2022-04-04 14:39:45 -07:00
Andrew FerlitschandGitHub 99b724028f Update README.md 2022-04-04 13:51:43 -07:00
Andrew FerlitschandGitHub 909fbcb0d4 feat: notebook for TF Serving binary (#442)
* update: more details to objective on endpoint notebook

* update: more details to objective on endpoint notebook

* update: more details to objective on endpoint notebook

* update: more details to objective on endpoint notebook

* update: workaround for blocking issue

* update: workaround for blocking issue

* fix: reconfigure endpoint

* fix: reconfigure endpoint

* feat: add get started with TF serving functions

* feat: add get started with TF serving functions

* feat: notebook for TF Serving

* feat: notebook for TF Serving
2022-04-04 13:49:39 -07:00
Andrew FerlitschandGitHub 351fc3e4d3 fix: remove unused print_op 2022-04-04 09:05:33 -07:00
252b3d31a3 Inardini bqml components pipeline official blog (#416)
* bqml pipeline notebook for official blog

* add notebook to CODEOWNERS

* add author name

* requirements commenting fix

* linter test done

* unpin the maintenance version for kfp

* fix: install conflicts

* Update google_cloud_pipeline_components_bqml_text.ipynb

* add karl fix

* lint test done

* add andy fixes

* linter test done

* flip order of the special METADATA fix

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@gmail.com>
2022-04-04 09:00:17 -07:00
Andrew FerlitschandGitHub bfdfaab38c Update README.md 2022-04-01 16:11:28 -07:00
Andrew FerlitschandGitHub 21a5963f84 feat: notebook for tf serving functions (#438)
* update: more details to objective on endpoint notebook

* update: more details to objective on endpoint notebook

* update: more details to objective on endpoint notebook

* update: more details to objective on endpoint notebook

* update: workaround for blocking issue

* update: workaround for blocking issue

* fix: reconfigure endpoint

* fix: reconfigure endpoint

* feat: add get started with TF serving functions

* feat: add get started with TF serving functions
2022-04-01 16:09:39 -07:00
9452249dce Added a new section called "Grant Dataproc roles to the Service Account" (#433)
* Ml ops 7v2 (#429)

* update: more details to objective on endpoint notebook

* update: more details to objective on endpoint notebook

* update: more details to objective on endpoint notebook

* update: more details to objective on endpoint notebook

* Update README.md

* Add files via upload

* Update README.md

* Delete stage6b.png

* Delete stage6c.png

* Add files via upload

* Delete stage6b.png

* Delete stage6c.png

* Add files via upload

* Delete stage6b.png

* feat: new notebook on endpoints (#430)

* update: more details to objective on endpoint notebook

* update: more details to objective on endpoint notebook

* update: more details to objective on endpoint notebook

* update: more details to objective on endpoint notebook

* update: workaround for blocking issue

* update: workaround for blocking issue

* wrong location

* Create README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* fix: links

* fix: title

* fix: example for reconfiguring the traffic split (#431)

* update: more details to objective on endpoint notebook

* update: more details to objective on endpoint notebook

* update: more details to objective on endpoint notebook

* update: more details to objective on endpoint notebook

* update: workaround for blocking issue

* update: workaround for blocking issue

* fix: reconfigure endpoint

* fix: reconfigure endpoint

* Add section on granting Dataproc IAM roles.

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@gmail.com>
Co-authored-by: Win Woo <wwoo@google.com>
2022-03-31 20:14:16 -07:00
Andrew FerlitschandGitHub 49a9df058f fix: example for reconfiguring the traffic split (#431)
* update: more details to objective on endpoint notebook

* update: more details to objective on endpoint notebook

* update: more details to objective on endpoint notebook

* update: more details to objective on endpoint notebook

* update: workaround for blocking issue

* update: workaround for blocking issue

* fix: reconfigure endpoint

* fix: reconfigure endpoint
2022-03-31 15:27:27 -07:00
Andrew FerlitschandGitHub f99b7e5d17 fix: title 2022-03-31 12:28:15 -07:00
Andrew FerlitschandGitHub ac03c57a94 fix: links 2022-03-31 12:27:47 -07:00
Andrew FerlitschandGitHub 2e4cf648c5 Update README.md 2022-03-31 12:27:01 -07:00
Andrew FerlitschandGitHub f000baa328 Update README.md 2022-03-31 12:26:35 -07:00
Andrew FerlitschandGitHub 113f89604a Update README.md 2022-03-31 12:26:01 -07:00
Andrew FerlitschandGitHub 5019a004ce Update README.md 2022-03-31 12:25:42 -07:00
Andrew FerlitschandGitHub a577f3844a Create README.md 2022-03-31 12:25:31 -07:00
Andrew FerlitschandGitHub 88c7f0f690 wrong location 2022-03-31 12:24:20 -07:00
Andrew FerlitschandGitHub a18792499a feat: new notebook on endpoints (#430)
* update: more details to objective on endpoint notebook

* update: more details to objective on endpoint notebook

* update: more details to objective on endpoint notebook

* update: more details to objective on endpoint notebook

* update: workaround for blocking issue

* update: workaround for blocking issue
2022-03-31 12:23:22 -07:00
Andrew FerlitschandGitHub 0b5fc8bb3c Delete stage6b.png 2022-03-30 19:34:52 -07:00
Andrew FerlitschandGitHub 1f77410fda Add files via upload 2022-03-30 19:34:31 -07:00
Andrew FerlitschandGitHub 45fb57f29c Delete stage6c.png 2022-03-30 19:34:11 -07:00
Andrew FerlitschandGitHub 3380b394eb Delete stage6b.png 2022-03-30 19:34:03 -07:00
Andrew FerlitschandGitHub 1286cc5044 Add files via upload 2022-03-30 19:33:20 -07:00
Andrew FerlitschandGitHub 1ce1af791c Delete stage6c.png 2022-03-30 19:31:24 -07:00
Andrew FerlitschandGitHub 2587e329ee Delete stage6b.png 2022-03-30 19:31:15 -07:00
Andrew FerlitschandGitHub 37d4816051 Update README.md 2022-03-30 19:30:19 -07:00
Andrew FerlitschandGitHub d9dff882b8 Add files via upload 2022-03-30 19:29:41 -07:00
Andrew FerlitschandGitHub 26cc2c5278 Update README.md 2022-03-30 19:21:49 -07:00
Andrew FerlitschandGitHub 69aff1bdc4 Ml ops 7v2 (#429)
* update: more details to objective on endpoint notebook

* update: more details to objective on endpoint notebook

* update: more details to objective on endpoint notebook

* update: more details to objective on endpoint notebook
2022-03-30 19:20:41 -07:00
Andrew FerlitschandGitHub 567994f2b1 fix: add missing details to objective in endpoint notebooks (#428)
* update: more details to objective on endpoint notebook

* update: more details to objective on endpoint notebook
2022-03-30 19:16:02 -07:00
Andrew FerlitschandGitHub e316c7b8aa Update README.md 2022-03-30 17:31:59 -07:00
Andrew FerlitschandGitHub c07a059a8b Update README.md 2022-03-30 17:30:46 -07:00
Andrew FerlitschandGitHub 7b4bbffc41 feat: add endpoint notebook (#427)
* feat: add data labeling notebook

* feat: add data labeling notebook

* update: details on dsl.Condition

* update: details on dsl.Condition

* feat: add TFHub model example

* feat: add TFHub model example

* feat: add endpoint notebook

* feat: add endpoint notebook
2022-03-30 15:44:54 -07:00
bdc011ef34 Made some minor changes to get_started_vertex_training_pytorch (#406)
* Added notebook

* Ran linter test

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-03-30 08:21:22 -05:00
Andrew FerlitschandGitHub 44ea0d7c61 Update README.md 2022-03-28 17:00:01 -07:00
Andrew FerlitschandGitHub aa950e5ee4 feat: add TFHub model example (#422)
* feat: add data labeling notebook

* feat: add data labeling notebook

* update: details on dsl.Condition

* update: details on dsl.Condition

* feat: add TFHub model example

* feat: add TFHub model example
2022-03-28 16:57:04 -07:00
Andrew FerlitschandGitHub 247906e50e fix: WORKDIR in Dockerfile 2022-03-28 15:52:28 -07:00
81b2493a44 Made minor changes to get_started_vertex_training_r (#417)
* addd file

* modified file

* ran linter test

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-03-28 13:26:54 -07:00
WhiteSource RenovateandGitHub 97b0edb222 chore(deps): update dependency black to v22.3.0 (#421) 2022-03-28 14:23:25 -05:00
sudarshan-SpringMLandGitHub f0a9e4b9fe added mlops folder to tested_folders file (#418) 2022-03-28 10:37:21 -05:00
Andrew FerlitschandGitHub f35bbcaec5 update: details on dsl.Condition (#415)
* feat: add data labeling notebook

* feat: add data labeling notebook

* update: details on dsl.Condition

* update: details on dsl.Condition
2022-03-26 09:51:01 -07:00
Andrew FerlitschandGitHub 2822061dc9 Update README.md 2022-03-25 16:00:46 -07:00
Andrew FerlitschandGitHub be481c8d17 feat: add data labeling notebook (#414)
* feat: add data labeling notebook

* feat: add data labeling notebook
2022-03-25 15:56:22 -07:00
Andrew FerlitschandGitHub 605a972122 fix: testing issues (#413)
* fix: testing issues

* fix: testing issues
2022-03-25 13:26:53 -07:00
Andrew FerlitschandGitHub 66d98d9fe7 fix: testing issues (#412)
* fix: test failures

* fix: test failures
2022-03-25 10:58:39 -07:00
Krishna Chaitanya MovvaandGitHub 6445ed37c9 Updates the Mlops/stage2/ get-started-vertex-experiments notebook in the community folder (#410)
* updates the get-started-vertex-experiments notebook in the community folder

* ran linter test

* adds the costs section

* ran linter test
2022-03-25 10:52:21 -05:00
Andrew FerlitschandGitHub ca745aeee8 fix: better cleanup (#407)
* update: for official

* update: for official

* cleanup: add deleting model/endpoint created from pipeline

* cleanup: add deleting model/endpoint created from pipeline

* feat: add dataproc notebook

* feat: add dataproc notebook

* fix: better cleanup

* fix: better cleanup
2022-03-24 18:58:43 -07:00
f806b4927b Adds updated Mlops/stage1/get-started-bq notebook to the community folder (#392)
* adds the updated mlops-stage1-get_started_bq_datasets notebook to the official branch and removes it from the community branch

* removes second instance of create_bigquery_dataset() function

* ran linter test successfully

* adds costs section

* ran linter test successfully

* updates the dependency installation step and GCS bucket explanation

* ran linter test

* adds pyarrow to the installations

* ran linter test

* removes unnecessary installations + adds silent install + moves the notebook back from official to community folder + adds IS_TESTING condition during clean-up

* ran linter test

* resolves the move up?? comment and builtin comment

* ran linter test

* updates textual content about package installation

* ran linter test

* resolves the future-tense and  dependency installations comments

* ran linter test

* updates the header according to template

* ran linter test

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-03-24 14:16:51 -05:00
2942eb5d7f minor changes on Sdk automl tabular regression online bq1 (#369)
* add automl tabular regression online bq with minor changes

* Run Linter

* Fix errors from the CLA test

* run linter

* resolve issue.

* run Linter

* Merge

* test lint

* fix for linter test

* add automl tabular regression online bq with minor changes

* Run Linter

* Fix errors from the CLA test

* run linter

* resolve issue.

* run Linter

* Merge

* test lint

* fix for linter test

* Fix Bucket name variable

* run linter

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-03-24 14:16:30 -05:00
2a5d6650ee Adds updated Mlops/stage2/get-started-bqml-training notebook to the community folder (#397)
* adds the ml_ops/stage2/get_Started_bqml_training notebook to official and removes the same from community folder

* ran linter test

* updates the textual content

* ran linter test

* moves the updated stage2/get-started-bqml notebook back to the communit folder

* ran linter test

* updates the header according to the template

* ran linter test

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-03-24 14:11:01 -05:00
Andrew FerlitschandGitHub 43e971f57a Update README.md 2022-03-24 11:38:17 -07:00
Andrew FerlitschandGitHub 785779613b feat: add dataproc notebook (#405)
* update: for official

* update: for official

* cleanup: add deleting model/endpoint created from pipeline

* cleanup: add deleting model/endpoint created from pipeline

* feat: add dataproc notebook

* feat: add dataproc notebook
2022-03-23 15:43:53 -07:00
Andrew FerlitschandGitHub 481193f0ca cleanup: delete created resources in the pipeline (#404)
* update: for official

* update: for official

* cleanup: add deleting model/endpoint created from pipeline

* cleanup: add deleting model/endpoint created from pipeline
2022-03-23 14:06:58 -07:00
Karl WeinmeisterandGitHub 2cb3cccd14 Fix: Linting issues in two tower notebook (#402) 2022-03-22 16:08:12 -05:00
7c16766994 minor changes in sdk automl image object detection batch (#370)
* Add minor changes to automl image object detection

* run linter

* Correct the milli nodes hours

* fix errors

* fix getenv

* Run linter

* remove tabular notebook, wrongly added

* Correct the bucket varible and minor changes to text

* Run linter

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2022-03-22 13:18:27 -07:00
Andrew FerlitschandGitHub 448d18deca update: for official (#401)
* update: for official

* update: for official
2022-03-22 09:26:34 -07:00
97022b0733 Feat: Add Pluto on Workbench tutorial (#399)
* Initial commit

* Undo master commit

* Initial commit

* Update CODEOWNERS

* Add links to resolve PR comments

Co-authored-by: Ward K Harold <wkh@google.com>
Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-03-22 10:10:46 -05:00
c2a3e2d4cd deprecate: gapic XAI notebooks replaced by SDK notebooks (#394)
* deprecate: replaced by SDK notebook

* deprecate: replaced by SDK notebook

* deprecate: replaced by SDK notebook

* deprecate: replaced by SDK notebook

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-03-22 09:46:47 -05:00
manuelamunateguiandGitHub b2dfcf17c8 E2E ML on GCP: MLOps stage 2 : experimentation: get started with Vertex Training for Scikit-Learn (#398)
* notebook refresh

* linter test after refresh
2022-03-22 09:37:09 -05:00
Andrew FerlitschandGitHub d061f09281 fix: replace os.environ with os.getenv - 2nd batch (#396)
* fix: replace os.environ with os.getenv

* fix: replace os.environ with os.getenv

* fix: replace os.environ with os.getenv

* fix: replace os.environ with os.getenv

* fix: replace os.environ with os.getenv

* fix: replace os.environ with os.getenv

* fix: replace os.environ with os.getenv

* fix: replace os.environ with os.getenv

* fix: replace os.environ with os.getenv
2022-03-19 12:02:47 -05:00
daa64efd40 fix: replace os.environ with os.getenv (#393)
* fix: use os.getenv()

* fix: use os.getenv()

* fix: use os.getenv()

* fix: use os.getenv()

* fix: use os.getenv()

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-03-18 16:44:34 -05:00
Andrew FerlitschandGitHub a37deabe27 Update README.md 2022-03-18 13:15:34 -07:00
Andrew FerlitschandGitHub 6009ef0def Update README.md 2022-03-18 13:14:34 -07:00
Andrew FerlitschandGitHub edc644b0d0 Update README.md 2022-03-18 13:13:15 -07:00
Andrew FerlitschandGitHub 1297af8baf Create README.md 2022-03-18 13:11:38 -07:00
Andrew FerlitschandGitHub b8b1b6675b Update README.md 2022-03-18 13:09:51 -07:00
Andrew FerlitschandGitHub 7d3b7abc44 fix: review updates (#395)
* feat: add CPR notebook

* feat: add CPR notebook

* feat: add CPR notebook

* feat: add CPR notebook

* feat: finalize CPR notebook

* feat: finalize CPR notebook

* feat: notebook for bqml+automl

* feat: notebook for bqml+automl

* review: edits per Erwin review

* review: edits per Erwin review
2022-03-18 12:09:53 -07:00
Rajesh ThallamandGitHub 9a572f298e [community-content] Notebook to demo NVIDIA Triton Inference Server on Vertex AI Prediction (#391)
* Add NVIDIA Triton on Vertex AI Prediction official notebook

* Add NVIDIA Triton on Vertex AI Prediction official notebook

* Add NVIDIA Triton on Vertex AI Prediction official notebook

* Add NVIDIA Triton on Vertex AI Prediction community notebook

* Add NVIDIA Triton on Vertex AI Prediction community notebook

* Add NVIDIA Triton on Vertex AI Prediction community notebook

* Fixes based on feedback to NVIDIA Triton on Vertex AI Prediction community notebook
2022-03-18 11:31:01 -05:00
b53ca9e678 Tabnet (#375)
* Start a new branch for TabNet tutorial.

* Clean version Created using Colaboratory

* Created using Colaboratory

* Remove unused import

* format lint

* Remove unused import

* Created using Colaboratory

* Remove unused import

* Fix the first iteration of reviewing except the image location

* add import

* Update the image to vertex

* Force delete the BQ to avoid waiting

* Add codeowner for TabNet

* Remove - from folder name

Co-authored-by: Long Le <longtle@google.com>
Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-03-17 17:20:01 -05:00
Andrew FerlitschandGitHub 9aceec161a Update README.md 2022-03-17 14:50:24 -07:00
Andrew FerlitschandGitHub 98b186ed55 feat: notebook for bqml+automl combined (#390)
* feat: add CPR notebook

* feat: add CPR notebook

* feat: add CPR notebook

* feat: add CPR notebook

* feat: finalize CPR notebook

* feat: finalize CPR notebook

* feat: notebook for bqml+automl

* feat: notebook for bqml+automl
2022-03-17 14:46:29 -07:00
sudarshan-SpringMLandGitHub f23ee1b5a8 Made small changes to Get started vertex vizier notebook (#389)
* modified notebook

* ran linter test

* modified notebook changed copyright licence year

* ran linter test
2022-03-17 10:03:19 -05:00
c6d779f1fc Featurestore colab update (#387)
* update featurestore colab comment

* delete some changes

* delete some changes 2

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-03-16 21:31:22 -05:00
Andrew FerlitschandGitHub 8908b27b08 feat: finish CPR notebook (#388)
* feat: add CPR notebook

* feat: add CPR notebook

* feat: add CPR notebook

* feat: add CPR notebook

* feat: finalize CPR notebook

* feat: finalize CPR notebook
2022-03-16 14:00:03 -07:00
Andrew FerlitschandGitHub 8947c9b116 feat: more CPR (#385)
* feat: add CPR notebook

* feat: add CPR notebook

* feat: add CPR notebook

* feat: add CPR notebook
2022-03-15 11:56:29 -07:00
Andrew FerlitschandGitHub 9464caac6e Update README.md 2022-03-14 17:40:15 -07:00
Andrew FerlitschandGitHub 98ce91c575 feat: add CPR notebook (#384)
* feat: add CPR notebook

* feat: add CPR notebook
2022-03-14 17:38:47 -07:00
Andrew FerlitschandGitHub 07f8feda3d Update README.md 2022-03-14 11:19:31 -07:00
Andrew FerlitschandGitHub a4e0496ff5 feat: CMEK training (#383)
* feat: add FS from panda

* feat: add FS from panda

* feat: add CMEK example

* feat: add CMEK example
2022-03-14 11:15:35 -07:00
cf162c02c8 chore(deps): update dependency pyupgrade to v2.31.1 (#381)
Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-03-14 09:34:58 -05:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Karl Weinmeister
831aae94df build(deps): bump pillow (#378)
Bumps [pillow](https://github.com/python-pillow/Pillow) from 9.0.0 to 9.0.1.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](https://github.com/python-pillow/Pillow/compare/9.0.0...9.0.1)

---
updated-dependencies:
- dependency-name: pillow
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-03-14 09:33:36 -05:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Karl Weinmeister
3fd9f28778 build(deps): bump pillow (#379)
Bumps [pillow](https://github.com/python-pillow/Pillow) from 9.0.0 to 9.0.1.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](https://github.com/python-pillow/Pillow/compare/9.0.0...9.0.1)

---
updated-dependencies:
- dependency-name: pillow
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-03-14 09:32:20 -05:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
a656e8e2a8 build(deps): bump pillow (#380)
Bumps [pillow](https://github.com/python-pillow/Pillow) from 9.0.0 to 9.0.1.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](https://github.com/python-pillow/Pillow/compare/9.0.0...9.0.1)

---
updated-dependencies:
- dependency-name: pillow
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-14 09:30:19 -05:00
Morgan DuandGitHub 2f02152703 fix: pip install google-cloud-aiplatform (#376) 2022-03-10 12:00:08 -06:00
9d08f8ce67 Using BQML 1st-party components and upgrading to 1.0.0 of google-cloud-pipeline-components (#372)
* Using BQML 1st-party components and 1.0.0 of google-cloud-pipeline-components

* Using BQML 1st-party components and upgrading to 1.0.0 of google-cloud-pipeline-components

* Using BQML 1st-party components and upgrading to 1.0.0 of google-cloud-pipeline-components

* Using BQML 1st-party components and upgrading to 1.0.0 of google-cloud-pipeline-components

* Using BQML components and upgrade to 1.0.0 of GCPC

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-03-09 13:34:12 -06:00
ec6d508793 adds automl-text-sentiment-analysis-online notebook (#293)
* adds automl-text-sentiment-analysis-online notebook

* adds the cleaned up automl-text-sentiment-analysis notebook after running linter test

* adds textual content on what the dataset predicts in the dataset section

* ran the linter test after the update

* adds textual content on what the dataset predicts in the dataset section

* ran the linter test after the update

* corrects the IMPORT_FILE parameter in the notebook

* ran linter test after update

* deletes the source file from the community/sdk folder

* updates the colab, git & workbench links in the notebook

* ran linter test

* updates the license year to 2022 and simplifies the clean-up step for bucket-deletion

* ran linter test

* adds TESTING env condition while deleting the buckets

* ran linter test successfully

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-03-09 13:09:10 -06:00
WhiteSource RenovateandGitHub 772e35ea75 chore(deps): update dependency nbqa to v1.3.1 (#374) 2022-03-09 08:24:16 -06:00
Andrew FerlitschandGitHub 1d28f886c8 feat: add example of FS values from dataframe (#373)
* feat: add FS from panda

* feat: add FS from panda
2022-03-08 17:44:59 -08:00
Andrew FerlitschandGitHub d3dc8aeb9a fix: missing create dataset schema (#371)
* fix: missing dataset create

* fix: missing dataset create
2022-03-07 11:53:39 -08:00
WhiteSource RenovateandGitHub a07d762934 chore(deps): update dependency nbqa to v1.3.0 (#368) 2022-03-07 09:53:42 -06:00
Andrew FerlitschandGitHub 85ac9e127d update: v1 (#366)
* fix: v1 upgrades

* fix: v1 upgrades

* fix: v1 upgrades

* fix: v1 upgrades

* update: v1

* update: v1
2022-03-04 17:47:56 -08:00
Gal ZahaviandGitHub 011c2823ff Update CODEOWNERS (#361) 2022-03-04 22:43:10 +02:00
Karl WeinmeisterandGitHub f28a94f03f docs: Add visualization of repo structure to README.md (#364) 2022-03-04 12:46:26 -06:00
5ecfc80cb9 Adds minor changes(license year and clean-up step) to Sdk automl video action recognition batch notebook (#355)
* adds the automl-video-action-recognition-notebook

* ran linter test

* fixes the dag variable by replacing with job

* ran linter test

* fixes the dag variable by replacing with job

* ran linter test

* corrects the IMPORT_FILE parameter in the notebook

* ran linter test after update

* updates the colab, git & vertex-ai links

* ran linter test

* updates the license year to 2022 and simplifies the lean-up step for bucket created

* ran linter test

* removes the file from the community folder

* adds the TESTING env condition while deleting the buckets

* ran linter test successfully

* adds TESTING env condition while deleting the bucket

* ran linter test successfully

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-03-04 12:44:39 -06:00
Andrew FerlitschandGitHub e5e36ba050 fix: upgrades to v1 (#360)
* fix: v1 upgrades

* fix: v1 upgrades

* fix: v1 upgrades

* fix: v1 upgrades
2022-03-03 20:05:36 -08:00
Andrew FerlitschandGitHub 0ad9116d6a fix: v1 upgrades (#359)
* fix: v1 upgrades

* fix: v1 upgrades
2022-03-03 17:49:45 -08:00
0516032443 Update CODEOWNERS (#354)
* Update CODEOWNERS

* Update CODEOWNERS

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-03-03 10:23:19 -06:00
95d211c90f Fixing minor issues in sdk_automl_text_entity_extraction_online.ipynb (#329)
* modified colab,github,vertexAI links and added vertex logo

* ran linter

* resolved comments

* ran linter

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-03-03 10:17:48 -06:00
12d6a75ef7 Fixing minor issues in sdk_automl_video_object_tracking_batch.ipynb (#328)
* changed master to main for links and added vertex AI logo

* ran linter

* resolved comments

* ran linter

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
2022-03-03 10:07:50 -06:00
Andrew FerlitschandGitHub 06153dc373 Update README.md 2022-03-02 11:45:01 -08:00
Andrew FerlitschandGitHub 02afa91fc3 Ml ops 6v3 (#352)
* fix: eval comp improvement

* fix: eval comp improvement

* feat: add to KFP get started
2022-03-02 10:38:42 -08:00
Karl WeinmeisterandGitHub c8b212789f Revert "ci: Apply filter to format_and_lint_job (#348)" (#351)
This reverts commit 95256d3fcf.
2022-03-02 09:44:03 -06:00
366 changed files with 199482 additions and 39754 deletions
@@ -1 +1,2 @@
ratemate
google-cloud-aiplatform
+29 -25
View File
@@ -1,45 +1,49 @@
from typing import List
from ratemate import RateLimit
from resource_cleanup_manager import (
ResourceCleanupManager,
DatasetResourceCleanupManager,
EndpointResourceCleanupManager,
ModelResourceCleanupManager,
DatasetResourceCleanupManager,
ModelResourceCleanupManager,
EndpointResourceCleanupManager,
ResourceCleanupManager,
)
rate_limit = RateLimit(max_count=25, per=60, greedy=False)
def run_cleanup_managers(managers: List[ResourceCleanupManager], is_dry_run: bool):
for manager in managers:
type_name = manager.type_name
for manager in managers:
type_name = manager.type_name
print(f"Fetching {type_name}'s...")
resources = manager.list()
print(f"Found {len(resources)} {type_name}'s")
for resource in resources:
if not manager.is_deletable(resource):
continue
print(f"Fetching {type_name}'s...")
resources = manager.list()
print(f"Found {len(resources)} {type_name}'s")
for resource in resources:
try:
if not manager.is_deletable(resource):
continue
if is_dry_run:
resource_name = manager.resource_name(resource)
print(f"Will delete '{type_name}': {resource_name}")
else:
try:
manager.delete(resource)
except Exception as exception:
print(exception)
if is_dry_run:
resource_name = manager.resource_name(resource)
print(f"Will delete '{type_name}': {resource_name}")
else:
rate_limit.wait() # wait before deleting
manager.delete(resource)
except Exception as exception:
print(exception)
print("")
print("")
is_dry_run = False
if is_dry_run:
print("Starting cleanup in dry run mode...")
print("Starting cleanup in dry run mode...")
# List of all cleanup managers
managers = [
DatasetResourceCleanupManager(),
EndpointResourceCleanupManager(),
ModelResourceCleanupManager(),
DatasetResourceCleanupManager(),
EndpointResourceCleanupManager(),
ModelResourceCleanupManager(), # ModelResourceCleanupManager must follow EndpointResourceCleanupManager due to deployed models blocking model deletion.
]
run_cleanup_managers(managers=managers, is_dry_run=is_dry_run)
@@ -1,8 +1,9 @@
import abc
from typing import Any, Type
from google.cloud import aiplatform
from typing import Any
from proto.datetime_helpers import DatetimeWithNanoseconds
from google.cloud.aiplatform import base
from proto.datetime_helpers import DatetimeWithNanoseconds
# If a resource was updated within this number of seconds, do not delete.
RESOURCE_UPDATE_BUFFER_IN_SECONDS = 60 * 60 * 8
@@ -40,7 +41,7 @@ class ResourceCleanupManager(abc.ABC):
# Check that it wasn't created too recently, to prevent race conditions
if time_difference <= RESOURCE_UPDATE_BUFFER_IN_SECONDS:
print(
f"Skipping '{resource}' due update_time being '{time_difference}', which is less than '{RESOURCE_UPDATE_BUFFER_IN_SECONDS}'."
f"Skipping '{resource}' due to update_time being '{time_difference}', which is less than '{RESOURCE_UPDATE_BUFFER_IN_SECONDS}'."
)
return False
@@ -50,7 +51,7 @@ class ResourceCleanupManager(abc.ABC):
class VertexAIResourceCleanupManager(ResourceCleanupManager):
@property
@abc.abstractmethod
def vertex_ai_resource(self) -> base.VertexAiResourceNounWithFutureManager:
def vertex_ai_resource(self) -> Type[base.VertexAiResourceNounWithFutureManager]:
pass
@property
@@ -60,7 +61,9 @@ class VertexAIResourceCleanupManager(ResourceCleanupManager):
def list(self) -> Any:
return self.vertex_ai_resource.list()
def resource_name(self, resource: Any) -> str:
def resource_name(
self, resource: Type[base.VertexAiResourceNounWithFutureManager]
) -> str:
return resource.display_name
def delete(self, resource):
@@ -74,12 +77,33 @@ class VertexAIResourceCleanupManager(ResourceCleanupManager):
class DatasetResourceCleanupManager(VertexAIResourceCleanupManager):
vertex_ai_resource = aiplatform.datasets._Dataset
dataset_types = [
aiplatform.ImageDataset,
aiplatform.TabularDataset,
aiplatform.TextDataset,
aiplatform.TimeSeriesDataset,
aiplatform.VideoDataset,
]
def list(self) -> Any:
return [
dataset
for dataset_type in self.dataset_types
for dataset in dataset_type.list()
]
class EndpointResourceCleanupManager(VertexAIResourceCleanupManager):
vertex_ai_resource = aiplatform.Endpoint
def delete(self, resource):
# TODO: Remove this once https://github.com/googleapis/python-aiplatform/issues/1441 is fixed
resource._sync_gca_resource()
for deployed_model_id in [
models.id for models in resource._gca_resource.deployed_models
]:
resource._undeploy(deployed_model_id=deployed_model_id)
resource.delete(force=True)
+25 -2
View File
@@ -17,6 +17,7 @@
import argparse
import pathlib
import execute_changed_notebooks_helper
@@ -61,6 +62,18 @@ parser.add_argument(
help="The GCP region. This is used to inject a variable value into the notebook before running.",
required=True,
)
parser.add_argument(
"--variable_service_account",
type=str,
help="A service account. This is used to inject a variable value into the notebook before running. This is not the account that will run the notebook.",
required=True,
)
parser.add_argument(
"--variable_vpc_network",
type=str,
help="The full VPC network name. See https://cloud.google.com/compute/docs/networks-and-firewalls#networks. Format is projects/{project}/global/networks/{network}, where {project} is a project number, as in '12345', and {network} is network name. See <https://cloud.google.com/compute/docs/reference/rest/v1/networks/insert> for details. This is used to inject a variable value into the notebook before running.",
required=False,
)
parser.add_argument(
"--staging_bucket",
type=str,
@@ -73,6 +86,13 @@ parser.add_argument(
help="The GCP directory for storing executed notebooks.",
required=True,
)
parser.add_argument(
"--timeout",
type=int,
help="Timeout in seconds",
default=86400,
required=False,
)
parser.add_argument(
"--private_pool_id",
type=str,
@@ -100,8 +120,11 @@ execute_changed_notebooks_helper.process_and_execute_notebooks(
container_uri=args.container_uri,
staging_bucket=args.staging_bucket,
artifacts_bucket=args.artifacts_bucket,
should_parallelize=args.should_parallelize,
timeout=args.timeout,
variable_project_id=args.variable_project_id,
variable_region=args.variable_region,
private_pool_id=args.private_pool_id if not "default" else None,
should_parallelize=args.should_parallelize,
variable_service_account=args.variable_service_account,
variable_vpc_network=args.variable_vpc_network,
private_pool_id=args.private_pool_id,
)
+209 -54
View File
@@ -17,18 +17,28 @@ import concurrent
import dataclasses
import datetime
import functools
import json
import git
import operator
import os
import pathlib
import nbformat
import re
import subprocess
import utils
from typing import List, Optional
from tabulate import tabulate
import operator
from utils import util
import execute_notebook_helper
import execute_notebook_remote
from utils import util, NotebookProcessors
import nbformat
from google.cloud.devtools.cloudbuild_v1.types import BuildOperationMetadata
from ratemate import RateLimit
from tabulate import tabulate
from utils import NotebookProcessors, util
# A buffer so that workers finish before the orchestrating job
WORKER_TIMEOUT_BUFFER_IN_SECONDS: int = 60 * 60
PYTHON_VERSION = "3.9" # Set default python version
def format_timedelta(delta: datetime.timedelta) -> str:
@@ -60,13 +70,23 @@ class NotebookExecutionResult:
log_url: str
output_uri: str
build_id: str
logs_bucket: str
error_message: Optional[str]
@property
def output_uri_web(self) -> Optional[str]:
if self.output_uri.startswith("gs://"):
return f"https://storage.googleapis.com/{self.output_uri[5:]}"
else:
return None
def _process_notebook(
notebook_path: str,
variable_project_id: str,
variable_region: str,
variable_service_account: str,
variable_vpc_network: Optional[str],
):
# Read notebook
with open(notebook_path) as f:
@@ -78,6 +98,8 @@ def _process_notebook(
replacement_map={
"PROJECT_ID": variable_project_id,
"REGION": variable_region,
"SERVICE_ACCOUNT": variable_service_account,
"VPC_NETWORK": variable_vpc_network,
},
)
@@ -93,6 +115,33 @@ def _process_notebook(
nbformat.write(nb, new_file)
def _get_notebook_python_version(notebook_path: str) -> str:
"""
Get the python version for running the notebook if it is specified in
the notebook.
"""
python_version = PYTHON_VERSION
# Load the notebook
file = open(notebook_path)
src = file.read()
nb_json = json.loads(src)
#Iterate over the cells in the ipynb
for cell in nb_json['cells']:
if cell['cell_type'] == 'markdown':
markdown = str.join('', cell['source'])
# Look for the python version specification pattern
re_match = re.search('python version = (\d\.\d)', markdown, flags=re.IGNORECASE)
if re_match:
# get the version number
python_version = re_match.group(1)
break
return python_version
def _create_tag(filepath: str) -> str:
tag = os.path.basename(os.path.normpath(filepath))
tag = re.sub("[^0-9a-zA-Z_.-]+", "-", tag)
@@ -103,18 +152,33 @@ def _create_tag(filepath: str) -> str:
return tag
rate_limit = RateLimit(max_count=50, per=60, greedy=True)
def process_and_execute_notebook(
container_uri: str,
staging_bucket: str,
artifacts_bucket: str,
variable_project_id: str,
variable_region: str,
variable_service_account: str,
variable_vpc_network: Optional[str],
private_pool_id: Optional[str],
deadline: datetime.datetime,
notebook: str,
should_get_tail_logs: bool = False,
) -> NotebookExecutionResult:
rate_limit.wait() # wait before creating the task
print(f"Running notebook: {notebook}")
# Handle empty strings
if not variable_vpc_network:
variable_vpc_network = None
if not private_pool_id:
private_pool_id = None
# Create paths
notebook_output_uri = "/".join([artifacts_bucket, pathlib.Path(notebook).name])
@@ -128,6 +192,7 @@ def process_and_execute_notebook(
output_uri=notebook_output_uri,
log_url="",
build_id="",
logs_bucket="",
error_message=None,
)
@@ -135,29 +200,43 @@ def process_and_execute_notebook(
time_start = datetime.datetime.now()
operation = None
try:
# Get the python version for running the notebook if specified
notebook_exec_python_version = _get_notebook_python_version(notebook_path=notebook)
print(f"Running notebook with python {notebook_exec_python_version}")
# Pre-process notebook by substituting variable names
_process_notebook(
notebook_path=notebook,
variable_project_id=variable_project_id,
variable_region=variable_region,
variable_service_account=variable_service_account,
variable_vpc_network=variable_vpc_network,
)
# Upload the pre-processed code to a GCS bucket
code_archive_uri = util.archive_code_and_upload(staging_bucket=staging_bucket)
# Calculate timeout in seconds
timeout_in_seconds = max(
int((deadline - datetime.datetime.now()).total_seconds()), 1
)
operation = execute_notebook_remote.execute_notebook_remote(
code_archive_uri=code_archive_uri,
notebook_uri=notebook,
notebook_output_uri=notebook_output_uri,
container_uri=container_uri,
tag=tag,
region=variable_region,
private_pool_id=private_pool_id,
private_pool_region=variable_region,
timeout_in_seconds=timeout_in_seconds,
python_version=notebook_exec_python_version
)
operation_metadata = BuildOperationMetadata(mapping=operation.metadata)
result.build_id = operation_metadata.build.id
result.log_url = operation_metadata.build.log_url
result.logs_bucket = operation_metadata.build.logs_bucket
# Block and wait for the result
operation_result = operation.result()
@@ -215,20 +294,40 @@ def get_changed_notebooks(
# Find notebooks
notebooks = []
# Instantiate GitPython objects
repo = git.Repo(os.getcwd())
index = repo.index
if base_branch:
print(f"Looking for notebooks that changed from branch: {base_branch}")
notebooks = subprocess.check_output(
["git", "diff", "--name-only", f"origin/{base_branch}..."] + test_paths
)
# Get the point at which this branch branches off from main
branching_commits = repo.merge_base("HEAD", f"origin/{base_branch}")
if len(branching_commits) > 0:
branching_commit = branching_commits[0]
print(f"Looking for notebooks that changed from branch: {branching_commit}")
notebooks = [
diff.b_path
for diff in index.diff(branching_commit, paths=test_paths)
if diff.b_path is not None
]
else:
notebooks = []
else:
print(f"Looking for all notebooks.")
notebooks = subprocess.check_output(["git", "ls-files"] + test_paths)
notebooks_str = subprocess.check_output(["git", "ls-files"] + test_paths)
notebooks = notebooks_str.decode("utf-8").split("\n")
notebooks = notebooks.decode("utf-8").split("\n")
notebooks = [notebook for notebook in notebooks if notebook.endswith(".ipynb")]
notebooks = [notebook for notebook in notebooks if len(notebook) > 0]
notebooks = [notebook for notebook in notebooks if pathlib.Path(notebook).exists()]
if len(notebooks) > 0:
print(f"Found {len(notebooks)} notebooks:")
for notebook in notebooks:
print(f"\t{notebook}")
return notebooks
@@ -237,10 +336,13 @@ def process_and_execute_notebooks(
container_uri: str,
staging_bucket: str,
artifacts_bucket: str,
should_parallelize: bool,
timeout: int,
variable_project_id: str,
variable_region: str,
private_pool_id: Optional[str],
should_parallelize: bool,
variable_service_account: str,
variable_vpc_network: Optional[str] = None,
private_pool_id: Optional[str] = None,
):
"""
Run the notebooks that exist under the folders defined in the test_paths_file.
@@ -267,17 +369,27 @@ def process_and_execute_notebooks(
Required. The value for REGION to inject into notebooks.
should_parallelize (bool):
Required. Should run notebooks in parallel using a thread pool as opposed to in sequence.
timeout (str):
Required. Timeout string according to https://cloud.google.com/build/docs/build-config-file-schema#timeout.
"""
notebook_execution_results: List[NotebookExecutionResult] = []
if len(notebooks) > 0:
# Calculate deadline
deadline = datetime.datetime.now() + datetime.timedelta(
seconds=max(timeout - WORKER_TIMEOUT_BUFFER_IN_SECONDS, 0)
)
if len(notebooks) >= 1:
notebook_execution_results: List[NotebookExecutionResult] = []
print(f"Found {len(notebooks)} modified notebooks: {notebooks}")
if should_parallelize and len(notebooks) > 1:
print(
"Running notebooks in parallel, so no logs will be displayed. Please wait..."
)
with concurrent.futures.ThreadPoolExecutor(max_workers=None) as executor:
with concurrent.futures.ThreadPoolExecutor(max_workers=100) as executor:
print(f"Max workers: {executor._max_workers}")
notebook_execution_results = list(
executor.map(
functools.partial(
@@ -287,7 +399,10 @@ def process_and_execute_notebooks(
artifacts_bucket,
variable_project_id,
variable_region,
variable_service_account,
variable_vpc_network,
private_pool_id,
deadline,
),
notebooks,
)
@@ -300,48 +415,88 @@ def process_and_execute_notebooks(
artifacts_bucket=artifacts_bucket,
variable_project_id=variable_project_id,
variable_region=variable_region,
variable_service_account=variable_service_account,
variable_vpc_network=variable_vpc_network,
private_pool_id=private_pool_id,
deadline=deadline,
notebook=notebook,
)
for notebook in notebooks
]
print("\n=== RESULTS ===\n")
results_sorted = sorted(
notebook_execution_results,
key=lambda result: result.is_pass,
reverse=True,
)
# Print results
print(
tabulate(
[
[
result.name,
"PASSED" if result.is_pass else "FAILED",
format_timedelta(result.duration),
result.log_url,
result.output_uri,
result.output_uri_web,
result.logs_bucket
]
for result in results_sorted
],
headers=[
"build_tag",
"status",
"duration",
"log_url",
"output_uri",
"output_uri_web",
"logs_bucket"
],
)
)
if len(notebooks) == 1:
print("="*100)
print("The notebook execution build log:\n")
print("="*100)
build_id = results_sorted[0].build_id
logs_bucket_name = (results_sorted[0].logs_bucket).removeprefix("gs://")
log_file_name = f"log-{build_id}.txt"
log_contents = util.download_blob_into_memory(
bucket_name=logs_bucket_name,
blob_name=log_file_name,
download_as_text=True
)
# Remove extra steps from the log
match = re.search("starting Step #4", log_contents, flags=re.IGNORECASE)
if match is not None:
match_index = match.span()[0]
print(log_contents[match_index:])
else:
print(log_contents)
print("\n=== END RESULTS===\n")
total_notebook_duration = functools.reduce(
operator.add,
[datetime.timedelta(seconds=0)]
+ [result.duration for result in results_sorted],
)
print(
f"Cumulative notebook duration: {format_timedelta(total_notebook_duration)}"
)
# Raise error if any notebooks failed
if not all([result.is_pass for result in results_sorted]):
raise RuntimeError("Notebook failures detected. See logs for details")
else:
print("No notebooks modified in this pull request.")
print("\n=== RESULTS ===\n")
results_sorted = sorted(
notebook_execution_results,
key=lambda result: result.is_pass,
reverse=True,
)
# Print results
print(
tabulate(
[
[
result.name,
"PASSED" if result.is_pass else "FAILED",
format_timedelta(result.duration),
result.log_url,
]
for result in results_sorted
],
headers=["build_tag", "status", "duration", "log_url"],
)
)
print("\n=== END RESULTS===\n")
total_notebook_duration = functools.reduce(
operator.add,
[datetime.timedelta(seconds=0)]
+ [result.duration for result in results_sorted],
)
print(f"Cumulative notebook duration: {format_timedelta(total_notebook_duration)}")
# Raise error if any notebooks failed
if not all([result.is_pass for result in results_sorted]):
raise RuntimeError("Notebook failures detected. See logs for details")
+1
View File
@@ -16,6 +16,7 @@
"""A CLI to download (optional) and run a single notebook locally"""
import argparse
import execute_notebook_helper
parser = argparse.ArgumentParser(description="Run a single notebook locally.")
+19 -8
View File
@@ -15,17 +15,20 @@
"""Methods to run a notebook locally"""
import sys
import os
import errno
import papermill as pm
import os
import shutil
import sys
from utils import util
import papermill as pm
from google.cloud.aiplatform import utils
from utils import util
# This script is used to execute a notebook and write out the output notebook.
# This is used to force papermill to use this kernel to run the notebook instead of any defined inside the notebook itself
DEFAULT_KERNEL_NAME = "python3"
def execute_notebook(
notebook_source: str,
@@ -50,6 +53,17 @@ def execute_notebook(
execution_exception = None
print("\n=== DOWNLOAD EXECUTED NOTEBOOK ===\n")
print(f"Please debug the executed notebook by downloading the executed notebook:")
print("Option 1. Using gsutil. Run the following command in your terminal.")
print(f'\tgsutil cp "{output_file_or_uri}" .')
print("Option 2. Using this link.")
print(f"\thttps://storage.googleapis.com/{output_file_or_uri[5:]}")
print("\n======\n")
# Execute notebook
try:
# Execute notebook
@@ -58,6 +72,7 @@ def execute_notebook(
output_path=notebook_source,
progress_bar=should_log_output,
request_save_on_cell_execute=should_log_output,
kernel_name=DEFAULT_KERNEL_NAME,
log_output=should_log_output,
stdout_file=sys.stdout if should_log_output else None,
stderr_file=sys.stderr if should_log_output else None,
@@ -71,10 +86,6 @@ def execute_notebook(
util.upload_file(notebook_source, remote_file_path=output_file_or_uri)
print("\n=== EXECUTION FINISHED ===\n")
print(
f"Please debug the executed notebook by downloading: {output_file_or_uri}"
)
print("\n======\n")
else:
# Create directories if they don't exist
if not os.path.exists(os.path.dirname(output_file_or_uri)):
+23 -19
View File
@@ -16,22 +16,18 @@
"""Methods to run a notebook on Google Cloud Build"""
from re import sub
from typing import Optional
import google.auth
import yaml
from google.api_core import client_options, operation
from google.cloud.aiplatform import utils
from google.cloud.devtools import cloudbuild_v1
from google.cloud.devtools.cloudbuild_v1.types import Source, StorageSource
from google.protobuf import duration_pb2
from yaml.loader import FullLoader
import google.auth
from google.cloud.devtools import cloudbuild_v1
from google.cloud.devtools.cloudbuild_v1.types import Source, StorageSource
from typing import Optional
import yaml
from google.cloud.aiplatform import utils
from google.api_core import operation, client_options
CLOUD_BUILD_FILEPATH = ".cloud-build/notebook-execution-test-cloudbuild-single.yaml"
TIMEOUT_IN_SECONDS = 86400
SERVICE_BASE_PATH = "cloudbuild.googleapis.com"
@@ -40,30 +36,38 @@ def execute_notebook_remote(
notebook_uri: str,
notebook_output_uri: str,
container_uri: str,
region: str,
private_pool_id: Optional[str],
private_pool_region: Optional[str],
tag: Optional[str],
timeout_in_seconds: Optional[int] = None,
python_version: Optional[str] = None
) -> operation.Operation:
"""Create and execute a single notebook on Google Cloud Build"""
# Load build steps from YAML
cloudbuild_config = yaml.load(open(CLOUD_BUILD_FILEPATH), Loader=FullLoader)
substitutions = {
"_PYTHON_IMAGE": container_uri,
"_NOTEBOOK_GCS_URI": notebook_uri,
"_NOTEBOOK_OUTPUT_GCS_URI": notebook_output_uri,
"_PYTHON_VERSION" : f"python{python_version}"
}
if python_version is not None:
substitutions["_PYTHON_VERSION"] = "python" + python_version
build = cloudbuild_v1.Build()
options: Optional[client_options.ClientOptions] = None
if private_pool_id:
substitutions["_PRIVATE_POOL_NAME"] = private_pool_id
build.options = cloudbuild_config["options"]
if private_pool_id and private_pool_region:
# substitutions["_PRIVATE_POOL_NAME"] = private_pool_id
build.options = cloudbuild_config.get("options")
build.options.pool = {"name": private_pool_id}
# Switch to the regional endpoint of the pool
options = client_options.ClientOptions(
api_endpoint=f"{region}-{SERVICE_BASE_PATH}"
api_endpoint=f"{private_pool_region}-{SERVICE_BASE_PATH}"
)
# Authorize the client with Google defaults
@@ -85,8 +89,8 @@ def execute_notebook_remote(
build.steps = cloudbuild_config["steps"]
build.substitutions = substitutions
build.timeout = duration_pb2.Duration(seconds=TIMEOUT_IN_SECONDS)
build.queue_ttl = duration_pb2.Duration(seconds=TIMEOUT_IN_SECONDS)
build.timeout = duration_pb2.Duration(seconds=timeout_in_seconds)
build.queue_ttl = duration_pb2.Duration(seconds=timeout_in_seconds)
if tag:
build.tags = [tag]
@@ -4,28 +4,35 @@ steps:
entrypoint: /bin/sh
args:
- -c
- 'gcloud config list'
- 'gcloud config list --quiet'
# Check the Python version
- name: ${_PYTHON_IMAGE}
entrypoint: /bin/sh
args:
- -c
- 'python3 .cloud-build/CheckPythonVersion.py'
- ${_PYTHON_VERSION} .cloud-build/CheckPythonVersion.py -q
# Create a virtual environment
- name: ${_PYTHON_IMAGE}
entrypoint: /bin/sh
args:
- -c
- ${_PYTHON_VERSION} -m venv workspace/env
# Install Python dependencies
- name: ${_PYTHON_IMAGE}
entrypoint: /bin/sh
args:
- -c
- 'python3 -m pip install -U pip && python3 -m pip install -U --user -r .cloud-build/requirements.txt'
- . workspace/env/bin/activate &&
python -m pip -q install -U pip &&
python -m pip -q install -U -r .cloud-build/requirements.txt
# Install Python dependencies and run testing script
- name: ${_PYTHON_IMAGE}
entrypoint: /bin/sh
args:
- -c
- 'python3 -m pip install -U pip && python3 -m pip freeze && python3 .cloud-build/execute_notebook_cli.py --notebook_source "${_NOTEBOOK_GCS_URI}" --output_file_or_uri "${_NOTEBOOK_OUTPUT_GCS_URI}"'
- |
. workspace/env/bin/activate &&
python .cloud-build/execute_notebook_cli.py --notebook_source "${_NOTEBOOK_GCS_URI}" --output_file_or_uri "${_NOTEBOOK_OUTPUT_GCS_URI}"
env:
- 'IS_TESTING=1'
timeout: 86400s
options:
pool:
name: ${_PRIVATE_POOL_NAME}
@@ -4,35 +4,42 @@ steps:
entrypoint: /bin/sh
args:
- -c
- 'gcloud config list'
- gcloud config list --quiet
# Check the Python version
- name: ${_PYTHON_IMAGE}
entrypoint: /bin/sh
args:
- -c
- 'python3 .cloud-build/CheckPythonVersion.py'
# Fetch base branch if required
- python3 .cloud-build/CheckPythonVersion.py -q
# Fetch full repo for diff purposes
- name: gcr.io/cloud-builders/git
args: [fetch, --unshallow, --quiet]
# Create a virtual environment
- name: ${_PYTHON_IMAGE}
entrypoint: /bin/sh
args:
- -c
- 'if [ -n "${_BASE_BRANCH}" ]; then git fetch origin "${_BASE_BRANCH}":refs/remotes/origin/"${_BASE_BRANCH}"; else echo "Skipping fetch."; fi'
- python3 -m venv workspace/env
# Install Python dependencies
- name: ${_PYTHON_IMAGE}
entrypoint: /bin/sh
args:
- -c
- 'python3 -m pip install -U pip && python3 -m pip install -U --user -r .cloud-build/requirements.txt'
- . workspace/env/bin/activate &&
python3 -m pip -q install -U pip &&
python3 -m pip -q install -U -r .cloud-build/requirements.txt
# Install Python dependencies and run testing script
# TODO: Only pass in private_pool_id if it is set
- name: ${_PYTHON_IMAGE}
entrypoint: /bin/sh
args:
- -c
- 'python3 -m pip install -U pip && python3 -m pip freeze && python3 .cloud-build/execute_changed_notebooks_cli.py --test_paths_file "${_TEST_PATHS_FILE}" --base_branch "${_FORCED_BASE_BRANCH}" --container_uri ${_PYTHON_IMAGE} --staging_bucket ${_GCS_STAGING_BUCKET} --artifacts_bucket ${_GCS_STAGING_BUCKET}/executed_notebooks/PR_${_PR_NUMBER}/BUILD_${BUILD_ID} --variable_project_id ${PROJECT_ID} --variable_region ${_GCP_REGION} `if [ ! -z "${_PRIVATE_POOL_NAME}" ]; then echo "--private_pool_id ${_PRIVATE_POOL_NAME}"; fi`'
- |
. workspace/env/bin/activate &&
python3 .cloud-build/execute_changed_notebooks_cli.py --test_paths_file "${_TEST_PATHS_FILE}" --base_branch "${_FORCED_BASE_BRANCH}" --container_uri ${_PYTHON_IMAGE} --staging_bucket ${_GCS_STAGING_BUCKET} --artifacts_bucket ${_GCS_STAGING_BUCKET}/executed_notebooks/PR_${_PR_NUMBER}/BUILD_${BUILD_ID} --variable_project_id ${PROJECT_ID} --variable_region ${_GCP_REGION} --variable_service_account ${_GCP_SERVICE_ACCOUNT} --variable_vpc_network "${_GPC_VPC_NETWORK_NAME}" `if [ ! -z "${_PRIVATE_POOL_NAME}" ]; then echo "--private_pool_id ${_PRIVATE_POOL_NAME}"; fi`
env:
- 'IS_TESTING=1'
timeout: 86400s
options:
pool:
name: ${_PRIVATE_POOL_NAME}
name: ${_PRIVATE_POOL_NAME}
+2 -1
View File
@@ -9,4 +9,5 @@ tabulate
google-cloud-aiplatform
google-cloud-storage
google-cloud-build
gcloud
ratemate
GitPython
+3 -2
View File
@@ -1,5 +1,6 @@
notebooks/official/vizier/gapic-vizier-multi-objective-optimization.ipynb
notebooks/official/pipelines/lightweight_functions_component_io_kfp.ipynb
notebooks/official/matching_engine/intro-swivel.ipynb
notebooks/official/ml_metadata/sdk-metric-parameter-tracking-for-locally-trained-models.ipynb
notebooks/official/pipelines/metrics_viz_run_compare_kfp.ipynb
notebooks/official/custom/custom-tabular-bq-managed-dataset.ipynb
notebooks/official/matching_engine/sdk_matching_engine_for_indexing.ipynb
.cloud-build/tests/python_version_test.ipynb
+1
View File
@@ -0,0 +1 @@
notebooks/official/custom/custom-tabular-bq-managed-dataset.ipynb
@@ -0,0 +1,61 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "57a3d44ed8a8"
},
"source": [
"### Set up your Google Cloud project\n",
"\n",
"**_NOTE_**: This notebook has been tested in the following environment:\n",
"\n",
"* Python version = 3.7\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",
"1. [Make sure that billing is enabled for your project](https://cloud.google.com/billing/docs/how-to/modify-project).\n",
"\n",
"1. [Enable the Vertex AI API and Compute Engine API](https://console.cloud.google.com/flows/enableapi?apiid=aiplatform.googleapis.com,compute_component).\n",
"\n",
"1. If you are running this notebook locally, you will need to install the [Cloud SDK](https://cloud.google.com/sdk).\n",
"\n",
"1. Enter your project ID in the cell below. Then run the cell to make sure the\n",
"Cloud SDK uses the right project for all the commands in this notebook.\n",
"\n",
"**Note**: Jupyter runs lines prefixed with `!` as shell commands, and it interpolates Python variables prefixed with `$` into these commands."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "c6516f90311b"
},
"outputs": [],
"source": [
"# test if the right python version is being used\n",
"import sys\n",
"\n",
"actual_python_version = f\"{sys.version_info.major}.{sys.version_info.minor}\"\n",
"print(f\"Runtime python version: {actual_python_version}\")\n",
"\n",
"assert actual_python_version == \"3.7\", \"Wrong python version!\""
]
}
],
"metadata": {
"colab": {
"name": "python_version_test.ipynb",
"toc_visible": true
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
+4 -2
View File
@@ -13,8 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from nbconvert.preprocessors import Preprocessor
from typing import Dict
from nbconvert.preprocessors import Preprocessor
from . import UpdateNotebookVariables as update_notebook_variables
@@ -60,4 +62,4 @@ class UpdateVariablesPreprocessor(Preprocessor):
executable_cells.append(cell)
notebook.cells = executable_cells
return notebook, resources
return notebook, resources
+26 -3
View File
@@ -35,8 +35,8 @@ Variables in conditionals can also be replaced:
def get_updated_value(content: str, variable_name: str, variable_value: str) -> str:
return re.sub(
rf"({variable_name}.*?=.*?[\",\'])\[.+?\]([\",\'].*?)",
rf"\1{variable_value}\2",
rf"({variable_name}.*? = .*?[\",\'])\[.+?\]([\",\'].*?)",
rf"\g<1>{variable_value}\g<2>",
content,
flags=re.M,
)
@@ -78,4 +78,27 @@ def test_region():
variable_name="REGION",
variable_value="us-central1",
)
assert new_content == 'REGION = "us-central1" # @param {type:"string"}'
assert new_content == 'REGION = "us-central1" # @param {type:"string"}'
def test_region_equal_equals_ignore():
# Tests that == is ignored
new_content = get_updated_value(
content='REGION == "[your-region]" # @param {type:"string"}',
variable_name="REGION",
variable_value="us-central1",
)
assert new_content == 'REGION == "[your-region]" # @param {type:"string"}'
def test_service_account():
# Tests that == is ignored
new_content = get_updated_value(
content='SERVICE_ACCOUNT = "[your-service-account]" # @param {type:"string"}',
variable_name="SERVICE_ACCOUNT",
variable_value="12345-compute@developer.gserviceaccount.com",
)
assert (
new_content
== 'SERVICE_ACCOUNT = "12345-compute@developer.gserviceaccount.com" # @param {type:"string"}'
)
+38 -7
View File
@@ -1,13 +1,13 @@
from datetime import datetime
from typing import Optional
from google.cloud import storage
from google.cloud.aiplatform import utils
from google.auth import credentials as auth_credentials
import os
import subprocess
import tarfile
import uuid
from datetime import datetime
from typing import Optional, Union
from google.auth import credentials as auth_credentials
from google.cloud import storage
from google.cloud.aiplatform import utils
def download_file(bucket_name: str, blob_name: str, destination_file: str) -> str:
@@ -57,4 +57,35 @@ def archive_code_and_upload(staging_bucket: str):
print(f"Uploaded source code archive to {source_archived_file_gcs}")
return source_archived_file_gcs
return source_archived_file_gcs
def download_blob_into_memory(
bucket_name: str,
blob_name: str,
download_as_text: Optional[bool]=False
) -> Union[bytes, str]:
"""
Downloads a blob into memory as byte or as text if
download_as_text is set to True.
"""
storage_client = storage.Client()
bucket = storage_client.bucket(bucket_name)
# Construct a client side representation of a blob.
blob = bucket.blob(blob_name)
# Download the blob content
if download_as_text:
contents = blob.download_as_text()
else:
contents = blob.download_as_bytes()
print(
f"Downloaded storage object {blob_name} from bucket {bucket_name}."
)
return contents
+19 -9
View File
@@ -1,18 +1,28 @@
If you are opening a PR for `Official Notebooks` under the [notebooks/official](https://github.com/GoogleCloudPlatform/vertex-ai-samples/tree/main/notebooks/official) folder, follow this mandatory checklist:
**REQUIRED:** Add a summary of your PR here, typically including why the change is needed and what was changed. Include any design alternatives for discussion purposes.
<br>
--- YOUR PR SUMMARY GOES HERE ---
<br><br><br>
**REQUIRED:** Fill out the below checklists or remove if irrelevant
1. If you are opening a PR for `Official Notebooks` under the [notebooks/official](https://github.com/GoogleCloudPlatform/vertex-ai-samples/tree/main/notebooks/official) folder, follow this mandatory checklist:
- [ ] Use the [notebook template](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/notebook_template.ipynb) as a starting point.
- [ ] Follow the style and grammar rules outlined in the above notebook template.
- [ ] Verify the notebook runs successfully in Colab since the automated tests cannot guarantee this even when it passes.
- [ ] Passes all the required automated checks. You can locally test for formatting and linting with these [instructions](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/docs/contributing.md#code-quality-checks).
- [ ] Passes all the required automated checks. You can locally test for formatting and linting with these [instructions](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/CONTRIBUTING.md#code-quality-checks).
- [ ] You have consulted with a tech writer to see if tech writer review is necessary. If so, the notebook has been reviewed by a tech writer, and they have approved it.
- [ ] This notebook has been added to the [CODEOWNERS](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/docs/CODEOWNERS) file under `# Official Notebooks` section, pointing to the author or the author's team.
- [ ] This notebook has been added to the [CODEOWNERS](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/CODEOWNERS) file under the `Official Notebooks` section, pointing to the author or the author's team.
- [ ] The Jupyter notebook cleans up any artifacts it has created (datasets, ML models, endpoints, etc) so as not to eat up unnecessary resources.
<br>
If you are opening a PR for `Community Notebooks` under the [notebooks/community](https://github.com/GoogleCloudPlatform/vertex-ai-samples/tree/main/notebooks/community) folder:
- [ ] This notebook has been added to the [CODEOWNERS](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/docs/CODEOWNERS) file under the `# Community Notebooks` section, pointing to the author or the author's team.
- [ ] Passes all the required formatting and linting checks. You can locally test with these [instructions](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/docs/contributing.md#code-quality-checks).
2. If you are opening a PR for `Community Notebooks` under the [notebooks/community](https://github.com/GoogleCloudPlatform/vertex-ai-samples/tree/main/notebooks/community) folder:
- [ ] This notebook has been added to the [CODEOWNERS](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/CODEOWNERS) file under the `Community Notebooks` section, pointing to the author or the author's team.
- [ ] Passes all the required formatting and linting checks. You can locally test with these [instructions](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/CONTRIBUTING.md#code-quality-checks).
If you are opening a PR for `Community Content` under the [community-content](https://github.com/GoogleCloudPlatform/vertex-ai-samples/tree/main/community-content) folder:
<br>
3. If you are opening a PR for `Community Content` under the [community-content](https://github.com/GoogleCloudPlatform/vertex-ai-samples/tree/main/community-content) folder:
- [ ] Make sure your main `Content Directory Name` is descriptive, informative, and includes some of the key products and attributes of your content, so that it is differentiable from other content
- [ ] The main content directory has been added to the [CODEOWNERS](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/docs/CODEOWNERS) file under the `# Community Content` section, pointing to the author or the author's team.
- [ ] Passes all the required formatting and linting checks. You can locally test with these [instructions](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/docs/contributing.md#code-quality-checks).
- [ ] The main content directory has been added to the [CODEOWNERS](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/community-content/CODEOWNERS) file under the `Community Content` section, pointing to the author or the author's team.
- [ ] Passes all the required formatting and linting checks. You can locally test with these [instructions](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/CONTRIBUTING.md#code-quality-checks).
+4 -6
View File
@@ -1,9 +1,5 @@
name: ci
on:
pull_request:
paths:
- '**.ipynb'
on: pull_request
jobs:
format_and_lint:
@@ -11,7 +7,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Fetch pull request branch
uses: actions/checkout@v3
with:
+20
View File
@@ -0,0 +1,20 @@
# To use this image, run this command with the desired notebook args from the top-level vertex-ai-samples directory:
# 1. To lint all changed notebooks:
# docker run -v ${PWD}:/setup/app gcr.io/python-docs-samples-tests/notebook_linter:latest
# 2. To lint specific notebooks:
# docker run -v ${PWD}:/setup/app gcr.io/python-docs-samples-tests/notebook_linter:latest notebooks/1.ipynb notebooks/2.ipynb
FROM python:3.10
WORKDIR setup
COPY ./requirements.txt .
COPY ./run_linter.sh .
# Install dependencies.
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
WORKDIR app
ENTRYPOINT ["/setup/run_linter.sh"]
+4 -3
View File
@@ -2,8 +2,9 @@ git+https://github.com/tensorflow/docs
ipython
jupyter
nbconvert
black==22.1.0
pyupgrade==2.31.0
black==22.6.0
pyupgrade==2.34.0
isort==5.10.1
flake8==4.0.1
nbqa==1.2.3
nbqa==1.4.0
+16 -6
View File
@@ -47,12 +47,22 @@ done
echo "Test mode: $is_test"
# Read in user-provided notebooks
notebooks=()
for arg in "$@"; do
if [[ $arg == *.ipynb ]]; then
notebooks+=("$arg")
fi
done
# Only check notebooks in test folders modified in this pull request.
# Note: Use process substitution to persist the data in the array
notebooks=()
while read -r file || [ -n "$line" ]; do
notebooks+=("$file")
done < <(git diff --name-only main... | grep '\.ipynb$')
if [ ${#notebooks[@]} -eq 0 ]; then
echo "Checking for changed notebooked using git"
while read -r file || [ -n "$line" ]; do
notebooks+=("$file")
done < <(git diff --name-only main... | grep '\.ipynb$')
fi
problematic_notebooks=()
if [ ${#notebooks[@]} -gt 0 ]; then
@@ -68,7 +78,7 @@ if [ ${#notebooks[@]} -gt 0 ]; then
if [ "$is_test" = true ]; then
echo "Running nbfmt..."
python3 -m tensorflow_docs.tools.nbfmt --remove_outputs --test "$notebook"
python3 -m tensorflow_docs.tools.nbfmt --test "$notebook"
NBFMT_RTN=$?
# echo "Running black..."
# python3 -m nbqa black "$notebook" --check
@@ -93,7 +103,7 @@ if [ ${#notebooks[@]} -gt 0 ]; then
python3 -m nbqa isort "$notebook"
ISORT_RTN=$?
echo "Running nbfmt..."
python3 -m tensorflow_docs.tools.nbfmt --remove_outputs "$notebook"
python3 -m tensorflow_docs.tools.nbfmt "$notebook"
NBFMT_RTN=$?
echo "Running flake8..."
python3 -m nbqa flake8 "$notebook" --show-source --extend-ignore=W391,E501,F821,E402,F404,W503,E203,E722,W293,W291
+1 -1
View File
@@ -48,8 +48,8 @@ then you will need to manually address them before submitting your PR.
nbqa black "$notebook"
nbqa pyupgrade "$notebook"
nbqa isort "$notebook"
python3 -m tensorflow_docs.tools.nbfmt --remove_outputs "$notebook"
nbqa flake8 "$notebook" --extend-ignore=W391,E501,F821,E402,F404,W503,E203,E722,W293,W291
python3 -m tensorflow_docs.tools.nbfmt --remove_outputs "$notebook"
```
## Code Reviews
+13 -1
View File
@@ -6,7 +6,19 @@ Welcome to the Google Cloud [Vertex AI](https://cloud.google.com/vertex-ai/docs/
## Overview
The repository contains [Notebooks](https://github.com/GoogleCloudPlatform/vertex-ai-samples/tree/master/notebooks) and [Community Content](https://github.com/GoogleCloudPlatform/vertex-ai-samples/tree/master/community-content) that demonstrate how to develop and manage ML workflows using Google Cloud Vertex AI.
The repository contains [notebooks](https://github.com/GoogleCloudPlatform/vertex-ai-samples/tree/master/notebooks) and [community content](https://github.com/GoogleCloudPlatform/vertex-ai-samples/tree/master/community-content) that demonstrate how to develop and manage ML workflows using Google Cloud Vertex AI.
## Repository structure
```bash
├── community-content - Sample code and tutorials contributed by the community
├── notebooks
│ ├── community - Notebooks contributed by the community
│ ├── official - Notebooks demonstrating use of each Vertex AI service
│ │ ├── automl
│ │ ├── custom
│ │ ├── ...
```
## Contributing
+3
View File
@@ -1,5 +1,8 @@
* @vertex-ai-samples-contributors @GoogleCloudPlatform/cloudml-samples-owners
/tf_agents_bandits_movie_recommendation_with_kfp_and_vertex_sdk @yinghsienwu
/pytorch_pre_built_images_deployment @googleapis/vertex-prediction-team
/pytorch_text_classification_using_vertex_sdk_and_gcloud @RajeshThallam
/pytorch_text_classification_using_vertex_sdk_and_gcloud @RajeshThallam @ultrons
/sklearn_text_classification_from_script_using_vertex_sdk @maxhardt
/pluto_on_workbench @wkharold
/cpr-examples @samthrasher
@@ -0,0 +1,5 @@
testdata/*
build.py
test.py
state_dict.pth
config.json
@@ -0,0 +1,6 @@
cpr_model_server.py
entrypoint.py
state_dict.pth
config.json
**/__pycache__
!testdata/**
@@ -0,0 +1,110 @@
# CPR Example: PyTorch Image Models (timm)
## About CPR
CPR ([custom prediction routines](https://github.com/googleapis/python-aiplatform/blob/main/google/cloud/aiplatform/prediction/README.md)) is a framework designed by Google Cloud developers to make it easier to combine machine learning models with custom preprocessing and postprocessing logic in a real-time serving application.
## Using this example
This code is a self-contained example of a custom model server project built using CPR.
As is, you can use it to serve the ViT-Small image classification model from Ross Wightman's [`timm`](https://github.com/rwightman/pytorch-image-models) library of image model implementations in PyTorch. Both CPU and GPU are supported.
You can also consider using the code here as a template for your own CPR project if you want to use a different model from `timm`, a different PyTorch model, or an entirely different framework.
### Requirements
In order to use this example, you'll need Docker and Python 3 installed on your system.
To get started, first create a virtual environment in an empty directory:
```sh
mkdir cpr-example
python3 -m venv cpr-example
cd cpr-example && source bin/activate
```
Then, clone the [vertex-ai-samples repo](https://github.com/GoogleCloudPlatform/vertex-ai-samples) in that directory:
```sh
git clone https://github.com/GoogleCloudPlatform/vertex-ai-samples.git
cd vertex-ai-samples/community-content/cpr-examples/timm_serving
```
Finally, install the Python modules required to build and run the model server:
```sh
pip install -r requirements.txt
```
### Auth
This example uses Google Cloud Storage for hosting model artifacts and Artifact Registry to store the container image.
You'll need to authorize yourself before you can interact with these.
First, log in to GCP with application default credentials:
```sh
gcloud auth application-default login
```
Next, if you haven't done so already, set up the [gcloud credential helper](https://cloud.google.com/artifact-registry/docs/docker/authentication)
for the Artifact Registry region where you intend to host the image.
```
gcloud auth configure-docker <region>-docker.pkg.dev
```
### Predictor
The `TimmPredictor` class in `timm_serving/predictor.py` implements most of the important logic for the server.
- `load(artifacts_dir)`: The predictor's `load` method is called when the server starts up in order to set up the predictor, usually by loading model weights and any artifacts needed for preprocessing and postprocessing. In this example, we initialize the saved model from the `state_dict.pth` file located inside the `artifacts_dir` folder and create the preprocessing transform from the model config.
- `preprocess`, `predict`, `postprocess`: These methods are applied in sequence to the deserialized JSON data from each request.
- `preprocess` decodes images from base64 and apply cropping, scaling and normalizing transforms.
- `predict` runs the ViT-Small model on the preprocessed images and returns class scores.
- `postprocess` finds the top five classes and packs the class names, probabilities, and indices in a serializable result.
### Building the container
To build the model server locally, run the build command:
```sh
python build.py build
```
You can edit configuration values such as the model server's base image, the name and tag assigned to the image, and the path where model weights are stored locally.
When you run the build command, model weights are downloaded and the model server container is built.
### Running local tests
`test.py` contains a suite of unit tests for the predictor as well as end-to-end tests for the model server.
To run the tests:
```sh
python test.py
```
All of the test images are public domain.
- [Cat](https://commons.wikimedia.org/wiki/File:Stray_cat_on_wall.jpg)
- [Airplane](https://commons.wikimedia.org/wiki/File:Airplanes_jets.jpg)
- The infamous [mandrill](https://commons.wikimedia.org/wiki/File:Wikipedia-sipi-image-db-mandrill-4.2.03.png)
### Deploying to Vertex AI
Before uploading or deploying the container, you'll need to modify `config.py` to set appropriate values for:
- `project_id`: Your GCP project id.
- `region`: Region where the model will be uploaded and deployed.
- `repository`: [Artifact Registry repository](https://cloud.google.com/artifact-registry/docs/repositories/create-repos) in your project where the container image will be uploaded.
- `artifacts_gcs_dir`: Folder in a [Google Cloud Storage bucket](https://cloud.google.com/storage/docs/creating-buckets) where the model weights will be uploaded.
Once this is done, first upload the model:
```sh
python build.py upload
```
Then deploy it:
```sh
python build.py deploy
```
If you run the deploy command again, it will create a new endpoint. If you want to undeploy the model, you can do so using the Vertex AI dashboard on the Google Cloud console, or use `gcloud ai endpoints undeploy` from the command line.
After deploying successfully, you can run `python build.py probe` to send a sample request to the deployed model.
@@ -0,0 +1,117 @@
# Copyright 2022 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Build the model server container."""
import json
import logging
import os
import pathlib
from typing import Sequence
from absl import app
from absl import logging
from config import CPRConfig
from google.cloud import aiplatform
from google.cloud.aiplatform import prediction as cpr
import smart_open
import timm
from timm_serving import predictor
import torch
def build_container(config: CPRConfig, tag: str) -> cpr.LocalModel:
"""Build the model server container.
Args:
tag: Output image tag.
Returns:
LocalModel exposing the built model server.
"""
return cpr.LocalModel.build_cpr_model(
src_dir=os.path.join(os.getcwd()),
output_image_uri=tag,
base_image=config.base_image,
predictor=predictor.TimmPredictor,
requirements_path=os.path.join(os.getcwd(), "requirements.txt"),
)
def save_model_artifact(destination: str) -> None:
"""Save a copy of the model state dict."""
model = timm.create_model(predictor.TimmPredictor.TIMM_MODEL_NAME, pretrained=True)
dest_file = os.path.join(destination, predictor.TimmPredictor.WEIGHTS_FILE)
with smart_open.open(dest_file, "wb") as f:
torch.save(model, f)
logging.info("Saved model to %s", dest_file)
logging.info("%s parameters", sum(p.numel() for p in model.parameters()))
def upload_model(config: CPRConfig) -> aiplatform.Model:
"""Tag and upload the model server."""
ar_tag = (
f"{config.region}-docker.pkg.dev/{config.project_id}"
f"/{config.repository}/{config.image}"
)
local_model = build_container(config, tag=ar_tag)
aiplatform.init(project=config.project_id, location=config.region)
local_model.push_image()
aip_model = aiplatform.Model.upload(
local_model=local_model,
display_name=predictor.TimmPredictor.TIMM_MODEL_NAME,
artifact_uri=config.artifact_gcs_dir,
)
config.model_name = aip_model.resource_name
config.save()
return aip_model
def deploy_model(config: CPRConfig) -> aiplatform.Endpoint:
"""Deploy the model server to a Vertex Prediction endpoint."""
aiplatform.init(project=config.project_id, location=config.region)
aip_model = aiplatform.Model(model_name=config.model_name)
endpoint = aip_model.deploy(machine_type=config.machine_type)
config.endpoint_name = endpoint.resource_name
config.save()
return endpoint
def probe_prediction(config: CPRConfig, request_path: str) -> None:
"""Send a sample prediction request to the Vertex Prediction endpoint."""
aiplatform.init(project=config.project_id, location=config.region)
aip_endpoint = aiplatform.Endpoint(endpoint_name=config.endpoint_name)
with open(request_path) as f:
logging.info(aip_endpoint.predict(**json.load(f)))
def main(argv: Sequence[str]):
config = CPRConfig()
if pathlib.Path(config.config_file).exists():
config.load()
actions = set(argv[1:])
if "build" in actions:
build_container(config, config.image)
save_model_artifact(config.artifact_local_dir)
if "upload" in actions:
save_model_artifact(config.artifact_gcs_dir)
upload_model(config)
if "deploy" in actions:
deploy_model(config)
if "probe" in actions:
probe_prediction(config, request_path="sample_request.json")
if __name__ == "__main__":
app.run(main)
@@ -0,0 +1,76 @@
# Copyright 2022 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import dataclasses
import json
@dataclasses.dataclass
class CPRConfig(object):
"""Configure the build process by editing the default values here.
config_file: File path used to save values in this config. (Some
values, such as the model name, are generated at build time and
depended on by future steps, so saving it allows this script to
deploy the model without re-uploading it, for example.)
base_image: Base Docker image on top of which the model server will
be built. By default, a Debian-based Python 3 image without GPU
support will be used.
image: Name and tag assigned to the built model server image.
artifact_local_dir: Local directory where a copy of the pretrained model weights
will be saved.
region: Google Cloud Region where the model will be uploaded during the
build process.
project_id: Google Cloud project ID.
repository: Name of the Artifact Registry repository where the container
will be uploaded.
artifact_gcs_dir: Location on GCS where a copy of the pretrained model
weights will be uploaded.
model_name: Full resource path of the uploaded model. This is a write-only
field, the value is generated by Vertex AI when the model is uploaded.
endpoint_name: Full resource path of the created endpoint. This is a
write-only field, the value is generated by Vertex AI when the model is
deployed to an endpoint.
machine_type: Machine type to use when deploying the model.
"""
config_file: str = "config.json"
base_image: str = "python:3.10-bullseye"
image: str = "timm_predictor:latest"
artifact_local_dir: str = ""
region: str = "us-central1"
project_id: str = "<your project ID here>"
repository: str = "cpr-images"
artifact_gcs_dir: str = "gs://<your bucket ID here>/timm-vit224/"
model_name: str = ""
endpoint_name: str = ""
machine_type: str = "n1-standard-2"
def save(self):
with open(self.config_file, "w") as f:
json.dump(dataclasses.asdict(self), f, indent=2)
def load(self):
with open(self.config_file) as f:
self.__init__(**json.load(f))
@@ -0,0 +1,8 @@
absl-py==1.1.0
fastapi==0.75.2
uvicorn==0.18.2
timm==0.5.4
smart_open==6.0.0
google-cloud-storage>=1.26.0,<2.0.0dev
google-cloud-aiplatform[prediction]>=1.16.0
File diff suppressed because one or more lines are too long
@@ -0,0 +1,255 @@
"""Test the timm_serving predictor."""
import base64
import json
import logging
import os
import pickle
from typing import List, Dict
from absl import flags
from absl import logging
from absl.testing import absltest
from config import CPRConfig
import fastapi
from google.cloud import aiplatform
from google.cloud.aiplatform import prediction as cpr
import PIL
from timm_serving import predictor
import torch
VIT_SMALL_PARAMS = 22878952
def b64_encode_file(path: str) -> str:
"""Encode a file's contents as base64.
Args:
path: Path to the file.
Returns:
Base64-encoded contents of the file.
"""
with open(path, "rb") as f:
return str(base64.b64encode(f.read()), encoding="utf-8")
def make_instance_dict(
image_paths: List[str], base64_encodings: List[str]
) -> Dict[str, List[str]]:
"""Generate a dictionary similar to a parsed prediction server request.
Args:
image_paths: Paths to image files to include.
base64_encodings: Pre-encoded base64 strings.
Returns:
Dictionary of instances in the format accepted by the preprocessor.
"""
instances = [s for s in base64_encodings]
for path in image_paths:
instances.append(b64_encode_file(path))
return {"instances": instances}
def count_parameters(model: torch.nn.Module):
"""Count the parameters in a Pytorch model.
Args:
model: Pytorch model (nn.Module).
Returns:
Number of parameters in the model.
"""
return sum(p.numel() for p in model.parameters())
class PredictorUnitTests(absltest.TestCase):
"""Unit tests for timm_serving.predictor."""
def setUp(self):
super().setUp()
self.config = CPRConfig()
try:
self.config.load()
except FileNotFoundError:
logging.info("No saved config file found, using default values.")
self.predictor = predictor.TimmPredictor()
def test_load_from_saved_state_dict_ok(self):
self.predictor.load(self.config.artifact_local_dir)
self.assertEqual(count_parameters(self.predictor._model), VIT_SMALL_PARAMS)
def test_load_bad_path(self):
with self.assertRaises(FileNotFoundError):
self.predictor.load("testdata/")
with self.assertRaisesRegex(ValueError, "not a directory"):
self.predictor.load("blah")
def test_load_bad_data(self):
with self.assertRaises(pickle.UnpicklingError):
self.predictor.load("testdata/bad_model_1")
with self.assertRaisesRegex(RuntimeError, "Invalid magic number"):
self.predictor.load("testdata/bad_model_2")
def test_preprocess_ok(self):
self.predictor.load(self.config.artifact_local_dir)
instance_dict = make_instance_dict(
base64_encodings=[],
image_paths=[
"testdata/airplane.jpg",
"testdata/mandrill.tiff",
"testdata/mandrill.tiff",
"testdata/cat_alpha.png",
],
)
result = self.predictor.preprocess(instance_dict)
self.assertEqual(result.size(), torch.Size([4, 3, 224, 224]))
self.assertEqual(result.dtype, torch.float32)
def test_preprocess_no_instances(self):
self.predictor.load(self.config.artifact_local_dir)
with self.assertRaises(fastapi.HTTPException) as ctx:
self.predictor.preprocess({})
self.assertEqual(ctx.exception.status_code, 400)
self.assertRegex(ctx.exception.detail, 'must contain "instances"')
def test_preprocess_wrong_shape_instances(self):
self.predictor.load(self.config.artifact_local_dir)
instance_dict = {"instances": [[b64_encode_file("testdata/mandrill.tiff")]]}
with self.assertRaises(fastapi.HTTPException) as ctx:
self.predictor.preprocess(instance_dict)
self.assertEqual(ctx.exception.status_code, 400)
self.assertRegex(ctx.exception.detail, "not 'list'")
def test_preprocess_bad_base64(self):
self.predictor.load(self.config.artifact_local_dir)
instance_dict = make_instance_dict(base64_encodings=["!@#$"], image_paths=[])
with self.assertRaises(fastapi.HTTPException) as ctx:
self.predictor.preprocess(instance_dict)
self.assertEqual(ctx.exception.status_code, 400)
self.assertRegex(ctx.exception.detail, "[Bb]ase64")
def test_preprocess_not_image_data(self):
self.predictor.load(self.config.artifact_local_dir)
instance_dict = make_instance_dict(
base64_encodings=[], image_paths=["testdata/bad.jpg"]
)
with self.assertRaises(fastapi.HTTPException) as ctx:
self.predictor.preprocess(instance_dict)
self.assertEqual(ctx.exception.status_code, 400)
self.assertRegex(ctx.exception.detail, "image file")
def test_predict_ok(self):
self.predictor.load(self.config.artifact_local_dir)
inputs = torch.zeros(size=[2, 3, 224, 224], dtype=torch.float32)
if torch.cuda.device_count() > 0:
inputs = inputs.cuda()
result = self.predictor.predict(inputs)
self.assertEqual(result.size(), torch.Size([2, 1000]))
self.assertEqual(result.dtype, torch.float32)
def test_postprocess_ok(self):
class_probs = torch.zeros(size=[2, 1000])
class_probs[0, 0] = 1
class_probs[1, 123] = 1
result = self.predictor.postprocess(class_probs)
predictions = result["predictions"]
self.assertLen(predictions[0]["class_names"], 5)
self.assertLen(predictions[0]["indices"], 5)
self.assertLen(predictions[0]["probabilities"], 5)
self.assertLen(predictions[1]["class_names"], 5)
self.assertLen(predictions[1]["indices"], 5)
self.assertLen(predictions[1]["probabilities"], 5)
self.assertContainsSubsequence(predictions[0]["class_names"][0], "tench")
self.assertContainsSubsequence(
predictions[1]["class_names"][0], "spiny lobster"
)
class ServerEndToEndTests(absltest.TestCase):
"""End-to-end tests for the model server, using LocalEndpoint."""
def setUp(self):
super().setUp()
self.config = CPRConfig()
try:
self.config.load()
except FileNotFoundError:
logging.info("No saved config file found, using default values.")
self.local_model = cpr.LocalModel(
serving_container_spec=aiplatform.gapic.ModelContainerSpec(
image_uri=self.config.image
)
)
self.local_endpoint = self.local_model.deploy_to_local_endpoint(
artifact_uri=self.config.artifact_local_dir or os.getcwd()
)
self.local_endpoint.serve()
def tearDown(self):
self.local_endpoint.stop()
super().tearDown()
def test_e2e_healthcheck_ok(self):
health_check_response = self.local_endpoint.run_health_check()
self.assertEqual(health_check_response.status_code, 200)
self.assertEqual(health_check_response.content, b"{}")
def test_e2e_predict_ok(self):
predict_request = json.dumps(
make_instance_dict(
base64_encodings=[],
image_paths=[
"testdata/mandrill.tiff",
],
)
)
response = self.local_endpoint.predict(
request=predict_request, headers={"Content-Type": "application/json"}
)
logging.info(response.content)
self.assertEqual(response.status_code, 200)
predictions = response.json()["predictions"]
self.assertContainsSubsequence(predictions[0]["class_names"][0], "baboon")
def test_e2e_predict_bad_json_returns_400(self):
predict_request = "blah"
response = self.local_endpoint.predict(
request=predict_request, headers={"Content-Type": "application/json"}
)
logging.info(response.content)
self.assertEqual(response.status_code, 400)
def test_e2e_predict_no_instances_returns_400(self):
predict_request = json.dumps({})
response = self.local_endpoint.predict(
request=predict_request, headers={"Content-Type": "application/json"}
)
logging.info(response.content)
self.assertEqual(response.status_code, 400)
def test_e2e_predict_bad_base64_returns_400(self):
predict_request = json.dumps(
make_instance_dict(base64_encodings=["blah"], image_paths=[])
)
response = self.local_endpoint.predict(
request=predict_request, headers={"Content-Type": "application/json"}
)
logging.info(response.content)
self.assertEqual(response.status_code, 400)
def test_e2e_predict_bad_image_returns_400(self):
predict_request = json.dumps(
make_instance_dict(base64_encodings=[], image_paths=["testdata/bad.jpg"])
)
response = self.local_endpoint.predict(
request=predict_request, headers={"Content-Type": "application/json"}
)
logging.info(response.content)
self.assertEqual(response.status_code, 400)
if __name__ == "__main__":
absltest.main()
Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

@@ -0,0 +1 @@
some non-image data
@@ -0,0 +1 @@
some non-image data
@@ -0,0 +1 @@
blah
Binary file not shown.

After

Width:  |  Height:  |  Size: 348 KiB

File diff suppressed because it is too large Load Diff
@@ -0,0 +1,178 @@
# Copyright 2022 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Adapts a pretrained TIMM image classification model to the CPR framework.
Documentation for the TIMM (Torch IMage Models) library is here:
https://rwightman.github.io/pytorch-image-models/
Its source can also be found here:
https://github.com/rwightman/pytorch-image-models
"""
import base64
import binascii
import io
import os
from typing import Dict, List, Union
from fastapi import HTTPException
from google.cloud.aiplatform import prediction as cpr
from pathlib import Path
import PIL
import smart_open
import timm
import torch
import torch.nn.functional as F
with open(Path(__file__).parent.absolute().joinpath("imagenet.txt")) as f:
IMAGENET_CLASSES = f.read().splitlines()
class TimmPredictor(cpr.predictor.Predictor):
"""Predictor class for image models based on TIMM."""
TIMM_MODEL_NAME = os.getenv("TIMM_MODEL_NAME", default="vit_small_patch32_224")
WEIGHTS_FILE = "state_dict.pth"
NUM_TOP_CLASSES_TO_RETURN = 5
def __init__(self):
self._cuda = torch.cuda.device_count() > 0
def load(self, artifacts_uri: str = ""):
"""Initializes the model and preprocessing transforms.
Args:
artifacts_uri: Directory where state dict is stored. Can be a
GCS URI or local path.
"""
if artifacts_uri:
artifact_path = os.path.join(artifacts_uri)
if not (os.path.isdir(artifact_path) or artifact_path.startswith("gs://")):
raise ValueError("Provided artifact_uri is not a directory.")
else:
artifact_path = os.getcwd()
artifact_path = os.path.join(artifact_path, self.WEIGHTS_FILE)
with smart_open.open(artifact_path, "rb") as f:
self._model = torch.load(f)
if self._cuda:
self._model.cuda()
config = timm.data.resolve_data_config(model=self.TIMM_MODEL_NAME, args=[])
self._transform = timm.data.create_transform(
is_training=False, use_prefetcher=False, **config
)
def preprocess(self, request_dict: Dict[str, List[str]]) -> torch.Tensor:
"""Performs preprocessing.
By default, the server expects a request body consisting of a valid JSON
object. This will be parsed by the handler before it's evaluated by the
preprocess method.
Args:
request_dict: Parsed request body. We expect that the input consists of
a list of base64-encoded image files under the "instances" key. (Any
image format that PIL.image.open can handle is okay.)
Returns:
torch.Tensor containing the preprocessed images as a batch. If GPU is
available, the result tensor will be stored on GPU.
"""
if "instances" not in request_dict:
raise HTTPException(
status_code=400,
detail='Request must contain "instances" as a top-level key.',
)
tensors = []
for (i, image) in enumerate(request_dict["instances"]):
# We use Base64 encoding to handle image data.
# This is probably the best we can do while still using JSON input.
# Overriding the input format requires building a custom Handler.
try:
image_bytes = base64.b64decode(image, validate=True)
except (binascii.Error, TypeError) as e:
raise HTTPException(
status_code=400,
detail=f"Base64 decoding of the input image at index {i} failed:"
f" {str(e)}",
)
try:
pil_image = PIL.Image.open(io.BytesIO(image_bytes)).convert("RGB")
except PIL.UnidentifiedImageError:
raise HTTPException(
status_code=400,
detail=f"The input image at index {i} could not be identified as an"
" image file.",
)
tensors.append(self._transform(pil_image))
with torch.inference_mode():
result = torch.stack(tensors)
if self._cuda:
result = result.cuda()
return result
def predict(self, instances: torch.Tensor) -> torch.Tensor:
"""Performs prediction.
Args:
instances: torch.Tensor with type torch.float32 and shape
[?, 3, 224, 224], containing the pre-processed input images.
Returns:
Vector of scores with type torch.float32 and shape [?, 1000],
representing the model's estimate of the likelihood that the
input belongs to the Imagenet class with that index.
"""
with torch.inference_mode():
class_scores = self._model(instances)
return class_scores
def postprocess(
self, class_scores: torch.Tensor
) -> Dict[str, List[Dict[str, Union[str, int, float]]]]:
"""Translate the model output into a classification result.
Args:
class_scores: torch.Tensor with type torch.float32 and shape
[?, 1000], containing the scores assigned to each class by
the model.
Returns:
Dictionary containing the list of classification results. Each
classification result contains the probabilities, class names, and
class indices of the classes with the top class scores as reported by
the model.
"""
class_probs = F.softmax(class_scores, dim=1)
top_k = class_probs.topk(self.NUM_TOP_CLASSES_TO_RETURN)
top_k_values = top_k.values.numpy().tolist()
top_k_indices = top_k.indices.numpy().tolist()
predictions = [
dict(
probabilities=values,
indices=indices,
class_names=[IMAGENET_CLASSES[int(class_num)] for class_num in indices],
)
for (values, indices) in zip(top_k_values, top_k_indices)
]
return {"predictions": predictions}
@@ -0,0 +1,52 @@
# Overview
*Pluto* is a programming environment for Julia, designed to be interactive and helpful. It provides a familiar notebook interface but it is not a Jupyter notebook. The biggest difference is that Pluto notebooks are reactive, changing a variable or function in one cell causes the cells that depend on that variable or function to be reevaluated. Pluto also provides useful interaction mechanisms that allow users to dynamically interact with the notebooks computation state.
The JuliaCon 2020 presentation: [Interactive notebooks ~ Pluto.jl]() provides a good introduction to Pluto. The source is at [fonsp/Pluto.jl]()
# Install Pluto
## Create a Vertex AI JupyterLab Instance
1. From the [GCP console](https://console.cloud.google.com) "hamburger menu"
select Vertex AI > Workbench
2. Click NEW NOTEBOOK
* Choose Python 3 if you won't be using a GPU
* Choose Python 3 (CUDA Toolkit xx.y) if you do want use a GPU
3. Give the notebook an appropriate name
4. Edit Notebook properties if you have special requirements otherwise accept the defaults and click CREATE
5. When the notebook instance is ready click OPEN JUPYTERLAB
## Configure JupyterLab
1. Open a terminal by clicking the Terminal icon.
1. Install the plutoserver
pip3 install git+https://github.com/fonsp/pluto-on-jupyterlab.git
1. In a browser go to [julialang.org/downloads](https://julialang.org/downloads/)
1. In the Current stable release right click on the `Generic Linux on x86 / 64-bit (glibc)` link
Select copy link address
1. Back in the terminal switch to root via
sudo -i
1. Download the release to /opt and install julia in /usr/local/bin
```bash
cd /opt
wget <paste the release link address>
tar xf <name of the downloaded tar file>
ln -s /opt/<julia-x.y.z>/bin/julia /usr/local/bin
^d
```
1. Add the Pluto package to Julia
```bash
julia
julia> ]add Pluto
julia> bksp
julia> using Pluto
julia> ^d
```
1. From the JupyterLab menu bar select File > Shut Down
# Start Pluto
1. Click OPEN JUPYTERLAB in the Workbench
1. In the Notebook section of the Launcher click Pluto.jl
1. The welcome to Pluto.jl screen should appear
@@ -1,474 +0,0 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "a6b56b1c7b76"
},
"outputs": [],
"source": [
"# Copyright 2021 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": "c414a395a19b"
},
"source": [
"# PyTorch Image Classification Multi-Node Distributed Data Parallel Training on CPU using Vertex Training with Custom Container"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "b98238e32cf7"
},
"source": [
"<table align=\"left\">\n",
" <td>\n",
" <a href=\"https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/master/community-content/pytorch_image_classification_distributed_data_parallel_training_with_vertex_sdk/multi_node_ddp_gloo_vertex_training_with_custom_container.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",
"</table>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "03d216c7f7b1"
},
"source": [
"## Setup"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "c5ac73516218"
},
"outputs": [],
"source": [
"PROJECT_ID = \"YOUR PROJECT ID\"\n",
"BUCKET_NAME = \"gs://YOUR BUCKET NAME\"\n",
"REGION = \"YOUR REGION\"\n",
"SERVICE_ACCOUNT = \"YOUR SERVICE ACCOUNT\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "0b5ae674177e"
},
"outputs": [],
"source": [
"! gsutil ls -al $BUCKET_NAME"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "19a9b3bdd553"
},
"outputs": [],
"source": [
"content_name = \"pt-img-cls-multi-node-ddp-cust-cont\""
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "57bf6f8b4361"
},
"source": [
"## Local Training"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "e5d8a3443da0"
},
"outputs": [],
"source": [
"! ls trainer"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "07f79309472d"
},
"outputs": [],
"source": [
"! cat trainer/requirements.txt"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "e16cd8bb7483"
},
"outputs": [],
"source": [
"! pip install -r trainer/requirements.txt"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "0b8a210718c4"
},
"outputs": [],
"source": [
"! cat trainer/task.py"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "c0c6e7dfb3c6"
},
"outputs": [],
"source": [
"%run trainer/task.py --epochs 5 --no-cuda --local-mode"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "31dfdeede587"
},
"outputs": [],
"source": [
"! ls ./tmp"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "48d56ec621cc"
},
"outputs": [],
"source": [
"! rm -rf ./tmp"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "8f3ea1210749"
},
"source": [
"## Vertex Training using Vertex SDK and Custom Container"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "93002a20a2a6"
},
"source": [
"### Build Custom Container"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "4130ce43fd08"
},
"outputs": [],
"source": [
"hostname = \"gcr.io\"\n",
"image_name = content_name\n",
"tag = \"latest\"\n",
"\n",
"custom_container_image_uri = f\"{hostname}/{PROJECT_ID}/{image_name}:{tag}\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "2f1fc5b05240"
},
"outputs": [],
"source": [
"! cd trainer && docker build -t $custom_container_image_uri -f Dockerfile ."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "b4f274f499ac"
},
"outputs": [],
"source": [
"! docker run --rm $custom_container_image_uri --epochs 5 --no-cuda --local-mode"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "ee1a0a06d0b4"
},
"outputs": [],
"source": [
"! docker push $custom_container_image_uri"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "cb763be12fc9"
},
"outputs": [],
"source": [
"! gcloud container images list --repository $hostname/$PROJECT_ID"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "10c8cc6b3334"
},
"source": [
"### Initialize Vertex SDK"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "1a12348169fa"
},
"outputs": [],
"source": [
"! pip install -r requirements.txt"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "42e981cefe41"
},
"outputs": [],
"source": [
"from google.cloud import aiplatform\n",
"\n",
"aiplatform.init(\n",
" project=PROJECT_ID,\n",
" staging_bucket=BUCKET_NAME,\n",
" location=REGION,\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "73c92c9298e9"
},
"source": [
"### Create a Vertex Tensorboard Instance"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "bde509558cd5"
},
"outputs": [],
"source": [
"content_name = content_name + \"-cpu\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "6d7908c0083c"
},
"outputs": [],
"source": [
"tensorboard = aiplatform.Tensorboard.create(\n",
" display_name=content_name,\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "a1f0a4f54037"
},
"source": [
"#### Option: Use a Previously Created Vertex Tensorboard Instance\n",
"\n",
"```\n",
"tensorboard_name = \"Your Tensorboard Resource Name or Tensorboard ID\"\n",
"tensorboard = aiplatform.Tensorboard(tensorboard_name=tensorboard_name)\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "a4cac84e04ac"
},
"source": [
"### Run a Vertex SDK CustomContainerTrainingJob"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "f92e8fdd44ee"
},
"outputs": [],
"source": [
"display_name = content_name\n",
"gcs_output_uri_prefix = f\"{BUCKET_NAME}/{display_name}\"\n",
"\n",
"replica_count = 4\n",
"machine_type = \"n1-standard-4\"\n",
"\n",
"args = [\n",
" \"--backend\",\n",
" \"gloo\",\n",
" \"--no-cuda\",\n",
" \"--batch-size\",\n",
" \"128\",\n",
" \"--epochs\",\n",
" \"25\",\n",
"]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "ae4c57df7e07"
},
"outputs": [],
"source": [
"custom_container_training_job = aiplatform.CustomContainerTrainingJob(\n",
" display_name=display_name,\n",
" container_uri=custom_container_image_uri,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "35cf3ecdf0df"
},
"outputs": [],
"source": [
"custom_container_training_job.run(\n",
" args=args,\n",
" base_output_dir=gcs_output_uri_prefix,\n",
" replica_count=replica_count,\n",
" machine_type=machine_type,\n",
" tensorboard=tensorboard.resource_name,\n",
" service_account=SERVICE_ACCOUNT,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "49d10dded73b"
},
"outputs": [],
"source": [
"print(f\"Custom Training Job Name: {custom_container_training_job.resource_name}\")\n",
"print(f\"GCS Output URI Prefix: {gcs_output_uri_prefix}\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "78398f52807b"
},
"source": [
"### Training Output Artifact"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "fc74422de1d1"
},
"outputs": [],
"source": [
"! gsutil ls $gcs_output_uri_prefix"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "5e99a6a05b10"
},
"source": [
"## Clean Up Artifact"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "b0c1b3f7466b"
},
"outputs": [],
"source": [
"! gsutil rm -rf $gcs_output_uri_prefix"
]
}
],
"metadata": {
"colab": {
"name": "multi_node_ddp_gloo_vertex_training_with_custom_container.ipynb",
"toc_visible": true
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
@@ -1,347 +0,0 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "a6b56b1c7b76"
},
"outputs": [],
"source": [
"# Copyright 2021 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": "20a5ea0081d0"
},
"source": [
"# PyTorch Image Classification Multi-Node Distributed Data Parallel Training on GPU using Vertex Training with Custom Container"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "8752d4a255fb"
},
"source": [
"<table align=\"left\">\n",
" <td>\n",
" <a href=\"https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/master/community-content/pytorch_image_classification_distributed_data_parallel_training_with_vertex_sdk/multi_node_ddp_nccl_vertex_training_with_custom_container.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",
"</table>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "03d216c7f7b1"
},
"source": [
"## Setup"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "c5ac73516218"
},
"outputs": [],
"source": [
"PROJECT_ID = \"YOUR PROJECT ID\"\n",
"BUCKET_NAME = \"gs://YOUR BUCKET NAME\"\n",
"REGION = \"YOUR REGION\"\n",
"SERVICE_ACCOUNT = \"YOUR SERVICE ACCOUNT\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "0b5ae674177e"
},
"outputs": [],
"source": [
"! gsutil ls -al $BUCKET_NAME"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "19a9b3bdd553"
},
"outputs": [],
"source": [
"content_name = \"pt-img-cls-multi-node-ddp-cust-cont\""
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "5307fe28b633"
},
"source": [
"## Vertex Training using Vertex SDK and Custom Container"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "46cb58c7fbf9"
},
"source": [
"### Built Custom Container"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "97e66e9f9bab"
},
"outputs": [],
"source": [
"hostname = \"gcr.io\"\n",
"image_name = content_name\n",
"tag = \"latest\"\n",
"\n",
"custom_container_image_uri = f\"{hostname}/{PROJECT_ID}/{image_name}:{tag}\""
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "ae9b29c4773f"
},
"source": [
"### Initialize Vertex SDK"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "dc1e84d5dec2"
},
"outputs": [],
"source": [
"! pip install -r requirements.txt"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "6964be27b98e"
},
"outputs": [],
"source": [
"from google.cloud import aiplatform\n",
"\n",
"aiplatform.init(\n",
" project=PROJECT_ID,\n",
" staging_bucket=BUCKET_NAME,\n",
" location=REGION,\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "594a91f438f2"
},
"source": [
"### Create a Vertex Tensorboard Instance"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "93134273261e"
},
"outputs": [],
"source": [
"content_name = content_name + \"-gpu\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "c2bd82dbcd9b"
},
"outputs": [],
"source": [
"tensorboard = aiplatform.Tensorboard.create(\n",
" display_name=content_name,\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "ebc593c6472e"
},
"source": [
"#### Option: Use a Previously Created Vertex Tensorboard Instance\n",
"\n",
"```\n",
"tensorboard_name = \"Your Tensorboard Resource Name or Tensorboard ID\"\n",
"tensorboard = aiplatform.Tensorboard(tensorboard_name=tensorboard_name)\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "0769e8e34c2f"
},
"source": [
"### Run a Vertex SDK CustomContainerTrainingJob"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "023f33ece826"
},
"outputs": [],
"source": [
"display_name = content_name\n",
"gcs_output_uri_prefix = f\"{BUCKET_NAME}/{display_name}\"\n",
"\n",
"replica_count = 1\n",
"machine_type = \"n1-standard-4\"\n",
"accelerator_count = 4\n",
"accelerator_type = \"NVIDIA_TESLA_K80\"\n",
"\n",
"args = [\n",
" \"--backend\",\n",
" \"nccl\",\n",
" \"--batch-size\",\n",
" \"128\",\n",
" \"--epochs\",\n",
" \"25\",\n",
"]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "d4b599e726ef"
},
"outputs": [],
"source": [
"custom_container_training_job = aiplatform.CustomContainerTrainingJob(\n",
" display_name=display_name,\n",
" container_uri=custom_container_image_uri,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "81321e3bdf7f"
},
"outputs": [],
"source": [
"custom_container_training_job.run(\n",
" args=args,\n",
" base_output_dir=gcs_output_uri_prefix,\n",
" replica_count=replica_count,\n",
" machine_type=machine_type,\n",
" accelerator_count=accelerator_count,\n",
" accelerator_type=accelerator_type,\n",
" tensorboard=tensorboard.resource_name,\n",
" service_account=SERVICE_ACCOUNT,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "5100712c2c4c"
},
"outputs": [],
"source": [
"print(f\"Custom Training Job Name: {custom_container_training_job.resource_name}\")\n",
"print(f\"GCS Output URI Prefix: {gcs_output_uri_prefix}\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "f9b77676e5a6"
},
"source": [
"### Training Output Artifact"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "0e171ce95ace"
},
"outputs": [],
"source": [
"! gsutil ls $gcs_output_uri_prefix"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "cf1b74a12b87"
},
"source": [
"## Clean Up Artifact"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "a0b15089c341"
},
"outputs": [],
"source": [
"! gsutil rm -rf $gcs_output_uri_prefix"
]
}
],
"metadata": {
"colab": {
"name": "multi_node_ddp_nccl_vertex_training_with_custom_container.ipynb",
"toc_visible": true
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
@@ -0,0 +1,30 @@
# PyTorch Deployment on Google Cloud: Text Classification
**This is an Experimental release**, covered by the Pre-GA Offerings Terms of your Google Cloud Platform [Terms of Service](https://cloud.google.com/terms).
Experiments are focused on validating a prototype and are not guaranteed to be released. 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.
**Kindly drop us a note before you run any scale tests.**
**Do not hesitate to contact vertexai-prediction-preview-feedback@google.com if you have any questions or run into any issues.**
The projects need to be added to the allowlist in order to deploy PyTorch models using Vertex AI Prediction pre-built PyTorch images. If you are interested in the feature, please send an email to vertexai-prediction-preview-feedback@google.com to provide your project numbers OR project ids.
## Overview
In the PyTorch on Google Cloud series of blog posts, we aim to share how to deploy PyTorch models at scale on [Vertex AI](https://cloud.google.com/vertex-ai).
This tutorial on text classification shows how to deploy a PyTorch based text classification model on [Vertex AI](https://cloud.google.com/vertex-ai/docs/start/client-libraries#python) using Vertex SDK and [`gcloud ai`](https://cloud.google.com/sdk/gcloud/reference/beta/ai).
## Notebooks
| <h4>Notebook</h4> | <h4>Description</h4> |
| :-------- | :------- |
| [pytorch-text-classification-vertex-ai-deploy.ipynb](./pytorch-text-classification-vertex-ai-deploy.ipynb) | Notebook to show deploying a PyTorch model on Vertex AI |
## Folders
| <h4>Folder Name</h4> | <h4>Description</h4> |
| :-------- | :------- |
| [`predictor`](./predictor) | Folder with custom prediction handler to deploy a PyTorch model to Vertex Prediction. In the [notebook](./pytorch-text-classification-vertex-ai-deploy.ipynb), this folder is used for deploying a PyTorch model on Vertex AI using Vertex Prediction pre-built PyTorch images |
@@ -0,0 +1,91 @@
import os
import json
import logging
import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer
from ts.torch_handler.base_handler import BaseHandler
logger = logging.getLogger(__name__)
class TransformersClassifierHandler(BaseHandler):
"""
The handler takes an input string and returns the classification text
based on the serialized transformers checkpoint.
"""
def __init__(self):
super(TransformersClassifierHandler, self).__init__()
self.initialized = False
def initialize(self, ctx):
""" Loads the model.pt file and initialized the model object.
Instantiates Tokenizer for preprocessor to use
Loads labels to name mapping file for post-processing inference response
"""
self.manifest = ctx.manifest
properties = ctx.system_properties
model_dir = properties.get("model_dir")
self.device = torch.device("cuda:" + str(properties.get("gpu_id")) if torch.cuda.is_available() else "cpu")
# Read model serialize/pt file
serialized_file = self.manifest["model"]["serializedFile"]
model_pt_path = os.path.join(model_dir, serialized_file)
if not os.path.isfile(model_pt_path):
raise RuntimeError("Missing the model.pt or pytorch_model.bin file")
# Load model
self.model = AutoModelForSequenceClassification.from_pretrained(model_dir)
self.model.to(self.device)
self.model.eval()
logger.debug('Transformer model from path {0} loaded successfully'.format(model_dir))
# Ensure to use the same tokenizer used during training
self.tokenizer = AutoTokenizer.from_pretrained('bert-base-cased')
# Read the mapping file, index to object name
mapping_file_path = os.path.join(model_dir, "index_to_name.json")
if os.path.isfile(mapping_file_path):
with open(mapping_file_path) as f:
self.mapping = json.load(f)
else:
logger.warning('Missing the index_to_name.json file. Inference output will default.')
self.mapping = {"0": "Negative", "1": "Positive"}
self.initialized = True
def preprocess(self, data):
""" Preprocessing input request by tokenizing
Extend with your own preprocessing steps as needed
"""
text = data[0].get("data")
if text is None:
text = data[0].get("body")
sentences = text.decode('utf-8')
logger.info("Received text: '%s'", sentences)
# Tokenize the texts
tokenizer_args = ((sentences,))
inputs = self.tokenizer(*tokenizer_args,
padding='max_length',
max_length=128,
truncation=True,
return_tensors = "pt")
return inputs
def inference(self, inputs):
""" Predict the class of a text using a trained transformer model.
"""
prediction = self.model(inputs['input_ids'].to(self.device))[0].argmax().item()
if self.mapping:
prediction = self.mapping[str(prediction)]
logger.info("Model predicted: '%s'", prediction)
return [prediction]
def postprocess(self, inference_output):
return inference_output
@@ -0,0 +1,5 @@
{
"0": "Negative",
"1": "Positive"
}
@@ -658,8 +658,8 @@
},
"outputs": [],
"source": [
"datasets = load_dataset(\"imdb\")\n",
"datasets"
"dataset = load_dataset(\"imdb\")\n",
"dataset"
]
},
{
@@ -668,7 +668,7 @@
"id": "RzfPtOMoIrIu"
},
"source": [
"The `datasets` object itself is [`DatasetDict`](https://huggingface.co/docs/datasets/package_reference/main_classes.html#datasetdict), which contains one key for the training, validation and test set."
"The `dataset` object itself is [`DatasetDict`](https://huggingface.co/docs/datasets/package_reference/main_classes.html#datasetdict), which contains one key for the training, validation and test set."
]
},
{
@@ -681,12 +681,12 @@
"source": [
"print(\n",
" \"Total # of rows in training dataset {} and size {:5.2f} MB\".format(\n",
" datasets[\"train\"].shape[0], datasets[\"train\"].size_in_bytes / (1024 * 1024)\n",
" dataset[\"train\"].shape[0], dataset[\"train\"].size_in_bytes / (1024 * 1024)\n",
" )\n",
")\n",
"print(\n",
" \"Total # of rows in test dataset {} and size {:5.2f} MB\".format(\n",
" datasets[\"test\"].shape[0], datasets[\"test\"].size_in_bytes / (1024 * 1024)\n",
" dataset[\"test\"].shape[0], dataset[\"test\"].size_in_bytes / (1024 * 1024)\n",
" )\n",
")"
]
@@ -708,7 +708,7 @@
},
"outputs": [],
"source": [
"datasets[\"train\"][0]"
"dataset[\"train\"][0]"
]
},
{
@@ -728,7 +728,7 @@
},
"outputs": [],
"source": [
"label_list = datasets[\"train\"].unique(\"label\")\n",
"label_list = dataset[\"train\"].unique(\"label\")\n",
"label_list"
]
},
@@ -779,7 +779,7 @@
},
"outputs": [],
"source": [
"show_random_elements(datasets[\"train\"])"
"show_random_elements(dataset[\"train\"])"
]
},
{
@@ -883,7 +883,7 @@
},
"outputs": [],
"source": [
"example = datasets[\"train\"][4]\n",
"example = dataset[\"train\"][4]\n",
"print(example)"
]
},
@@ -920,7 +920,7 @@
"source": [
"# Dataset loading repeated here to make this cell idempotent\n",
"# Since we are over-writing datasets variable\n",
"datasets = load_dataset(\"imdb\")\n",
"dataset = load_dataset(\"imdb\")\n",
"\n",
"# Mapping labels to ids\n",
"# NOTE: We can extract this automatically but the `Unique` method of the datasets\n",
@@ -948,7 +948,7 @@
"\n",
"\n",
"# apply preprocessing function to input examples\n",
"datasets = datasets.map(preprocess_function, batched=True, load_from_cache_file=True)"
"dataset = dataset.map(preprocess_function, batched=True, load_from_cache_file=True)"
]
},
{
@@ -1091,8 +1091,8 @@
"trainer = Trainer(\n",
" model,\n",
" args,\n",
" train_dataset=datasets[\"train\"],\n",
" eval_dataset=datasets[\"test\"],\n",
" train_dataset=dataset[\"train\"],\n",
" eval_dataset=dataset[\"test\"],\n",
" data_collator=default_data_collator,\n",
" tokenizer=tokenizer,\n",
" compute_metrics=compute_metrics,\n",
@@ -1,4 +1,4 @@
google-cloud-bigquery==2.20.0
tensorflow==2.5.3
pillow==9.0.0
tensorflow==2.7.2
pillow==9.0.1
tf-agents==0.8.0
@@ -1,4 +1,4 @@
google-cloud-pubsub==2.5.0
pillow==9.0.0
pillow==9.0.1
tf-agents==0.8.0
tensorflow==2.5.3
tensorflow==2.7.2
@@ -1,5 +1,5 @@
dataclasses==0.6
google-cloud-aiplatform==1.8.1
tensorflow==2.5.3
pillow==9.0.0
tensorflow==2.7.2
pillow==9.0.1
tf-agents==0.8.0
@@ -706,8 +706,8 @@
" else:\n",
" data_spec = training_data_spec_transformation_fn(\n",
" agent.policy.trajectory_spec)\n",
" replay_buffer = trainer.get_replay_buffer(data_spec, environment.batch_size,\n",
" steps_per_loop)\n",
" replay_buffer = trainer.get_replay_buffer(data_spec, environment.batch_size,\n",
" steps_per_loop)\n",
"\n",
" # `step_metric` records the number of individual rounds of bandit interaction;\n",
" # that is, (number of trajectories) * batch_size.\n",
@@ -1 +1 @@
tensorflow==2.5.3
tensorflow==2.7.2
+2 -2
View File
@@ -1,5 +1,5 @@
The [official](https://github.com/GoogleCloudPlatform/vertex-ai-samples/tree/main/notebooks/official) folder contains notebooks organized by Google Cloud product.
The [official](https://github.com/GoogleCloudPlatform/vertex-ai-samples/tree/main/notebooks/official) folder contains notebooks organized by Google Cloud product. These are tested weekly and maintained by Google.
The [community](https://github.com/GoogleCloudPlatform/vertex-ai-samples/tree/main/notebooks/community) folder contains notebooks that aren't officially supported by Google.
The [community](https://github.com/GoogleCloudPlatform/vertex-ai-samples/tree/main/notebooks/community) folder contains notebooks that may be created by Google or external contributors. They are not necessary maintained.
Contributions to the repo should use the [notebook template](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/notebook_template.ipynb) as a starting point.
+24 -11
View File
@@ -3,21 +3,34 @@
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.
/sdk/sdk_* @aferlitsch
/gapic @aferlitsch
/ml_ops @aferlitsch
/model_monitoring/* @mco
/sdk/sdk_* @andrewferlitsch
/gapic @andrewferlitsch
/gapic/custom/showcase_custom_image_classification_online_explain_example_based_api.ipynb @inardini
/ml_ops @andrewferlitsch
/model_monitoring/* @andrewferlitsch
/structured_data/rapid_prototyping_* @rafael-carvalho
/managed_notebooks/ @notebooks-team
/managed_notebooks/
/bigquery_ml/ @polong
/sdk/SDK_FBProphet_Forecasting_Online.ipynb @brianchunkang
/pipelines/google_cloud_pipeline_components_TPU_model_train_upload_deploy.ipynb @brianchunkang
/sdk/SDK_AutoML_Forecasting_Model_Training_Example.ipynb @thehardikv
/sdk/sdk_automl_forecasting_evaluating_a_model.ipynb @thehardikv
/explainable_ai/SDK_Custom_Container_XAI.ipynb @brianchunkang
/matching_engine/sdk_matching_engine_for_indexing.ipynb @ivanmkc
/matching_engine/matching_engine_for_indexing.ipynb @yinghsienwu
/neo4j @benofben @htappen
/matching_engine/stream_update_for_matching_engine.ipynb @peterping666
/sdk/pytorch_lightning_custom_container_training.ipynb @brianchunkang
/tensorboard @yfang1 @wattli
/feature_store @nayaknishant @morgandu @inardini
/vertex_endpoints/tf_hub_obj_detection/deploy_tfhub_object_detection_on_vertex_endpoints.ipynb @jfacevedo
/tensorboard @yfang1
/feature_store @nayaknishant @morgandu
/prediction @googleapis/vertex-prediction-team
/vertex_endpoints/tf_hub_obj_detection/deploy_tfhub_object_detection_on_vertex_endpoints.ipynb @entrpn
/vertex_endpoints/nvidia-triton/nvidia-triton-custom-container-prediction.ipynb @RajeshThallam
/vertex_endpoints/optimized_tensorflow_runtime @vlasenkoalexey
/notebooks/community/ml_ops/stage2/get_started_with_visionapi_and_automl.ipynb @mansari
/notebooks/community/neo4j/graph_paysim.ipynb @benofben @laeg
/notebooks/community/ml_ops/stage1/get_started_with_visionapi_and_vertex_datasets.ipynb @mansari
/notebooks/community/pipelines/google_cloud_pipeline_components_bqml_pipeline_demand_forecasting.ipynb @inardini
/notebooks/community/ml_ops/stage2/get_started_vertex_hpt_r_kernel.ipynb @fhirschmann
/notebooks/community/ml_ops/stage2/get_started_vertex_training_r_using_r_kernel.ipynb @fhirschmann
/notebooks/community/vertex-ai-samples/notebooks/community/model_registry/vertex_ai_model_registry_bqml_custom_model_versioning.ipynb @inardini
/notebooks/community/vertex-ai-samples/notebooks/community/model_registry/vertex_ai_model_registry_automl_model_versioning.ipynb @inardini
/notebooks/community/vizier/conversions_vertex_vizier_and_open_source_vizier.ipynb @halio-g
@@ -171,7 +171,7 @@
},
"outputs": [],
"source": [
"! pip install {USER_FLAG} --upgrade git+https://github.com/googleapis/python-aiplatform.git@v1.6.0"
"! pip install {USER_FLAG} --upgrade google-cloud-aiplatform"
]
},
{
@@ -266,7 +266,7 @@
"\n",
"# Get your Google Cloud project ID from gcloud\n",
"if not os.getenv(\"IS_TESTING\"):\n",
" shell_output=!gcloud config list --format 'value(core.project)' 2>/dev/null\n",
" shell_output = !gcloud config list --format 'value(core.project)' 2>/dev/null\n",
" PROJECT_ID = shell_output[0]\n",
" print(\"Project ID: \", PROJECT_ID)"
]
@@ -292,6 +292,37 @@
" PROJECT_ID = \"python-docs-samples-tests\" # @param {type:\"string\"}"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "d9f118b92c74"
},
"source": [
"#### UUID\n",
"\n",
"If you are in a live tutorial session, you might be using a shared test account or project. To avoid name collisions between users on resources created, you create a uuid for each instance session, and append it onto the name of resources you create in this tutorial."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "3ee72715c0fd"
},
"outputs": [],
"source": [
"import random\n",
"import string\n",
"\n",
"\n",
"# Generate a uuid of a specifed length(default=8)\n",
"def generate_uuid(length: int = 8) -> str:\n",
" return \"\".join(random.choices(string.ascii_lowercase + string.digits, k=length))\n",
"\n",
"\n",
"UUID = generate_uuid()"
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -478,7 +509,6 @@
"from google.cloud.aiplatform_v1.types import \\\n",
" featurestore_service as featurestore_service_pb2\n",
"from google.cloud.aiplatform_v1.types import io as io_pb2\n",
"from google.protobuf.duration_pb2 import Duration\n",
"\n",
"# Create admin_client for CRUD and data_client for reading feature values.\n",
"admin_client = FeaturestoreServiceClient(client_options={\"api_endpoint\": API_ENDPOINT})\n",
@@ -542,30 +572,23 @@
},
"outputs": [],
"source": [
"FEATURESTORE_ID = \"movie_prediction\"\n",
"create_lro = admin_client.create_featurestore(\n",
" featurestore_service_pb2.CreateFeaturestoreRequest(\n",
" parent=BASE_RESOURCE_PATH,\n",
" featurestore_id=FEATURESTORE_ID,\n",
" featurestore=featurestore_pb2.Featurestore(\n",
" online_serving_config=featurestore_pb2.Featurestore.OnlineServingConfig(\n",
" fixed_node_count=1\n",
"FEATURESTORE_ID = f\"movie_prediction_{UUID}\"\n",
"try:\n",
" create_lro = admin_client.create_featurestore(\n",
" featurestore_service_pb2.CreateFeaturestoreRequest(\n",
" parent=BASE_RESOURCE_PATH,\n",
" featurestore_id=FEATURESTORE_ID,\n",
" featurestore=featurestore_pb2.Featurestore(\n",
" online_serving_config=featurestore_pb2.Featurestore.OnlineServingConfig(\n",
" fixed_node_count=1\n",
" ),\n",
" ),\n",
" ),\n",
" )\n",
" )\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "57V8eVcB5VFZ"
},
"outputs": [],
"source": [
"# Wait for LRO to finish and get the LRO result.\n",
"print(create_lro.result())"
" # Wait for LRO to finish and get the LRO result.\n",
" print(create_lro.result())\n",
"except Exception as e:\n",
" print(e)"
]
},
{
@@ -574,7 +597,7 @@
"id": "ag8pCQ7rNjVf"
},
"source": [
"You can use [GetFeaturestore](https://cloud.google.com/vertex-ai/docs/reference/rpc/google.cloud.aiplatform.v1beta1#google.cloud.aiplatform.v1beta1.FeaturestoreService.GetFeaturestore) or [ListFeaturestores](https://cloud.google.com/vertex-ai/docs/reference/rpc/google.cloud.aiplatform.v1beta1#google.cloud.aiplatform.v1beta1.FeaturestoreService.ListFeaturestores) to check if the Featurestore was successfully created. The following example gets the details of the Featurestore.\n"
"You can use [GetFeaturestore](https://cloud.google.com/vertex-ai/docs/reference/rpc/google.cloud.aiplatform.v1#google.cloud.aiplatform.v1.FeaturestoreService.GetFeaturestore) or [ListFeaturestores](https://cloud.google.com/vertex-ai/docs/reference/rpc/google.cloud.aiplatform.v1#google.cloud.aiplatform.v1.FeaturestoreService.ListFeaturestores) to check if the Featurestore was successfully created. The following example gets the details of the Featurestore.\n"
]
},
{
@@ -590,6 +613,41 @@
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "018ab19d934f"
},
"source": [
"Auto scaling is available in v1 since v1.11. Below is the example for the `CreateFeaturestoreRequest` with auto-scaling, use it with `aiplatform_v1.FeaturestoreServiceClient` to create Featurestore:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "aea39718b5d3"
},
"outputs": [],
"source": [
"from google.cloud.aiplatform_v1.types import \\\n",
" featurestore as v1_featurestore_pb2\n",
"from google.cloud.aiplatform_v1.types import \\\n",
" featurestore_service as v1_featurestore_service_pb2\n",
"\n",
"create_featurestore_request = v1_featurestore_service_pb2.CreateFeaturestoreRequest(\n",
" parent=BASE_RESOURCE_PATH,\n",
" featurestore_id=FEATURESTORE_ID,\n",
" featurestore=v1_featurestore_pb2.Featurestore(\n",
" online_serving_config=v1_featurestore_pb2.Featurestore.OnlineServingConfig(\n",
" scaling=v1_featurestore_pb2.Featurestore.OnlineServingConfig.Scaling(\n",
" min_node_count=1, max_node_count=5\n",
" )\n",
" ),\n",
" ),\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -607,18 +665,20 @@
},
"outputs": [],
"source": [
"users_entity_type_lro = admin_client.create_entity_type(\n",
" featurestore_service_pb2.CreateEntityTypeRequest(\n",
" parent=admin_client.featurestore_path(PROJECT_ID, REGION, FEATURESTORE_ID),\n",
" entity_type_id=\"users\",\n",
" entity_type=entity_type_pb2.EntityType(\n",
" description=\"Users entity\",\n",
" ),\n",
"try:\n",
" users_entity_type_lro = admin_client.create_entity_type(\n",
" featurestore_service_pb2.CreateEntityTypeRequest(\n",
" parent=admin_client.featurestore_path(PROJECT_ID, REGION, FEATURESTORE_ID),\n",
" entity_type_id=\"users\",\n",
" entity_type=entity_type_pb2.EntityType(\n",
" description=\"Users entity\",\n",
" ),\n",
" )\n",
" )\n",
")\n",
"\n",
"# Similarly, wait for EntityType creation operation.\n",
"print(users_entity_type_lro.result())"
" # Similarly, wait for EntityType creation operation.\n",
" print(users_entity_type_lro.result())\n",
"except Exception as e:\n",
" print(e)"
]
},
{
@@ -630,16 +690,73 @@
"outputs": [],
"source": [
"# Create movies entity type without a monitoring configuration.\n",
"movies_entity_type_lro = admin_client.create_entity_type(\n",
" featurestore_service_pb2.CreateEntityTypeRequest(\n",
" parent=admin_client.featurestore_path(PROJECT_ID, REGION, FEATURESTORE_ID),\n",
" entity_type_id=\"movies\",\n",
" entity_type=entity_type_pb2.EntityType(description=\"Movies entity\"),\n",
"try:\n",
" movies_entity_type_lro = admin_client.create_entity_type(\n",
" featurestore_service_pb2.CreateEntityTypeRequest(\n",
" parent=admin_client.featurestore_path(PROJECT_ID, REGION, FEATURESTORE_ID),\n",
" entity_type_id=\"movies\",\n",
" entity_type=entity_type_pb2.EntityType(description=\"Movies entity\"),\n",
" )\n",
" )\n",
"\n",
" # Similarly, wait for EntityType creation operation.\n",
" print(movies_entity_type_lro.result())\n",
"except Exception as e:\n",
" print(e)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "dPkT7KDuEvWv"
},
"source": [
"Feature [monitoring](https://cloud.google.com/vertex-ai/docs/featurestore/monitoring) is in preview, so you need to use v1 Python. Import feature analysis is only available through SDK for now."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "9kiqrBN6E28r"
},
"outputs": [],
"source": [
"from google.cloud.aiplatform_v1 import \\\n",
" FeaturestoreServiceClient as v1_FeaturestoreServiceClient\n",
"from google.cloud.aiplatform_v1.types import entity_type as v1_entity_type_pb2\n",
"from google.cloud.aiplatform_v1.types import \\\n",
" featurestore_monitoring as v1_featurestore_monitoring_pb2\n",
"from google.cloud.aiplatform_v1.types import \\\n",
" featurestore_service as v1_featurestore_service_pb2\n",
"\n",
"v1_admin_client = v1_FeaturestoreServiceClient(\n",
" client_options={\"api_endpoint\": API_ENDPOINT}\n",
")\n",
"\n",
"# Similarly, wait for EntityType creation operation.\n",
"print(movies_entity_type_lro.result())"
"# Enable import feature analysis for users entity type.\n",
"# All Features belonging to this EntityType will by default inherit the monitoring config.\n",
"v1_admin_client.update_entity_type(\n",
" v1_featurestore_service_pb2.UpdateEntityTypeRequest(\n",
" entity_type=v1_entity_type_pb2.EntityType(\n",
" name=admin_client.entity_type_path(\n",
" PROJECT_ID, REGION, FEATURESTORE_ID, \"users\"\n",
" ),\n",
" monitoring_config=v1_featurestore_monitoring_pb2.FeaturestoreMonitoringConfig(\n",
" import_features_analysis=v1_featurestore_monitoring_pb2.FeaturestoreMonitoringConfig.ImportFeaturesAnalysis(\n",
" anomaly_detection_baseline=v1_featurestore_monitoring_pb2.FeaturestoreMonitoringConfig.ImportFeaturesAnalysis.Baseline.LATEST_STATS,\n",
" state=v1_featurestore_monitoring_pb2.FeaturestoreMonitoringConfig.ImportFeaturesAnalysis.State.ENABLED,\n",
" ),\n",
" numerical_threshold_config=v1_featurestore_monitoring_pb2.FeaturestoreMonitoringConfig.ThresholdConfig(\n",
" value=0.001,\n",
" ),\n",
" categorical_threshold_config=v1_featurestore_monitoring_pb2.FeaturestoreMonitoringConfig.ThresholdConfig(\n",
" value=0.001,\n",
" ),\n",
" ),\n",
" ),\n",
" )\n",
")"
]
},
{
@@ -648,7 +765,9 @@
"id": "85b1f59fbf6d"
},
"source": [
"Feature [monitoring](https://cloud.google.com/vertex-ai/docs/featurestore/monitoring) is in preview, so you need to use v1beta1 Python. The easiest way to set this for now is using [console UI](https://console.cloud.google.com/vertex-ai/features). For completeness, below is example to do this using v1beta1 SDK\n"
"The easiest way to set up snapshot analysis for now is using [console UI](https://console.cloud.google.com/vertex-ai/features). For completeness, below is example to do this using v1 SDK.\n",
"\n",
"You can view monitoring statistics on [console UI](https://console.cloud.google.com/vertex-ai/features)."
]
},
{
@@ -659,30 +778,36 @@
},
"outputs": [],
"source": [
"from google.cloud.aiplatform_v1beta1 import \\\n",
" FeaturestoreServiceClient as v1beta1_FeaturestoreServiceClient\n",
"from google.cloud.aiplatform_v1beta1.types import \\\n",
" entity_type as v1beta1_entity_type_pb2\n",
"from google.cloud.aiplatform_v1beta1.types import \\\n",
" featurestore_monitoring as v1beta1_featurestore_monitoring_pb2\n",
"from google.cloud.aiplatform_v1beta1.types import \\\n",
" featurestore_service as v1beta1_featurestore_service_pb2\n",
"from google.cloud.aiplatform_v1 import \\\n",
" FeaturestoreServiceClient as v1_FeaturestoreServiceClient\n",
"from google.cloud.aiplatform_v1.types import entity_type as v1_entity_type_pb2\n",
"from google.cloud.aiplatform_v1.types import \\\n",
" featurestore_monitoring as v1_featurestore_monitoring_pb2\n",
"from google.cloud.aiplatform_v1.types import \\\n",
" featurestore_service as v1_featurestore_service_pb2\n",
"\n",
"v1beta1_admin_client = v1beta1_FeaturestoreServiceClient(\n",
"v1_admin_client = v1_FeaturestoreServiceClient(\n",
" client_options={\"api_endpoint\": API_ENDPOINT}\n",
")\n",
"\n",
"# Enable monitoring for users entity type.\n",
"# Enable snapshot analysis for users entity type.\n",
"# All Features belonging to this EntityType will by default inherit the monitoring config.\n",
"v1beta1_admin_client.update_entity_type(\n",
" v1beta1_featurestore_service_pb2.UpdateEntityTypeRequest(\n",
" entity_type=v1beta1_entity_type_pb2.EntityType(\n",
"v1_admin_client.update_entity_type(\n",
" v1_featurestore_service_pb2.UpdateEntityTypeRequest(\n",
" entity_type=v1_entity_type_pb2.EntityType(\n",
" name=admin_client.entity_type_path(\n",
" PROJECT_ID, REGION, FEATURESTORE_ID, \"users\"\n",
" ),\n",
" monitoring_config=v1beta1_featurestore_monitoring_pb2.FeaturestoreMonitoringConfig(\n",
" snapshot_analysis=v1beta1_featurestore_monitoring_pb2.FeaturestoreMonitoringConfig.SnapshotAnalysis(\n",
" monitoring_interval=Duration(seconds=86400), # 1 day\n",
" monitoring_config=v1_featurestore_monitoring_pb2.FeaturestoreMonitoringConfig(\n",
" snapshot_analysis=v1_featurestore_monitoring_pb2.FeaturestoreMonitoringConfig.SnapshotAnalysis(\n",
" monitoring_interval_days=1, # 1 day\n",
" staleness_days=30,\n",
" ),\n",
" numerical_threshold_config=v1_featurestore_monitoring_pb2.FeaturestoreMonitoringConfig.ThresholdConfig(\n",
" value=0.001,\n",
" ),\n",
" categorical_threshold_config=v1_featurestore_monitoring_pb2.FeaturestoreMonitoringConfig.ThresholdConfig(\n",
" value=0.001,\n",
" ),\n",
" ),\n",
" ),\n",
@@ -708,32 +833,40 @@
"outputs": [],
"source": [
"# Create features for the 'users' entity.\n",
"admin_client.batch_create_features(\n",
" parent=admin_client.entity_type_path(PROJECT_ID, REGION, FEATURESTORE_ID, \"users\"),\n",
" requests=[\n",
" featurestore_service_pb2.CreateFeatureRequest(\n",
" feature=feature_pb2.Feature(\n",
" value_type=feature_pb2.Feature.ValueType.INT64,\n",
" description=\"User age\",\n",
" ),\n",
" feature_id=\"age\",\n",
"try:\n",
" admin_client.batch_create_features(\n",
" parent=admin_client.entity_type_path(\n",
" PROJECT_ID, REGION, FEATURESTORE_ID, \"users\"\n",
" ),\n",
" featurestore_service_pb2.CreateFeatureRequest(\n",
" feature=feature_pb2.Feature(\n",
" value_type=feature_pb2.Feature.ValueType.STRING,\n",
" description=\"User gender\",\n",
" requests=[\n",
" featurestore_service_pb2.CreateFeatureRequest(\n",
" feature=feature_pb2.Feature(\n",
" value_type=feature_pb2.Feature.ValueType.INT64,\n",
" description=\"User age\",\n",
" disable_monitoring=False,\n",
" ),\n",
" feature_id=\"age\",\n",
" ),\n",
" feature_id=\"gender\",\n",
" ),\n",
" featurestore_service_pb2.CreateFeatureRequest(\n",
" feature=feature_pb2.Feature(\n",
" value_type=feature_pb2.Feature.ValueType.STRING_ARRAY,\n",
" description=\"An array of genres that this user liked\",\n",
" featurestore_service_pb2.CreateFeatureRequest(\n",
" feature=feature_pb2.Feature(\n",
" value_type=feature_pb2.Feature.ValueType.STRING,\n",
" description=\"User gender\",\n",
" # Default is False. If True, Feature 'gender' monitoring analysis is disabled.\n",
" disable_monitoring=True,\n",
" ),\n",
" feature_id=\"gender\",\n",
" ),\n",
" feature_id=\"liked_genres\",\n",
" ),\n",
" ],\n",
").result()"
" featurestore_service_pb2.CreateFeatureRequest(\n",
" feature=feature_pb2.Feature(\n",
" value_type=feature_pb2.Feature.ValueType.STRING_ARRAY,\n",
" description=\"An array of genres that this user liked\",\n",
" ),\n",
" feature_id=\"liked_genres\",\n",
" ),\n",
" ],\n",
" ).result()\n",
"except Exception as e:\n",
" print(e)"
]
},
{
@@ -745,33 +878,37 @@
"outputs": [],
"source": [
"# Create features for movies type.\n",
"# 'title' Feature enables monitoring.\n",
"admin_client.batch_create_features(\n",
" parent=admin_client.entity_type_path(PROJECT_ID, REGION, FEATURESTORE_ID, \"movies\"),\n",
" requests=[\n",
" featurestore_service_pb2.CreateFeatureRequest(\n",
" feature=feature_pb2.Feature(\n",
" value_type=feature_pb2.Feature.ValueType.STRING,\n",
" description=\"The title of the movie\",\n",
" ),\n",
" feature_id=\"title\",\n",
"try:\n",
" admin_client.batch_create_features(\n",
" parent=admin_client.entity_type_path(\n",
" PROJECT_ID, REGION, FEATURESTORE_ID, \"movies\"\n",
" ),\n",
" featurestore_service_pb2.CreateFeatureRequest(\n",
" feature=feature_pb2.Feature(\n",
" value_type=feature_pb2.Feature.ValueType.STRING,\n",
" description=\"The genres of the movie\",\n",
" requests=[\n",
" featurestore_service_pb2.CreateFeatureRequest(\n",
" feature=feature_pb2.Feature(\n",
" value_type=feature_pb2.Feature.ValueType.STRING,\n",
" description=\"The title of the movie\",\n",
" ),\n",
" feature_id=\"title\",\n",
" ),\n",
" feature_id=\"genres\",\n",
" ),\n",
" featurestore_service_pb2.CreateFeatureRequest(\n",
" feature=feature_pb2.Feature(\n",
" value_type=feature_pb2.Feature.ValueType.DOUBLE,\n",
" description=\"The average rating for the movie, range is [1.0-5.0]\",\n",
" featurestore_service_pb2.CreateFeatureRequest(\n",
" feature=feature_pb2.Feature(\n",
" value_type=feature_pb2.Feature.ValueType.STRING,\n",
" description=\"The genres of the movie\",\n",
" ),\n",
" feature_id=\"genres\",\n",
" ),\n",
" feature_id=\"average_rating\",\n",
" ),\n",
" ],\n",
").result()"
" featurestore_service_pb2.CreateFeatureRequest(\n",
" feature=feature_pb2.Feature(\n",
" value_type=feature_pb2.Feature.ValueType.DOUBLE,\n",
" description=\"The average rating for the movie, range is [1.0-5.0]\",\n",
" ),\n",
" feature_id=\"average_rating\",\n",
" ),\n",
" ],\n",
" ).result()\n",
"except Exception as e:\n",
" print(e)"
]
},
{
@@ -782,8 +919,8 @@
"source": [
"## Search created features\n",
"\n",
"While the [ListFeatures](https://cloud.google.com/vertex-ai/docs/reference/rpc/google.cloud.aiplatform.v1beta1#google.cloud.aiplatform.v1beta1.FeaturestoreService.ListFeatures) method allows you to easily view all features of a single\n",
"entity type, the [SearchFeatures](https://cloud.google.com/vertex-ai/docs/reference/rpc/google.cloud.aiplatform.v1beta1#google.cloud.aiplatform.v1beta1.FeaturestoreService.SearchFeatures) method searches across all featurestores\n",
"While the [ListFeatures](https://cloud.google.com/vertex-ai/docs/reference/rpc/google.cloud.aiplatform.v1#google.cloud.aiplatform.v1.FeaturestoreService.ListFeatures) method allows you to easily view all features of a single\n",
"entity type, the [SearchFeatures](https://cloud.google.com/vertex-ai/docs/reference/rpc/google.cloud.aiplatform.v1#google.cloud.aiplatform.v1.FeaturestoreService.SearchFeatures) method searches across all featurestores\n",
"and entity types in a given location (such as `us-central1`). This can help you discover features that were created by someone else.\n",
"\n",
"You can query based on feature properties including feature ID, entity type ID,\n",
@@ -985,6 +1122,8 @@
" ],\n",
" feature_time_field=\"update_time\",\n",
" worker_count=1,\n",
" # Default is False. If True, the import feature analysis won't happen for this specific operation.\n",
" disable_ingestion_analysis=False,\n",
")"
]
},
@@ -1095,7 +1234,7 @@
},
"source": [
"The\n",
"[Online Serving APIs](https://cloud.google.com/vertex-ai/docs/reference/rpc/google.cloud.aiplatform.v1beta1#featurestoreonlineservingservice)\n",
"[Online Serving APIs](https://cloud.google.com/vertex-ai/docs/reference/rpc/google.cloud.aiplatform.v1#featurestoreonlineservingservice)\n",
"lets you serve feature values for small batches of entities. It's designed for latency-sensitive service, such as online model prediction. For example, for a movie service, you might want to quickly shows movies that the current user would most likely watch by using online predictions."
]
},
@@ -1393,9 +1532,7 @@
],
"metadata": {
"colab": {
"collapsed_sections": [
"ze4-nDLfK4pw"
],
"collapsed_sections": [],
"name": "gapic-feature-store.ipynb",
"toc_visible": true
},
Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

File diff suppressed because it is too large Load Diff
@@ -180,7 +180,7 @@
},
"outputs": [],
"source": [
"! pip install {USER_FLAG} --upgrade git+https://github.com/googleapis/python-aiplatform.git@main"
"! pip install {USER_FLAG} --upgrade google-cloud-aiplatform"
]
},
{
File diff suppressed because it is too large Load Diff
@@ -1,823 +0,0 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "d1cc1c1fa076"
},
"source": [
"# Pricing Optimization \n",
"## Table of contents\n",
"* [Overview](#section-1)\n",
"* [Dataset](#section-2)\n",
"* [Objective](#section-3)\n",
"* [Costs](#section-4)\n",
"* [Create a BigQuery dataset](#section-5)\n",
"* [Load the dataset from Cloud Storage](#section-6)\n",
"* [Data analysis](#section-7)\n",
"* [Preprocess the data for training](#section-8)\n",
"* [Train the model using BigQuery ML](#section-9)\n",
"* [Generate forecasts from the model](#section-10)\n",
"* [Interpret the results to choose the best price](#section-11)\n",
"* [Clean up](#section-12)\n",
"\n",
"## Overview\n",
"<a name=\"section-1\"></a>\n",
"\n",
"This notebook demonstrates analysis of pricing optimization on [CDM Pricing Data](https://github.com/trifacta/trifacta-google-cloud/tree/main/design-pattern-pricing-optimization) and automating the workflow using Vertex AI Workbench managed notebooks.\n",
"\n",
"*Note: This notebook file was developed to run in a [Vertex AI Workbench managed notebooks](https://console.cloud.google.com/vertex-ai/workbench/list/managed) instance using the Python (Local) kernel. Some components of this notebook may not work in other notebook environments.*\n",
"\n",
"## Dataset\n",
"<a name=\"section-2\"></a>\n",
"\n",
"The dataset used in this notebook is a part of the [CDM Pricing dataset](https://github.com/trifacta/trifacta-google-cloud/blob/main/design-pattern-pricing-optimization/CDM_Pricing_large_table.csv), which consists of product sales information on specified dates.\n",
"\n",
"## Objective\n",
"<a name=\"section-3\"></a>\n",
"\n",
"The objective of this notebook is to build a pricing optimization model using Vertex AI. The following steps have been followed: \n",
"\n",
"- Load the required dataset from a Cloud Storage bucket.\n",
"- Analyze the fields present in the dataset.\n",
"- Process the data to build a model.\n",
"- Build a BigQuery ML forecast model on the processed data.\n",
"- Get forecasted values from the BigQuery ML model.\n",
"- Interpret the forecasts to identify the best prices.\n",
"- Clean up.\n",
"\n",
"## Costs\n",
"<a name=\"section-4\"></a>\n",
"\n",
"This tutorial uses the following billable components of Google Cloud:\n",
"\n",
"- Vertex AI\n",
"- BigQuery\n",
"- Cloud Storage\n",
"\n",
"\n",
"Learn about [Vertex AI\n",
"pricing](https://cloud.google.com/vertex-ai/pricing), [BigQuery pricing](https://cloud.google.com/bigquery/pricing) and [Cloud Storage\n",
"pricing](https://cloud.google.com/storage/pricing), and use the [Pricing\n",
"Calculator](https://cloud.google.com/products/calculator/)\n",
"to generate a cost estimate based on your projected usage.\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "5ed1f5e85640"
},
"source": [
"## Before you begin\n",
"\n",
"### Set your project ID\n",
"\n",
"**If you don't know your project ID**, you may be able to get your project ID using `gcloud`."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "c3f30148b66d"
},
"outputs": [],
"source": [
"import os\n",
"\n",
"PROJECT_ID = \"\"\n",
"\n",
"# Get your Google Cloud project ID from gcloud\n",
"if not os.getenv(\"IS_TESTING\"):\n",
" shell_output = !gcloud config list --format 'value(core.project)' 2>/dev/null\n",
" PROJECT_ID = shell_output[0]\n",
" print(\"Project ID: \", PROJECT_ID)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "750bf2883c2d"
},
"source": [
"Otherwise, set your project ID here."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "3c6db1ca88b9"
},
"outputs": [],
"source": [
"if PROJECT_ID == \"\" or PROJECT_ID is None:\n",
" PROJECT_ID = \"[your-project-id]\" # @param {type:\"string\"}"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "2a1c270c7d34"
},
"source": [
"### Import the required libraries and define constants\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "acc6fac1fa55"
},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"import pandas as pd\n",
"import seaborn as sns\n",
"from google.cloud import bigquery\n",
"from google.cloud.bigquery import Client"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "a06006dff8f9"
},
"outputs": [],
"source": [
"DATASET = \"[your-bigquery-dataset-id]\" # set the BigQuery dataset-id\n",
"TRAINING_DATA_TABLE = \"[your-bigquery-table-id-to-store-the-training-data]\" # set the BigQuery table-id to store the training data"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "016c3d47cc69"
},
"source": [
"## Create a BigQuery dataset\n",
"<a name=\"section-5\"></a>\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "12ccd8d7956e"
},
"source": [
"#@bigquery\n",
"-- create a dataset in BigQuery\n",
"\n",
"CREATE SCHEMA pricing_optimization\n",
"OPTIONS(\n",
" location=\"us\"\n",
" )"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "c106b978a79b"
},
"source": [
"## Load the dataset from Cloud Storage\n",
"<a name=\"section-6\"></a>\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "8aeae9da9796"
},
"outputs": [],
"source": [
"DATA_LOCATION = \"gs://cloud-samples-data/ai-platform-unified/datasets/tabular/cdm_pricing_large_table.csv\"\n",
"df = pd.read_csv(DATA_LOCATION)\n",
"print(df.shape)\n",
"df.head()"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "7b98d5f09842"
},
"source": [
"You will build a forecast model on this data and thus determine the best price for a product. For this type of model, you will not be using many fields: only the sales and price related ones. For the current execrcise, focus on the following fields:\n",
"\n",
"- `Product_ID`\n",
"- `Customer_Hierarchy`\n",
"- `Fiscal_Date`\n",
"- `List_Price_Converged`\n",
"- `Invoiced_quantity_in_Pieces`\n",
"- `Net_Sales`\n",
"\n",
"## Data Analysis\n",
"<a name=\"section-7\"></a>\n",
"\n",
"First, explore the data and distributions.\n",
"\n",
"Select the required columns from the dataframe."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "af4b41c5eb1f"
},
"outputs": [],
"source": [
"id_col = \"Product_ID\"\n",
"date_col = \"Fiscal_Date\"\n",
"categ_cols = [\"Customer_Hierarchy\"]\n",
"num_cols = [\"List_Price_Converged\", \"Invoiced_quantity_in_Pieces\", \"Net_Sales\"]\n",
"\n",
"df = df[[id_col, date_col] + categ_cols + num_cols].copy()\n",
"df.head()"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "3d780043ee5b"
},
"source": [
"Check the column types and null values in the dataframe."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "f54c445a1288"
},
"outputs": [],
"source": [
"df.info()"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "cd817b414c4d"
},
"source": [
"This data description reveals that there are no null values in the data. Also, the field `Fiscal_Date` which is a date field is loaded as an object type. \n",
"\n",
"Change the type of the date field to datetime."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "b160fac085c8"
},
"outputs": [],
"source": [
"df[\"Fiscal_Date\"] = pd.to_datetime(df[\"Fiscal_Date\"], infer_datetime_format=True)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "fb4778578064"
},
"source": [
"Plot the distributions for the categorical fields."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "dd0467cd57c3"
},
"outputs": [],
"source": [
"for i in categ_cols:\n",
" df[i].value_counts(normalize=True).plot(kind=\"bar\")\n",
" plt.title(i)\n",
" plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "145deed255e0"
},
"source": [
"Plot the distributions for the numerical fields."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "f934137c6d82"
},
"outputs": [],
"source": [
"for i in num_cols:\n",
" _, ax = plt.subplots(1, 2, figsize=(10, 4))\n",
" df[i].plot(kind=\"box\", ax=ax[0])\n",
" df[i].plot(kind=\"hist\", ax=ax[1])\n",
" ax[0].set_title(i + \"-Boxplot\")\n",
" ax[1].set_title(i + \"-Histogram\")\n",
" plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "f9b9c2e58380"
},
"source": [
"Check the maximum date and minimum date in Fiscal_Date column."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "2a10aa689f9d"
},
"outputs": [],
"source": [
"print(df[\"Fiscal_Date\"].max())\n",
"print(df[\"Fiscal_Date\"].min())"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "4834f63e2e59"
},
"source": [
"Check the product distribution across each category."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "4664877f5304"
},
"outputs": [],
"source": [
"grp_cols = [\"Customer_Hierarchy\", \"Product_ID\"]\n",
"grp_df = df[grp_cols].groupby(by=grp_cols).count().reset_index()\n",
"grp_df.groupby(\"Customer_Hierarchy\").nunique()"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "01ed02b9c8fd"
},
"source": [
"Check the percentage changes in the orders based on the percentage changes in the price."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "0b2c428cb135"
},
"outputs": [],
"source": [
"# aggregate the data\n",
"df_aggr = (\n",
" df.groupby([\"Product_ID\", \"List_Price_Converged\"])\n",
" .agg({\"Fiscal_Date\": min, \"Invoiced_quantity_in_Pieces\": sum, \"Net_Sales\": sum})\n",
" .reset_index()\n",
")\n",
"# rename the aggregated columns\n",
"df_aggr.rename(\n",
" columns={\n",
" \"Fiscal_Date\": \"First_price_date\",\n",
" \"Invoiced_quantity_in_Pieces\": \"Total_ordered_pieces\",\n",
" \"Net_Sales\": \"Total_net_sales\",\n",
" },\n",
" inplace=True,\n",
")\n",
"\n",
"# sort values chronologically\n",
"df_aggr.sort_values(by=[\"Product_ID\", \"First_price_date\"], inplace=True)\n",
"df_aggr.reset_index(drop=True, inplace=True)\n",
"\n",
"# add columns for previous values\n",
"df_aggr[\"Previous_List\"] = df_aggr.groupby([\"Product_ID\"])[\n",
" \"List_Price_Converged\"\n",
"].shift()\n",
"df_aggr[\"Previous_Total_ordered_pieces\"] = df_aggr.groupby([\"Product_ID\"])[\n",
" \"Total_ordered_pieces\"\n",
"].shift()\n",
"\n",
"# average price change across sku's\n",
"df_aggr[\"price_change_perc\"] = (\n",
" (df_aggr[\"List_Price_Converged\"] - df_aggr[\"Previous_List\"])\n",
" / df_aggr[\"Previous_List\"].fillna(0)\n",
" * 100\n",
")\n",
"df_aggr[\"order_change_perc\"] = (\n",
" (df_aggr[\"Total_ordered_pieces\"] - df_aggr[\"Previous_Total_ordered_pieces\"])\n",
" / df_aggr[\"Previous_Total_ordered_pieces\"].fillna(0)\n",
" * 100\n",
")\n",
"\n",
"# plot a scatterplot to visualize the changes\n",
"sns.scatterplot(\n",
" x=\"price_change_perc\",\n",
" y=\"order_change_perc\",\n",
" data=df_aggr,\n",
" hue=\"Product_ID\",\n",
" legend=False,\n",
")\n",
"plt.title(\"Percentage of change in price vs order\")\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "8259e916fe25"
},
"source": [
"For most of the products, the percentage change in orders are high where the percentage changes in the prices are low. This suggests that too much change in the prices can affect the number of orders. \n",
"\n",
"**Note**: There seem to be some outliers in the data as percentage changes greater than 800 are found. In the current exercise, do not take any manual measures to deal with outliers as you will create a BigQuery ML timeseries model that already deals with outliers.\n",
"\n",
"## Preprocess the data for training\n",
"<a name=\"section-8\"></a>\n",
"\n",
"Check which `Product_ID`'s have the maximum orders."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "f5cbc7709c6a"
},
"outputs": [],
"source": [
"df_orders = df.groupby([\"Product_ID\", \"Customer_Hierarchy\"], as_index=False)[\n",
" \"Invoiced_quantity_in_Pieces\"\n",
"].sum()\n",
"df_orders.loc[\n",
" df_orders.groupby(\"Customer_Hierarchy\")[\"Invoiced_quantity_in_Pieces\"].idxmax()\n",
"]"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "fd6d227e513e"
},
"source": [
"From the above result, you can infer the following:\n",
"\n",
"- Under the **Food** category, **SKU 62** has the maximum orders.\n",
"- Under the **Manufacturing** category, **SKU 17** has the maximum orders.\n",
"- Under the **Paper** category, **SKU 107** has the maximum orders.\n",
"- Under the **Publishing** category, **SKU 8** has the maximum orders.\n",
"- Under the **Utilities** category, **SKU 140** has the maximum orders.\n",
"\n",
"Given that there are too many ids and only a few records for most of them, consider only the above `Product_ID`s for which there are a maximum number of orders. \n",
"\n",
"**Note**: The `Invoiced_quantity_in_Pieces` field seems to be a *float* type rather than an *int* type as it should be. This could be because the data itself might be averaged in the first place."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "2dbc0d64d157"
},
"source": [
"Check the various prices available for these `Product_ID`s."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "acc1dbd2d838"
},
"outputs": [],
"source": [
"df_type_food = df[(df[\"Product_ID\"] == \"SKU 62\") & (df[\"Customer_Hierarchy\"] == \"Food\")]\n",
"print(\"Food :\")\n",
"print(df_type_food[\"List_Price_Converged\"].value_counts())\n",
"df_type_manuf = df[\n",
" (df[\"Product_ID\"] == \"SKU 17\") & (df[\"Customer_Hierarchy\"] == \"Manufacturing\")\n",
"]\n",
"print(\"Manufacturing :\")\n",
"print(df_type_manuf[\"List_Price_Converged\"].value_counts())\n",
"df_type_paper = df[\n",
" (df[\"Product_ID\"] == \"SKU 107\") & (df[\"Customer_Hierarchy\"] == \"Paper\")\n",
"]\n",
"print(\"Paper :\")\n",
"print(df_type_paper[\"List_Price_Converged\"].value_counts())\n",
"df_type_pub = df[\n",
" (df[\"Product_ID\"] == \"SKU 8\") & (df[\"Customer_Hierarchy\"] == \"Publishing\")\n",
"]\n",
"print(\"Publishing :\")\n",
"print(df_type_pub[\"List_Price_Converged\"].value_counts())\n",
"df_type_util = df[\n",
" (df[\"Product_ID\"] == \"SKU 140\") & (df[\"Customer_Hierarchy\"] == \"Utilities\")\n",
"]\n",
"print(\"Utilities :\")\n",
"print(df_type_util[\"List_Price_Converged\"].value_counts())"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "f023af578c0f"
},
"source": [
"In the publishing category, `Product_ID` `SKU 8` and `SKU 17` are less than or equal to two different prices in the entire data and so you will exclude them and consider the rest for building the forecast model. The idea here is to train a forecast model on the timeseries data for products with different prices.\n",
"\n",
"Join the data for all the `Product_ID`s into one dataframe and remove duplicate records."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "a44771cc4c20"
},
"outputs": [],
"source": [
"df_final = pd.concat([df_type_food, df_type_paper, df_type_util])\n",
"df_final = (\n",
" df_final[\n",
" [\n",
" \"Product_ID\",\n",
" \"Fiscal_Date\",\n",
" \"Customer_Hierarchy\",\n",
" \"List_Price_Converged\",\n",
" \"Invoiced_quantity_in_Pieces\",\n",
" ]\n",
" ]\n",
" .drop_duplicates()\n",
" .reset_index(drop=True)\n",
")\n",
"df_final.head()"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "add5063df368"
},
"source": [
"Save the data to a BigQuery table."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "fd82ba56571f"
},
"outputs": [],
"source": [
"bq_client = bigquery.Client(project=PROJECT_ID)\n",
"\n",
"job_config = bigquery.LoadJobConfig(\n",
" # Specify a (partial) schema. All columns are always written to the\n",
" # table. The schema is used to assist in data type definitions.\n",
" schema=[\n",
" bigquery.SchemaField(\"Product_ID\", bigquery.enums.SqlTypeNames.STRING),\n",
" bigquery.SchemaField(\"Fiscal_Date\", bigquery.enums.SqlTypeNames.DATE),\n",
" bigquery.SchemaField(\"List_Price_Converged\", bigquery.enums.SqlTypeNames.FLOAT),\n",
" bigquery.SchemaField(\n",
" \"Invoiced_quantity_in_Pieces\", bigquery.enums.SqlTypeNames.FLOAT\n",
" ),\n",
" ],\n",
" # Optionally, set the write disposition. BigQuery appends loaded rows\n",
" # to an existing table by default, but with WRITE_TRUNCATE write\n",
" # disposition it replaces the table with the loaded data.\n",
" write_disposition=\"WRITE_TRUNCATE\",\n",
")\n",
"\n",
"# save the dataframe to a table in the created dataset\n",
"job = bq_client.load_table_from_dataframe(\n",
" df_final,\n",
" \"{}.{}.{}\".format(PROJECT_ID, DATASET, TRAINING_DATA_TABLE),\n",
" job_config=job_config,\n",
") # Make an API request.\n",
"job.result() # Wait for the job to complete."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "fca77641b03b"
},
"source": [
"# Train the model using BigQuery ML\n",
"<a name=\"section-9\"></a>\n",
"\n",
"Train an [Arima-Plus](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-create-time-series) model on the data using BigQuery ML."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "cded27507891"
},
"source": [
"#@bigquery\n",
"create or replace model pricing_optimization.bqml_arima\n",
"options\n",
" (model_type = 'ARIMA_PLUS',\n",
" time_series_timestamp_col = 'Fiscal_Date',\n",
" time_series_data_col = 'Invoiced_quantity_in_Pieces',\n",
" time_series_id_col = 'ID'\n",
" ) as\n",
"select\n",
" Fiscal_Date,\n",
" Concat(Product_ID,\"_\" ,Cast(List_Price_Converged as string)) as ID,\n",
" Invoiced_quantity_in_Pieces\n",
"from\n",
" pricing_optimization.TRAINING_DATA\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "332fd11ff32b"
},
"source": [
"## Generate forecasts from the model\n",
"<a name=\"section-10\"></a>\n",
"\n",
"Predict the sales for the next 30 days for each id and save to a dataframe."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "ef926cdbf28e"
},
"outputs": [],
"source": [
"client = Client()\n",
"\n",
"query = '''\n",
"DECLARE HORIZON STRING DEFAULT \"30\"; #number of values to forecast\n",
"DECLARE CONFIDENCE_LEVEL STRING DEFAULT \"0.90\"; ## required confidence level\n",
"\n",
"EXECUTE IMMEDIATE format(\"\"\"\n",
" SELECT\n",
" *\n",
" FROM \n",
" ML.FORECAST(MODEL pricing_optimization.bqml_arima, \n",
" STRUCT(%s AS horizon, \n",
" %s AS confidence_level)\n",
" )\n",
" \"\"\",HORIZON,CONFIDENCE_LEVEL)'''\n",
"job = client.query(query)\n",
"dfforecast = job.to_dataframe()\n",
"dfforecast.head()"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "608c7de72dae"
},
"source": [
"## Interpret the results to choose the best price\n",
"<a name=\"section-11\"></a>\n",
"\n",
"Calculate average forecast values for the forecast duration."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "e1e193680400"
},
"outputs": [],
"source": [
"dfforecast_avg = (\n",
" dfforecast[[\"ID\", \"forecast_value\"]].groupby(\"ID\", as_index=False).mean()\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "5ce395d652a3"
},
"source": [
"Extract the ID and Price fields from the ID field."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "452c56fa58ed"
},
"outputs": [],
"source": [
"dfforecast_avg[\"Product_ID\"] = dfforecast_avg[\"ID\"].apply(lambda x: x.split(\"_\")[0])\n",
"dfforecast_avg[\"Price\"] = dfforecast_avg[\"ID\"].apply(lambda x: x.split(\"_\")[1])"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "3cee67f4028f"
},
"source": [
"Plot the average forecasted sales vs. the price of the product."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "fb351c8f383d"
},
"outputs": [],
"source": [
"for i in dfforecast_avg[\"Product_ID\"].unique():\n",
" dfforecast_avg[dfforecast_avg[\"Product_ID\"] == i].set_index(\"Price\").sort_values(\n",
" \"forecast_value\"\n",
" ).plot(kind=\"bar\")\n",
" plt.title(\"Price vs. Average Sales for \" + i)\n",
" plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "67ff3acc74a5"
},
"source": [
"Based on the plots for price vs. the average forecasted orders, it can be said that to use the maximum orders, each of the considered `Product_ID`s can follow the below prices:\n",
"\n",
"- SKU 107's price range can be from 4.44 - 4.73 units\n",
"- SKU 140's price can be 1.95 units\n",
"- SKU 62's price can be 4.23 units\n",
"\n",
"\n",
"## Clean Up\n",
"<a name=\"section-12\"></a>\n",
"\n",
"To clean up all Google Cloud resources used in this project, you can [delete the Google Cloud 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. The following code deletes the entire dataset."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "d78908b8134d"
},
"outputs": [],
"source": [
"# Construct a BigQuery client object.\n",
"client = bigquery.Client()\n",
"\n",
"# TODO(developer): Set model_id to the ID of the model to fetch.\n",
"dataset_id = \"{PROJECT}.{DATASET}\".format(PROJECT=PROJECT_ID, DATASET=DATASET)\n",
"\n",
"# Use the delete_contents parameter to delete a dataset and its contents.\n",
"# Use the not_found_ok parameter to not receive an error if the dataset has already been deleted.\n",
"client.delete_dataset(\n",
" dataset_id, delete_contents=True, not_found_ok=True\n",
") # Make an API request.\n",
"\n",
"print(\"Deleted dataset '{}'.\".format(dataset_id))"
]
}
],
"metadata": {
"colab": {
"name": "pricing-optimization.ipynb",
"toc_visible": true
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -12,7 +12,7 @@ The purpose of this set of notebooks and markdown files is to demonstrate Google
2. [Experimentation](stage2)
3. [Formalization](stage3)
4. [Evaluation](stage4)
5. Deployment
6. Serving
7. Monitoring
5. [Deployment](stage5)
6. [Serving](stage6)
7. Monitoring(stage7)
8. Continuous Training
+43
View File
@@ -0,0 +1,43 @@
## Before you begin
### Set up your Google Cloud project
**The following steps are required, regardless of your notebook environment.**
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.
1. [Make sure that billing is enabled for your project](https://cloud.google.com/billing/docs/how-to/modify-project).
1. [Enable the Vertex AI, BigQuery, Compute Engine and Cloud Storage APIs](https://console.cloud.google.com/flows/enableapi?apiid=aiplatform.googleapis.com,bigquery,compute_component,storage_component).
1. If you are running this notebook locally, you need to install the [Cloud SDK](https://cloud.google.com/sdk).
1. Enter your project ID in the cell below. Then run the cell to make sure the
Cloud SDK uses the right project for all the commands in this notebook.
**Note**: Jupyter runs lines prefixed with `!` as shell commands, and it interpolates Python variables prefixed with `$` into these commands.
### Set up your local development environment
**If you are using Colab or Vertex AI Workbench Notebooks**, your environment already meets all the requirements to run this notebook. You can skip this step.
**Otherwise**, make sure your environment meets this notebook's requirements. You need the following:
- The Cloud Storage SDK
- Python 3
- virtualenv
- Jupyter notebook running in a virtual environment with Python 3
The Cloud Storage guide to [Setting up a Python development environment](https://cloud.google.com/python/setup) and the [Jupyter installation guide](https://jupyter.org/install) provide detailed instructions for meeting these requirements. The following steps provide a condensed set of instructions:
1. [Install and initialize the SDK](https://cloud.google.com/sdk/docs/).
2. [Install Python 3](https://cloud.google.com/python/setup#installing_python).
3. [Install virtualenv](https://cloud.google.com/python/setup#installing_and_using_virtualenv) and create a virtual environment that uses Python 3. Activate the virtual environment.
4. To install Jupyter, run `pip3 install jupyter` on the command-line in a terminal shell.
5. To launch Jupyter, run `jupyter notebook` on the command-line in a terminal shell.
6. Open this notebook in the Jupyter Notebook Dashboard.
+112
View File
@@ -0,0 +1,112 @@
import os
import sys
import argparse
import subprocess
import random
import string
parser = argparse.ArgumentParser()
parser.add_argument('--bucket', dest='bucket_required', action='store_true',
default=False, help='Bucket required')
parser.add_argument('--email', dest='email_required', action='store_true',
default=False, help='Email required')
parser.add_argument('--sa', dest='sa_required', action='store_true',
default=False, help='Service account required')
parser.add_argument('--packages', dest='extra_packages',
default='', type=str, help='additional required packages')
args = parser.parse_args()
extra_pkgs = args.extra_packages
# Installation
# The Vertex AI Workbench Notebook product has specific requirements
IS_WORKBENCH_NOTEBOOK = os.getenv("DL_ANACONDA_HOME")
IS_USER_MANAGED_WORKBENCH_NOTEBOOK = os.path.exists(
"/opt/deeplearning/metadata/env_version"
)
IS_COLAB = "google.colab" in sys.modules
# Vertex AI Notebook requires dependencies to be installed with '--user'
USER_FLAG = ""
if IS_WORKBENCH_NOTEBOOK:
USER_FLAG = "--user"
# not used
'''
print("Installing packages")
os.system(f"pip3 install --upgrade --quiet {USER_FLAG} google-cloud-aiplatform {args.extra_packages}")
print("Done installation")
'''
# Authenticate
if IS_COLAB:
from google.colab import auth as google_auth
google_auth.authenticate_user()
# project ID
if IS_WORKBENCH_NOTEBOOK:
shell_output = subprocess.check_output("gcloud config list --format 'value(core.project)' 2>/dev/null", shell=True)
PROJECT_ID = shell_output[0:-1].decode('utf-8')
print("PROJECT ID: ", PROJECT_ID)
else:
PROJECT_ID = input("Enter PROJECT_ID: ")
os.system(f"gcloud config set project {PROJECT_ID}")
# email
if args.email_required:
shell_output = subprocess.check_output("gcloud config list --format 'value(core.account)' 2>/dev/null", shell=True)
EMAIL_ADDR = shell_output[0:-1].decode('utf-8')
if EMAIL_ADDR == '':
EMAIL_ADDR = input("Enter Email Address: ")
print("EMAIL_ADDR: ", EMAIL_ADDR)
# region
shell_output = subprocess.check_output("gcloud config list --format 'value(ai.region)'", shell=True)
REGION = shell_output[0:-1].decode('utf-8')
if REGION == '':
REGION = input("Enter REGION: ")
print("REGION: ", REGION)
# multi-region
MULTI_REGION = REGION.split('-')[0]
# UUID
# Generate a uuid of a specifed length(default=8)
def generate_uuid(length: int = 8) -> str:
return "".join(random.choices(string.ascii_lowercase + string.digits, k=length))
UUID = generate_uuid()
print("UUID", UUID)
# Bucket
if args.bucket_required:
BUCKET_NAME = PROJECT_ID + "aip-" + UUID
BUCKET_URI = f"gs://{BUCKET_NAME}"
os.system(f"gsutil mb -l {REGION} {BUCKET_URI}")
print("BUCKET_URI", BUCKET_URI)
# Project Number
if args.sa_required:
if IS_WORKBENCH_NOTEBOOK:
shell_output = subprocess.check_output("gcloud auth list 2>/dev/null", shell=True)
SERVICE_ACCOUNT = shell_output[:-1].decode('utf-8').split('\n')[2].strip()
PROJECT_NUMBER = SERVICE_ACCOUNT.split('-')[0]
else:
shell_output = subprocess.check_output(f"gcloud projects describe {PROJECT_ID}", shell=True)
try:
PROJECT_NUMBER = shell_output[:-1].decode('utf-8').split('\n')[7].split(':')[-1].strip().replace("'", "")
SERVICE_ACCOUNT = f"{PROJECT_NUMBER}-compute@developer.gserviceaccount.com"
except:
PROJECT_NUMBER = input("Enter project number: ")
SERVICE_ACCOUNT = f"{PROJECT_NUMBER}-compute@developer.gserviceaccount.com"
print("SERVICE_ACCOUNT", SERVICE_ACCOUNT)
print("PROJECT_NUMBER", PROJECT_NUMBER)
+52 -27
View File
@@ -22,31 +22,31 @@ The first stage in MLOps is the collection and preparation for the purpose of de
- Data is preprocessed for training and evaluation using Dataflow.
- Data augmentation is performed on-the-fly and is coupled with model feeding.
<img src='stage1.jpg'>
<img src='stage1v2.png'>
## Notebooks
### Get Started
[Get Started with BQ datasets](get_started_bq_datasets.ipynb)
[Get started with Dataflow](community/ml_ops/stage1/get_started_dataflow.ipynb)
In this tutorial, you learn how to use `Dataflow` for training with `Vertex AI`.
```
The steps performed include:
- Create a Vertex AI `Dataset` resource from `BigQuery` table -- compatible for `AutoML` training.
- Extract a copy of the dataset from `BigQuery` to a CSV file in Cloud Storage -- compatible for `AutoML` or custom training.
- Select rows from a `BigQuery` dataset into a `pandas` dataframe -- compatible for custom training.
- Select rows from a `BigQuery` dataset into a `tf.data.Dataset` -- compatible for custom training `TensorFlow` models.
- Select rows from extracted CSV files into a `tf.data.Dataset` -- compatible for custom training `TensorFlow` models.
- Create a `BigQuery` dataset from CSV files.
- Extract data from `BigQuery` table into a `DMatrix` -- compatible for custom training `XGBoost` models.
```
- Offline preprocessing of data:
- Serially - w/o dataflow
- Parallel - with dataflow
- Upstream preprocessing of data:
- tabular data
- image data
[Get Started with Vertex datasets](get_started_vertex_datasets.ipynb)
[Get started with Vertex AI datasets](community/ml_ops/stage1/get_started_vertex_datasets.ipynb)
In this tutorial, you learn how to use `Vertex AI Dataset` for training with `Vertex AI`.
```
The steps performed include:
- Create a Vertex AI `Dataset` resource for:
- image data
- text data
@@ -61,28 +61,54 @@ The steps performed include:
- Detect anomalies in new data using TensorFlow Data Validation.
- Generate a TFRecord feature specification using TensorFlow Transform from the data schema.
- Export a dataset and convert to TFRecords.
```
[Get Started with Dataflow](get_started_dataflow.ipynb)
[Get started with BigQuery datasets](community/ml_ops/stage1/get_started_bq_datasets.ipynb)
In this tutorial, you learn how to use `BigQuery` as a dataset for training with `Vertex AI`.
```
The steps performed include:
- Offline preprocessing of data:
- Serially - w/o dataflow
- Parallel - with dataflow
- Upstream preprocessing of data:
- tabular data
- image data
```
- Create a Vertex AI `Dataset` resource from `BigQuery` table -- compatible for `AutoML` training.
- Extract a copy of the dataset from `BigQuery` to a CSV file in Cloud Storage -- compatible for `AutoML` or custom training.
- Select rows from a `BigQuery` dataset into a `pandas` dataframe -- compatible for custom training.
- Select rows from a `BigQuery` dataset into a `tf.data.Dataset` -- compatible for custom training `TensorFlow` models.
- Select rows from extracted CSV files into a `tf.data.Dataset` -- compatible for custom training `TensorFlow` models.
- Create a `BigQuery` dataset from CSV files.
- Extract data from `BigQuery` table into a `DMatrix` -- compatible for custom training `XGBoost` models.
[Get started with Vertex AI Data Labeling](community/ml_ops/stage1/get_started_with_data_labeling.ipynb)
In this tutorial, you learn how to use the `Vertex AI Data Labeling` service.
The steps performed include:
- Create a Specialist Pool for data labelers.
- Create a data labeling job.
- Submit the data labeling job.
- List data labeling jobs.
- Cancel a data labeling job.
[Create an unlabelled Vertex AI AutoML text entity extraction dataset from PDFs using Vision API](community/ml_ops/stage1/get_started_with_visionapi_and_vertex_datasets.ipynb)
In this tutorial, you learn to use `Vision API` to extract text from PDF files stored on a Cloud Storage bucket. You then process the results and create an unlabelled `Vertex AI Dataset`, compatible with `AutoML`, for text entity extraction.
The steps performed include:
1. Using `Vision API` to perform Optical Character Recognition (OCR) to extract text from PDF files.
2. Processing the results and saving them to text files.
3. Generating a `Vertex AI Dataset` import file.
4. Creating a new unlabelled text entity extraction `Vertex AI Dataset` resource in `Vertex AI`.
### E2E Stage Example
[Stage 1: Data Management](mlops_data_management.ipynb)
```
The steps performed include:
- Explore and visualize the data.
- Create a Vertex AI `Dataset` resource from `BigQuery` table -- for AutoML training.
- Extract a copy of the dataset to a CSV file in Cloud Storage.
@@ -92,4 +118,3 @@ The steps performed include:
- Generate a TFRecord feature specification using TensorFlow Data Validation from the data schema.
- Preprocess a portion of the BigQuery data using `Dataflow` -- for custom training.
```
@@ -8,7 +8,7 @@
},
"outputs": [],
"source": [
"# Copyright 2021 Google LLC\n",
"# Copyright 2022 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",
@@ -34,13 +34,18 @@
"<table align=\"left\">\n",
" <td>\n",
" <a href=\"https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/ml_ops/stage1/get_started_bq_datasets.ipynb\">\n",
" <img src=\"https://cloud.google.com/ml-engine/images/github-logo-32px.png\" alt=\"GitHub logo\">\n",
" <img src=\"https://cloud.google.com/ml-engine/images/colab-logo-32px.png\" alt=\"GitHub logo\">\n",
" View on GitHub\n",
" </a>\n",
" <td>\n",
" <a href=\"https://colab.research.google.com/github/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/ml_ops/stage1/get_started_bq_datasets.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://console.cloud.google.com/ai/platform/notebooks/deploy-notebook?download_url=https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/ml_ops/stage1/get_started_bq_datasets.ipynb\">\n",
" Open in Google Cloud Notebooks\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/community/ml_ops/stage1/get_started_bq_datasets.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>\n",
@@ -59,17 +64,6 @@
"This tutorial demonstrates how to use Vertex AI for E2E MLOps on Google Cloud in production. This tutorial covers stage 1 : data management: get started with BigQuery datasets."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "dataset:gsod,lrg"
},
"source": [
"### Dataset\n",
"\n",
"The dataset used for this tutorial is the GSOD dataset from [BigQuery public datasets](https://cloud.google.com/bigquery/public-data). The version of the dataset you use only the fields year, month and day to predict the value of mean daily temperature (mean_temp)."
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -104,7 +98,7 @@
"source": [
"### Recommendations\n",
"\n",
"When doing E2E MLOps on Google Cloud, the following best practices with structured (tabular) data in BigQuery:\n",
"When doing E2E MLOps on Google Cloud, following are the best practices when dealing with structured (tabular) data in BigQuery:\n",
"\n",
"- For AutoML training:\n",
" - Create a managed dataset with Vertex AI `TabularDataset`.\n",
@@ -124,20 +118,47 @@
" - Within the generator (upstream)\n",
" - Within the model (downstream)\n",
" - XGBoost model training:\n",
" - Use BigQuery ML builtin XGBoost training.\n",
" - Use BigQuery ML built-in XGBoost training.\n",
" - Alternatively, create a DMatrix generator from CSV files extracted from BigQuery table.\n",
" - Pytorch model training:\n",
" - PyTorch model training:\n",
" - Extract the BigQuery to a pandas dataframe.\n",
" - Preprocess the data in the dataframe.\n",
" - Create a DataLoader generator from the pandas dataframe.\n",
"\n",
"\n",
"- Alternately:\n",
"- Alternatively:\n",
" - Extract the BigQuery table to CSV files.\n",
" - Preprocess the CSV files.\n",
" - Create a tf.data.Dataset generator from the CSV files."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "dataset:gsod,lrg"
},
"source": [
"### Dataset\n",
"\n",
"The dataset used for this tutorial is the GSOD dataset from [BigQuery public datasets](https://cloud.google.com/bigquery/public-data). In this version of the dataset you consider the fields year, month and day to predict the value of mean daily temperature (mean_temp)."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "9e483012a752"
},
"source": [
"### Costs\n",
"This tutorial uses billable components of Google Cloud:\n",
"\n",
"- Vertex AI\n",
"- Cloud Storage\n",
"- BigQuery\n",
"\n",
"Learn about [Vertex AI pricing](https://cloud.google.com/vertex-ai/pricing), [Cloud Storage pricing](https://cloud.google.com/storage/pricing) and [BigQuery pricing](https://cloud.google.com/bigquery/pricing) and use the [Pricing Calculator](https://cloud.google.com/products/calculator/) to generate a cost estimate based on your projected usage."
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -146,7 +167,7 @@
"source": [
"## Installations\n",
"\n",
"Install *one time* the packages for executing the MLOps notebooks."
"Install the following packages to execute this notebook."
]
},
{
@@ -157,40 +178,21 @@
},
"outputs": [],
"source": [
"ONCE_ONLY = False\n",
"if ONCE_ONLY:\n",
" ! pip3 install -U tensorflow==2.5 $USER_FLAG\n",
" ! pip3 install -U tensorflow-data-validation==1.2 $USER_FLAG\n",
" ! pip3 install -U tensorflow-transform==1.2 $USER_FLAG\n",
" ! pip3 install -U tensorflow-io==0.18 $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-aiplatform[tensorboard] $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-pipeline-components $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-bigquery $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-logging $USER_FLAG\n",
" ! pip3 install --upgrade apache-beam[gcp] $USER_FLAG\n",
" ! pip3 install --upgrade pyarrow $USER_FLAG\n",
" ! pip3 install --upgrade cloudml-hypertune $USER_FLAG\n",
" ! pip3 install --upgrade kfp $USER_FLAG"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "install_xgboost"
},
"source": [
"Install the latest GA version of *XGBoost* library as well."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "install_xgboost"
},
"outputs": [],
"source": [
"! pip3 install -U xgboost $USER_FLAG"
"import os\n",
"\n",
"# The Vertex AI Workbench Notebook product has specific requirements\n",
"IS_WORKBENCH_NOTEBOOK = os.getenv(\"DL_ANACONDA_HOME\") and not os.getenv(\"VIRTUAL_ENV\")\n",
"IS_USER_MANAGED_WORKBENCH_NOTEBOOK = os.path.exists(\n",
" \"/opt/deeplearning/metadata/env_version\"\n",
")\n",
"\n",
"# Vertex AI Notebook requires dependencies to be installed with '--user'\n",
"USER_FLAG = \"\"\n",
"if IS_WORKBENCH_NOTEBOOK:\n",
" USER_FLAG = \"--user\"\n",
"\n",
"extra_pkgs = \"tensorflow tensorflow-io==0.18 pyarrow xgboost google-cloud-bigquery\"\n",
"! pip3 install --upgrade --quiet {USER_FLAG} google-cloud-aiplatform $extra_pkgs"
]
},
{
@@ -212,9 +214,9 @@
},
"outputs": [],
"source": [
"import os\n",
"import sys\n",
"\n",
"if not os.getenv(\"IS_TESTING\"):\n",
"if \"google.colab\" in sys.modules:\n",
" # Automatically restart kernel after installs\n",
" import IPython\n",
"\n",
@@ -225,187 +227,42 @@
{
"cell_type": "markdown",
"metadata": {
"id": "project_id"
"id": "fc8fb52b5cca"
},
"source": [
"#### Set your project ID\n",
"### Common setup\n",
"\n",
"**If you don't know your project ID**, you may be able to get your project ID using `gcloud`."
"Now, execute the common setup for the notebook tutorials."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "set_project_id"
"id": "001a0fcd5d78"
},
"outputs": [],
"source": [
"PROJECT_ID = \"[your-project-id]\" # @param {type:\"string\"}"
"# Common code setup for notebook tutorials\n",
"\n",
"! wget https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/main/notebooks/community/ml_ops/setup.py -O setup.py\n",
"\n",
"%run setup.py --bucket"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "autoset_project_id"
"id": "d809f07a8935"
},
"outputs": [],
"source": [
"if PROJECT_ID == \"\" or PROJECT_ID is None or PROJECT_ID == \"[your-project-id]\":\n",
" # Get your GCP project id from gcloud\n",
" shell_output = ! gcloud config list --format 'value(core.project)' 2>/dev/null\n",
" PROJECT_ID = shell_output[0]\n",
" print(\"Project ID:\", PROJECT_ID)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "set_gcloud_project_id"
},
"outputs": [],
"source": [
"! gcloud config set project $PROJECT_ID"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "region"
},
"source": [
"#### Region\n",
"# Other Common setup instructions for notebook tutorials\n",
"\n",
"You can also change the `REGION` variable, which is used for operations\n",
"throughout the rest of this notebook. Below are regions supported for Vertex AI. We recommend that you choose the region closest to you.\n",
"! wget https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/main/notebooks/community/ml_ops/setup.md -O setup.md\n",
"\n",
"- Americas: `us-central1`\n",
"- Europe: `europe-west4`\n",
"- Asia Pacific: `asia-east1`\n",
"\n",
"You may not use a multi-regional bucket for training with Vertex AI. Not all regions provide support for all Vertex AI services.\n",
"\n",
"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": "timestamp"
},
"source": [
"#### Timestamp\n",
"\n",
"If you are in a live tutorial session, you might be using a shared test account or project. To avoid name collisions between users on resources created, you create a timestamp for each instance session, and append the timestamp onto the name of resources you create in this tutorial."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "timestamp"
},
"outputs": [],
"source": [
"from datetime import datetime\n",
"\n",
"TIMESTAMP = datetime.now().strftime(\"%Y%m%d%H%M%S\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "bucket:custom"
},
"source": [
"### Create a Cloud Storage bucket\n",
"\n",
"**The following steps are required, regardless of your notebook environment.**\n",
"\n",
"When you submit a custom training job using the Vertex SDK, you upload a Python package\n",
"containing your training code to a Cloud Storage bucket. Vertex AI runs\n",
"the code from this package. In this tutorial, Vertex AI also saves the\n",
"trained model that results from your job in the same bucket. You can then\n",
"create an `Endpoint` resource based on this output in order to serve\n",
"online predictions.\n",
"\n",
"Set the name of your Cloud Storage bucket below. Bucket names must be globally unique across all Google Cloud projects, including those outside of your organization."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "bucket"
},
"outputs": [],
"source": [
"BUCKET_NAME = \"gs://[your-bucket-name]\" # @param {type:\"string\"}"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "autoset_bucket"
},
"outputs": [],
"source": [
"if BUCKET_NAME == \"\" or BUCKET_NAME is None or BUCKET_NAME == \"gs://[your-bucket-name]\":\n",
" BUCKET_NAME = \"gs://\" + PROJECT_ID + \"aip-\" + TIMESTAMP"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "create_bucket"
},
"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": "create_bucket"
},
"outputs": [],
"source": [
"! gsutil mb -l $REGION $BUCKET_NAME"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "validate_bucket"
},
"source": [
"Finally, validate access to your Cloud Storage bucket by examining its contents:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "validate_bucket"
},
"outputs": [],
"source": [
"! gsutil ls -al $BUCKET_NAME"
"%load setup.md"
]
},
{
@@ -414,9 +271,6 @@
"id": "setup_vars"
},
"source": [
"### Set up variables\n",
"\n",
"Next, set up some variables used throughout the tutorial.\n",
"### Import libraries and define constants"
]
},
@@ -428,75 +282,12 @@
},
"outputs": [],
"source": [
"import google.cloud.aiplatform as aip"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "import_bq"
},
"source": [
"#### Import BigQuery\n",
"\n",
"Import the BigQuery package into your Python environment."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "import_bq"
},
"outputs": [],
"source": [
"import google.cloud.aiplatform as aiplatform\n",
"import pandas as pd\n",
"import xgboost as xgb\n",
"from google.cloud import bigquery"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "import_xgboost"
},
"source": [
"#### Import XGBoost\n",
"\n",
"Import the XGBoost package into your Python environment."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "import_xgboost"
},
"outputs": [],
"source": [
"import xgboost as xgb"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "import_pandas"
},
"source": [
"#### Import pandas\n",
"\n",
"Import the pandas package into your Python environment."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "import_pandas"
},
"outputs": [],
"source": [
"import pandas as pd"
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -516,7 +307,7 @@
},
"outputs": [],
"source": [
"aip.init(project=PROJECT_ID, location=REGION)"
"aiplatform.init(project=PROJECT_ID, location=REGION)"
]
},
{
@@ -538,7 +329,7 @@
},
"outputs": [],
"source": [
"bqclient = bigquery.Client()"
"bqclient = bigquery.Client(project=PROJECT_ID)"
]
},
{
@@ -549,7 +340,7 @@
"source": [
"#### Location of BigQuery training data.\n",
"\n",
"Now set the variable `IMPORT_FILE` to the location of the data table in BigQuery."
"Now, set the variable `IMPORT_FILE` to the location of the data table in BigQuery and `BQ_TABLE` with the table id."
]
},
{
@@ -591,10 +382,10 @@
},
"outputs": [],
"source": [
"dataset = aip.TabularDataset.create(\n",
" display_name=\"NOAA historical weather data\" + \"_\" + TIMESTAMP,\n",
"dataset = aiplatform.TabularDataset.create(\n",
" display_name=\"NOAA historical weather data\" + \"_\" + UUID,\n",
" bq_source=[IMPORT_FILE],\n",
" labels={\"user_metadata\": BUCKET_NAME[5:]},\n",
" labels={\"user_metadata\": BUCKET_URI[5:]},\n",
")\n",
"\n",
"label_column = \"mean_temp\"\n",
@@ -610,7 +401,7 @@
"source": [
"### Copy the dataset to Cloud Storage\n",
"\n",
"Next, you make a copy of the BigQuery dataset, as a CSV file, to Cloud Storage using the BigQuery extract command.\n",
"Next, you make a copy of the BigQuery table as a CSV file, to Cloud Storage using the BigQuery extract command.\n",
"\n",
"Learn more about [BigQuery command line interface](https://cloud.google.com/bigquery/docs/reference/bq-cli-reference)."
]
@@ -626,9 +417,9 @@
"comps = BQ_TABLE.split(\".\")\n",
"BQ_PROJECT_DATASET_TABLE = comps[0] + \":\" + comps[1] + \".\" + comps[2]\n",
"\n",
"! bq --location=us extract --destination_format CSV $BQ_PROJECT_DATASET_TABLE $BUCKET_NAME/mydata*.csv\n",
"! bq --location=us extract --destination_format CSV $BQ_PROJECT_DATASET_TABLE $BUCKET_URI/mydata*.csv\n",
"\n",
"IMPORT_FILES = ! gsutil ls $BUCKET_NAME/mydata*.csv\n",
"IMPORT_FILES = ! gsutil ls $BUCKET_URI/mydata*.csv\n",
"\n",
"print(IMPORT_FILES)\n",
"\n",
@@ -664,15 +455,12 @@
},
"outputs": [],
"source": [
"if \"IMPORT_FILES\" in globals():\n",
" gcs_source = IMPORT_FILES\n",
"else:\n",
" gcs_source = [IMPORT_FILE]\n",
"gcs_source = IMPORT_FILES\n",
"\n",
"dataset = aip.TabularDataset.create(\n",
" display_name=\"NOAA historical weather data\" + \"_\" + TIMESTAMP,\n",
"dataset = aiplatform.TabularDataset.create(\n",
" display_name=\"NOAA historical weather data\" + \"_\" + UUID,\n",
" gcs_source=gcs_source,\n",
" labels={\"user_metadata\": BUCKET_NAME[5:]},\n",
" labels={\"user_metadata\": BUCKET_URI[5:]},\n",
")\n",
"\n",
"\n",
@@ -694,6 +482,30 @@
"Learn more about [Creating BigQuery views](https://cloud.google.com/bigquery/docs/views)."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "7dc142433e50"
},
"outputs": [],
"source": [
"# Set dataset name and view name in BigQuery\n",
"BQ_MY_DATASET = \"[your-dataset-name]\"\n",
"BQ_MY_TABLE = \"[your-view-name]\"\n",
"\n",
"# Otherwise, use the default names\n",
"if (\n",
" BQ_MY_DATASET == \"\"\n",
" or BQ_MY_DATASET is None\n",
" or BQ_MY_DATASET == \"[your-dataset-name]\"\n",
"):\n",
" BQ_MY_DATASET = \"mlops_dataset_\" + UUID\n",
"\n",
"if BQ_MY_TABLE == \"\" or BQ_MY_TABLE is None or BQ_MY_TABLE == \"[your-view-name]\":\n",
" BQ_MY_TABLE = \"mlops_view_\" + UUID"
]
},
{
"cell_type": "code",
"execution_count": null,
@@ -702,8 +514,7 @@
},
"outputs": [],
"source": [
"BQ_MY_DATASET = 'mydataset'\n",
"BQ_MY_TABLE = 'myview'\n",
"# Create the resources\n",
"! bq --location=US mk -d \\\n",
"$PROJECT_ID:$BQ_MY_DATASET\n",
"\n",
@@ -744,8 +555,8 @@
},
"outputs": [],
"source": [
"# Download a table.\n",
"table = bigquery.TableReference.from_string(\"bigquery-public-data.samples.gsod\")\n",
"# Download the table.\n",
"table = bigquery.TableReference.from_string(BQ_TABLE)\n",
"\n",
"rows = bqclient.list_rows(\n",
" table,\n",
@@ -1031,22 +842,6 @@
"TABLE_ID = \"gsod\"\n",
"\n",
"\n",
"def create_bigquery_dataset(dataset_id):\n",
" dataset = bigquery.Dataset(\n",
" bigquery.dataset.DatasetReference(PROJECT_ID, dataset_id)\n",
" )\n",
" dataset.location = \"us\"\n",
"\n",
" try:\n",
" dataset = bqclient.create_dataset(dataset) # API request\n",
" return True\n",
" except Exception as err:\n",
" print(err)\n",
" if err.code != 409: # http_client.CONFLICT\n",
" raise\n",
" return False\n",
"\n",
"\n",
"def load_data_into_bigquery(url, dataset_id, table_id):\n",
" create_bigquery_dataset(dataset_id)\n",
" dataset = bqclient.dataset(dataset_id)\n",
@@ -1079,13 +874,11 @@
"source": [
"### Read BigQuery table into XGboost DMatrix\n",
"\n",
"Currently, there is no direct data feeding connector between BigQuery and the open source XGBoost.\n",
"Currently, there is no direct data feeding connector between BigQuery and the open source XGBoost. The BigQuery ML service has a built-in XGBoost training module.\n",
"\n",
"The BigQuery ML service has XGBoost training builtin.\n",
"Alernatively, you extract the data either as a pandas dataframe or as CSV files. The extracted data is then given as an input to a `DMatrix` object when training the model.\n",
"\n",
"Alernatively, you extract the data either as a pandas dataframe or as CSV files. The extracted data is then inputted to a `DMatrix` object when training the model.\n",
"\n",
"Learn more about [Getting started with builtin XGBoost](https://cloud.google.com/ai-platform/training/docs/algorithms/xgboost-start)"
"Learn more about [Getting started with built-in XGBoost](https://cloud.google.com/ai-platform/training/docs/algorithms/xgboost-start)."
]
},
{
@@ -1096,7 +889,7 @@
"source": [
"### Read pandas table into XGboost DMatrix\n",
"\n",
"Next, you load the pandas dataframe into a `DMatrix` object. XGBoost does not support non-numeric inputs. Any column that is categorical will need to be one-hot encoded prior to loading the dataframe."
"Next, you load the pandas dataframe into a `DMatrix` object. XGBoost does not support non-numeric inputs. Any column that is categorical need to be one-hot encoded prior to loading the dataframe."
]
},
{
@@ -1109,7 +902,7 @@
"source": [
"dataframe[\"station_number\"] = pd.to_numeric(dataframe[\"station_number\"])\n",
"labels = dataframe[\"mean_temp\"]\n",
"data = dataframe.drop(4)\n",
"data = dataframe.drop([\"mean_temp\"], axis=1)\n",
"\n",
"dtrain = xgb.DMatrix(data, label=labels)"
]
@@ -1122,7 +915,7 @@
"source": [
"### Read CSV files into XGboost DMatrix\n",
"\n",
"Currently, there is no Cloud Storage support in XGBoost. If you use CSV files for input, you will need to download them locally."
"Currently, there is no Cloud Storage support in XGBoost. If you use CSV files for input, you need to download them locally."
]
},
{
@@ -1144,87 +937,42 @@
"id": "cleanup:mbsdk"
},
"source": [
"# Cleaning up\n",
"# Clean 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",
"\n",
"- Dataset\n",
"- Pipeline\n",
"- Model\n",
"- Endpoint\n",
"- AutoML Training Job\n",
"- Batch Job\n",
"- Custom Job\n",
"- Hyperparameter Tuning Job\n",
"- Cloud Storage Bucket"
"- Vertex AI Dataset resource\n",
"- Cloud Storage Bucket\n",
"- BigQuery Dataset\n",
"\n",
"Set `delete_storage` to _True_ to delete the storage resources used in this notebook."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "cleanup:mbsdk"
"id": "47ad926d84e8"
},
"outputs": [],
"source": [
"delete_all = True\n",
"import os\n",
"\n",
"if delete_all:\n",
" # Delete the dataset using the Vertex dataset object\n",
" try:\n",
" if \"dataset\" in globals():\n",
" dataset.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"# Delete the dataset using the Vertex dataset object\n",
"dataset.delete()\n",
"\n",
" # Delete the model using the Vertex model object\n",
" try:\n",
" if \"model\" in globals():\n",
" model.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"# Delete the temporary BigQuery dataset\n",
"! bq rm -r -f $PROJECT_ID:$DATASET_ID\n",
"\n",
" # Delete the endpoint using the Vertex endpoint object\n",
" try:\n",
" if \"endpoint\" in globals():\n",
" endpoint.undeploy_all()\n",
" endpoint.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" # Delete the AutoML or Pipeline training job\n",
" try:\n",
" if \"dag\" in globals():\n",
" dag.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" # Delete the custom training job\n",
" try:\n",
" if \"job\" in globals():\n",
" job.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" # Delete the batch prediction job using the Vertex batch prediction object\n",
" try:\n",
" if \"batch_predict_job\" in globals():\n",
" batch_predict_job.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" # Delete the hyperparameter tuning job using the Vertex hyperparameter tuning object\n",
" try:\n",
" if \"hpt_job\" in globals():\n",
" hpt_job.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" if \"BUCKET_NAME\" in globals():\n",
" ! gsutil rm -r $BUCKET_NAME"
"delete_storage = False\n",
"if delete_storage or os.getenv(\"IS_TESTING\"):\n",
" # Delete the created GCS bucket\n",
" ! gsutil rm -r $BUCKET_URI\n",
" # Delete the created BigQuery datasets\n",
" ! bq rm -r -f $PROJECT_ID:$BQ_MY_DATASET"
]
}
],
@@ -39,8 +39,14 @@
" </a>\n",
" </td>\n",
" <td>\n",
" <a href=\"https://console.cloud.google.com/ai/platform/notebooks/deploy-notebook?download_url=https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/ml_ops/stage1/get_started_dataflow.ipynb\">\n",
" Open in Google Cloud Notebooks\n",
" <a href=\"https://colab.research.google.com/github/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/ml_ops/stage1/get_started_dataflow.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://console.cloud.google.com/vertex-ai/workbench/deploy-notebook?download_url=https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/main/notebooks/community/ml_ops/stage1/get_started_dataflow.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>\n",
@@ -59,17 +65,6 @@
"This tutorial demonstrates how to use Vertex AI for E2E MLOps on Google Cloud in production. This tutorial covers stage 1 : data management: get started with Dataflow."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "dataset:gsod,lrg"
},
"source": [
"### Dataset\n",
"\n",
"The dataset used for this tutorial is the GSOD dataset from [BigQuery public datasets](https://cloud.google.com/bigquery/public-data). The version of the dataset you use only the fields year, month and day to predict the value of mean daily temperature (mean_temp)."
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -131,6 +126,34 @@
"Alternately for AutoML tabular model training, you can reconfigure the otherwise default preprocessing."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "dataset:gsod,lrg"
},
"source": [
"### Dataset\n",
"\n",
"The dataset used for this tutorial is the GSOD dataset from [BigQuery public datasets](https://cloud.google.com/bigquery/public-data). The version of the dataset you use only the fields year, month and day to predict the value of mean daily temperature (mean_temp)."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "9e483012a752"
},
"source": [
"### Costs\n",
"This tutorial uses billable components of Google Cloud:\n",
"\n",
"- Vertex AI\n",
"- Cloud Storage\n",
"- BigQuery\n",
"- Dataflow\n",
"\n",
"Learn about [Vertex AI pricing](https://cloud.google.com/vertex-ai/pricing), [Cloud Storage pricing](https://cloud.google.com/storage/pricing), [BigQuery pricing](https://cloud.google.com/bigquery/pricing), and [Dataflow pricing](https://cloud.google.com/dataflow/pricing) and use the [Pricing Calculator](https://cloud.google.com/products/calculator/) to generate a cost estimate based on your projected usage."
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -139,7 +162,7 @@
"source": [
"## Installations\n",
"\n",
"Install *one time* the packages for executing the MLOps notebooks."
"Install the following packages to execute this notebook."
]
},
{
@@ -150,20 +173,22 @@
},
"outputs": [],
"source": [
"ONCE_ONLY = False\n",
"if ONCE_ONLY:\n",
" ! pip3 install -U tensorflow==2.5 $USER_FLAG\n",
" ! pip3 install -U tensorflow-data-validation==1.2 $USER_FLAG\n",
" ! pip3 install -U tensorflow-transform==1.2 $USER_FLAG\n",
" ! pip3 install -U tensorflow-io==0.18 $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-aiplatform[tensorboard] $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-pipeline-components $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-bigquery $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-logging $USER_FLAG\n",
" ! pip3 install --upgrade apache-beam[gcp] $USER_FLAG\n",
" ! pip3 install --upgrade pyarrow $USER_FLAG\n",
" ! pip3 install --upgrade cloudml-hypertune $USER_FLAG\n",
" ! pip3 install --upgrade kfp $USER_FLAG"
"import os\n",
"\n",
"# The Vertex AI Workbench Notebook product has specific requirements\n",
"IS_WORKBENCH_NOTEBOOK = os.getenv(\"DL_ANACONDA_HOME\") and not os.getenv(\"VIRTUAL_ENV\")\n",
"IS_USER_MANAGED_WORKBENCH_NOTEBOOK = os.path.exists(\n",
" \"/opt/deeplearning/metadata/env_version\"\n",
")\n",
"\n",
"# Vertex AI Notebook requires dependencies to be installed with '--user'\n",
"USER_FLAG = \"\"\n",
"if IS_WORKBENCH_NOTEBOOK:\n",
" USER_FLAG = \"--user\"\n",
"\n",
"extra_pkgs = \"tensorflow==2.5 tensorflow-data-validation==1.2 tensorflow-transform==1.2 \\\n",
" tensorflow-io==0.18 pyarrow pandas apache-beam[gcp] google-cloud-bigquery\"\n",
"! pip3 install --upgrade --quiet {USER_FLAG} google-cloud-aiplatform $extra_pkgs"
]
},
{
@@ -185,9 +210,9 @@
},
"outputs": [],
"source": [
"import os\n",
"import sys\n",
"\n",
"if not os.getenv(\"IS_TESTING\"):\n",
"if \"google.colab\" in sys.modules:\n",
" # Automatically restart kernel after installs\n",
" import IPython\n",
"\n",
@@ -198,187 +223,42 @@
{
"cell_type": "markdown",
"metadata": {
"id": "project_id"
"id": "fc8fb52b5cca"
},
"source": [
"#### Set your project ID\n",
"### Common setup\n",
"\n",
"**If you don't know your project ID**, you may be able to get your project ID using `gcloud`."
"Now, execute the common setup for the notebook tutorials."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "set_project_id"
"id": "001a0fcd5d78"
},
"outputs": [],
"source": [
"PROJECT_ID = \"[your-project-id]\" # @param {type:\"string\"}"
"# Common code setup for notebook tutorials\n",
"\n",
"! wget https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/main/notebooks/community/ml_ops/setup.py -O setup.py\n",
"\n",
"%run setup.py --bucket"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "autoset_project_id"
"id": "d809f07a8935"
},
"outputs": [],
"source": [
"if PROJECT_ID == \"\" or PROJECT_ID is None or PROJECT_ID == \"[your-project-id]\":\n",
" # Get your GCP project id from gcloud\n",
" shell_output = ! gcloud config list --format 'value(core.project)' 2>/dev/null\n",
" PROJECT_ID = shell_output[0]\n",
" print(\"Project ID:\", PROJECT_ID)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "set_gcloud_project_id"
},
"outputs": [],
"source": [
"! gcloud config set project $PROJECT_ID"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "region"
},
"source": [
"#### Region\n",
"# Other Common setup instructions for notebook tutorials\n",
"\n",
"You can also change the `REGION` variable, which is used for operations\n",
"throughout the rest of this notebook. Below are regions supported for Vertex AI. We recommend that you choose the region closest to you.\n",
"! wget https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/main/notebooks/community/ml_ops/setup.md -O setup.md\n",
"\n",
"- Americas: `us-central1`\n",
"- Europe: `europe-west4`\n",
"- Asia Pacific: `asia-east1`\n",
"\n",
"You may not use a multi-regional bucket for training with Vertex AI. Not all regions provide support for all Vertex AI services.\n",
"\n",
"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": "timestamp"
},
"source": [
"#### Timestamp\n",
"\n",
"If you are in a live tutorial session, you might be using a shared test account or project. To avoid name collisions between users on resources created, you create a timestamp for each instance session, and append the timestamp onto the name of resources you create in this tutorial."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "timestamp"
},
"outputs": [],
"source": [
"from datetime import datetime\n",
"\n",
"TIMESTAMP = datetime.now().strftime(\"%Y%m%d%H%M%S\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "bucket:custom"
},
"source": [
"### Create a Cloud Storage bucket\n",
"\n",
"**The following steps are required, regardless of your notebook environment.**\n",
"\n",
"When you submit a custom training job using the Vertex SDK, you upload a Python package\n",
"containing your training code to a Cloud Storage bucket. Vertex AI runs\n",
"the code from this package. In this tutorial, Vertex AI also saves the\n",
"trained model that results from your job in the same bucket. You can then\n",
"create an `Endpoint` resource based on this output in order to serve\n",
"online predictions.\n",
"\n",
"Set the name of your Cloud Storage bucket below. Bucket names must be globally unique across all Google Cloud projects, including those outside of your organization."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "bucket"
},
"outputs": [],
"source": [
"BUCKET_NAME = \"gs://[your-bucket-name]\" # @param {type:\"string\"}"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "autoset_bucket"
},
"outputs": [],
"source": [
"if BUCKET_NAME == \"\" or BUCKET_NAME is None or BUCKET_NAME == \"gs://[your-bucket-name]\":\n",
" BUCKET_NAME = \"gs://\" + PROJECT_ID + \"aip-\" + TIMESTAMP"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "create_bucket"
},
"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": "create_bucket"
},
"outputs": [],
"source": [
"! gsutil mb -l $REGION $BUCKET_NAME"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "validate_bucket"
},
"source": [
"Finally, validate access to your Cloud Storage bucket by examining its contents:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "validate_bucket"
},
"outputs": [],
"source": [
"! gsutil ls -al $BUCKET_NAME"
"%load setup.md "
]
},
{
@@ -401,7 +281,7 @@
},
"outputs": [],
"source": [
"import google.cloud.aiplatform as aip"
"import google.cloud.aiplatform as aiplatform"
]
},
{
@@ -555,7 +435,7 @@
},
"outputs": [],
"source": [
"aip.init(project=PROJECT_ID, location=REGION)"
"aiplatform.init(project=PROJECT_ID, location=REGION)"
]
},
{
@@ -676,6 +556,31 @@
"dataframe[\"station_number\"] = pd.to_numeric(dataframe[\"station_number\"])"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "bqml_create_dataset"
},
"source": [
"### Create BQ dataset resource\n",
"\n",
"First, you create an empty dataset resource in your project."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "bqml_create_dataset"
},
"outputs": [],
"source": [
"BQ_MY_DATASET = 'samples'\n",
"BQ_MY_TABLE = 'gsod'\n",
"! bq --location=US mk -d \\\n",
"$PROJECT_ID:$BQ_MY_DATASET"
]
},
{
"cell_type": "code",
"execution_count": null,
@@ -979,7 +884,7 @@
},
"outputs": [],
"source": [
"SCHEMA_LOCATION = BUCKET_NAME + \"/schema.txt\"\n",
"SCHEMA_LOCATION = BUCKET_URI + \"/schema.txt\"\n",
"\n",
"# When running Apache Beam directly (file is directly accessed)\n",
"tfdv.write_schema_text(output_path=SCHEMA_LOCATION, schema=schema)\n",
@@ -1124,7 +1029,7 @@
" )\n",
"\n",
"\n",
"EXPORTED_DATA_PREFIX = os.path.join(BUCKET_NAME, \"exported_data\")\n",
"EXPORTED_DATA_PREFIX = os.path.join(BUCKET_URI, \"exported_data\")\n",
"\n",
"QUERY_STRING = \"SELECT {},{} FROM {} LIMIT 500\".format(\n",
" \"CAST(station_number as STRING) AS station_number,year,month,day\",\n",
@@ -1137,7 +1042,7 @@
" \"runner\": RUNNER,\n",
" \"raw_data_query\": QUERY_STRING,\n",
" \"exported_data_prefix\": EXPORTED_DATA_PREFIX,\n",
" \"temp_location\": os.path.join(BUCKET_NAME, \"temp\"),\n",
" \"temp_location\": os.path.join(BUCKET_URI, \"temp\"),\n",
" \"project\": PROJECT_ID,\n",
" \"region\": REGION,\n",
" \"setup_file\": \"./setup.py\",\n",
@@ -1162,17 +1067,7 @@
"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",
"\n",
"- Dataset\n",
"- Pipeline\n",
"- Model\n",
"- Endpoint\n",
"- AutoML Training Job\n",
"- Batch Job\n",
"- Custom Job\n",
"- Hyperparameter Tuning Job\n",
"- Cloud Storage Bucket"
"Otherwise, you can delete the individual resources you created in this tutorial."
]
},
{
@@ -1183,61 +1078,11 @@
},
"outputs": [],
"source": [
"delete_all = True\n",
"delete_storage = False\n",
"\n",
"if delete_all:\n",
" # Delete the dataset using the Vertex dataset object\n",
" try:\n",
" if \"dataset\" in globals():\n",
" dataset.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" # Delete the model using the Vertex model object\n",
" try:\n",
" if \"model\" in globals():\n",
" model.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" # Delete the endpoint using the Vertex endpoint object\n",
" try:\n",
" if \"endpoint\" in globals():\n",
" endpoint.undeploy_all()\n",
" endpoint.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" # Delete the AutoML or Pipeline training job\n",
" try:\n",
" if \"dag\" in globals():\n",
" dag.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" # Delete the custom training job\n",
" try:\n",
" if \"job\" in globals():\n",
" job.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" # Delete the batch prediction job using the Vertex batch prediction object\n",
" try:\n",
" if \"batch_predict_job\" in globals():\n",
" batch_predict_job.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" # Delete the hyperparameter tuning job using the Vertex hyperparameter tuning object\n",
" try:\n",
" if \"hpt_job\" in globals():\n",
" hpt_job.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" if \"BUCKET_NAME\" in globals():\n",
" ! gsutil rm -r $BUCKET_NAME"
"if delete_storage or os.getenv(\"IS_TESTING\"):\n",
" if \"BUCKET_URI\" in globals():\n",
" ! gsutil rm -r $BUCKET_URI"
]
}
],
@@ -8,7 +8,7 @@
},
"outputs": [],
"source": [
"# Copyright 2021 Google LLC\n",
"# Copyright 2022 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",
@@ -29,20 +29,26 @@
"id": "title:generic,gcp"
},
"source": [
"# E2E ML on GCP: MLOps stage 1 : data management: get started with Vertex datasets\n",
"# E2E ML on GCP: MLOps stage 1 : data management: get started with Vertex AI datasets\n",
"\n",
"<table align=\"left\">\n",
" <td>\n",
" <a href=\"https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/ml_ops/stage1/get_started_vertex_datasets.ipynb\">\n",
" <img src=\"https://cloud.google.com/ml-engine/images/github-logo-32px.png\" alt=\"GitHub logo\">\n",
" View on GitHub\n",
" <a href=\"https://colab.research.google.com/github/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/ml_ops/stage1/get_started_vertex_datasets.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://console.cloud.google.com/ai/platform/notebooks/deploy-notebook?download_url=https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/ml_ops/stage1/get_started_vertex_datasets.ipynb\">\n",
" Open in Google Cloud Notebooks\n",
" <a href=\"https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/ml_ops/stage1/get_started_vertex_datasets.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/community/ml_ops/stage1/get_started_vertex_datasets.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>\n",
"<br/><br/><br/>"
]
@@ -133,6 +139,33 @@
" - Create a tf.data.Dataset from the TFRecords."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "533dd6fe83c8"
},
"source": [
"### Datasets\n",
"\n",
"This tutorial uses a variety of public datasets to demonstrate using a `Vertex AI` managed dataset."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "9e483012a752"
},
"source": [
"### Costs\n",
"This tutorial uses billable components of Google Cloud:\n",
"\n",
"- Vertex AI\n",
"- Cloud Storage\n",
"- BigQuery\n",
"\n",
"Learn about [Vertex AI pricing](https://cloud.google.com/vertex-ai/pricing), [Cloud Storage pricing](https://cloud.google.com/storage/pricing) and [BigQuery pricing](https://cloud.google.com/bigquery/pricing) and use the [Pricing Calculator](https://cloud.google.com/products/calculator/) to generate a cost estimate based on your projected usage."
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -141,7 +174,7 @@
"source": [
"## Installations\n",
"\n",
"Install *one time* the packages for executing the MLOps notebooks."
"Install the packages required for executing this notebook."
]
},
{
@@ -152,20 +185,27 @@
},
"outputs": [],
"source": [
"ONCE_ONLY = False\n",
"if ONCE_ONLY:\n",
" ! pip3 install -U tensorflow==2.5 $USER_FLAG\n",
" ! pip3 install -U tensorflow-data-validation==1.2 $USER_FLAG\n",
" ! pip3 install -U tensorflow-transform==1.2 $USER_FLAG\n",
" ! pip3 install -U tensorflow-io==0.18 $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-aiplatform[tensorboard] $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-pipeline-components $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-bigquery $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-logging $USER_FLAG\n",
" ! pip3 install --upgrade apache-beam[gcp] $USER_FLAG\n",
" ! pip3 install --upgrade pyarrow $USER_FLAG\n",
" ! pip3 install --upgrade cloudml-hypertune $USER_FLAG\n",
" ! pip3 install --upgrade kfp $USER_FLAG"
"import os\n",
"\n",
"# The Vertex AI Workbench Notebook product has specific requirements\n",
"IS_WORKBENCH_NOTEBOOK = os.getenv(\"DL_ANACONDA_HOME\") and not os.getenv(\"VIRTUAL_ENV\")\n",
"IS_USER_MANAGED_WORKBENCH_NOTEBOOK = os.path.exists(\n",
" \"/opt/deeplearning/metadata/env_version\"\n",
")\n",
"\n",
"# Vertex AI Notebook requires dependencies to be installed with '--user'\n",
"USER_FLAG = \"\"\n",
"if IS_WORKBENCH_NOTEBOOK:\n",
" USER_FLAG = \"--user\"\n",
"\n",
"! pip3 install -U tensorflow $USER_FLAG -q\n",
"! pip3 install -U tensorflow-data-validation $USER_FLAG -q\n",
"! pip3 install -U tensorflow-transform $USER_FLAG -q\n",
"! pip3 install -U tensorflow-io $USER_FLAG -q\n",
"! pip3 install --upgrade google-cloud-aiplatform $USER_FLAG -q\n",
"! pip3 install --upgrade google-cloud-bigquery $USER_FLAG -q\n",
"! pip3 install -U tensorflow-io==0.18 $USER_FLAG -q\n",
"! pip3 install --upgrade db-dtypes $USER_FLAG -q! pip3 install --upgrade future $USER_FLAG -q"
]
},
{
@@ -197,6 +237,32 @@
" app.kernel.do_shutdown(True)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "cb082379ed5b"
},
"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",
"1. [Make sure that billing is enabled for your project](https://cloud.google.com/billing/docs/how-to/modify-project).\n",
"\n",
"1. [Enable the Vertex AI API](https://console.cloud.google.com/flows/enableapi?apiid=aiplatform.googleapis.com). \n",
"\n",
"1. If you are running this notebook locally, you need to install the [Cloud SDK](https://cloud.google.com/sdk).\n",
"\n",
"1. Enter your project ID in the cell below. Then run the cell to make sure the\n",
"Cloud SDK uses the right project for all the commands in this notebook.\n",
"\n",
"**Note**: Jupyter runs lines prefixed with `!` as shell commands, and it interpolates Python variables prefixed with `$` into these commands."
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -223,7 +289,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "autoset_project_id"
"id": "nWlzLu5ELxWd"
},
"outputs": [],
"source": [
@@ -238,7 +304,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "set_gcloud_project_id"
"id": "c021ca495967"
},
"outputs": [],
"source": [
@@ -273,7 +339,10 @@
},
"outputs": [],
"source": [
"REGION = \"us-central1\" # @param {type: \"string\"}"
"REGION = \"[your-region]\" # @param {type: \"string\"}\n",
"\n",
"if REGION == \"[your-region]\":\n",
" REGION = \"us-central1\""
]
},
{
@@ -300,6 +369,66 @@
"TIMESTAMP = datetime.now().strftime(\"%Y%m%d%H%M%S\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "927085b84a07"
},
"source": [
"### Authenticate your Google Cloud account\n",
"\n",
"**If you are using Vertex AI Workbench Notebooks**, your environment is already authenticated. Skip this step.\n",
"\n",
"**If you are using Colab**, run the cell below and follow the instructions when prompted to authenticate your account via oAuth.\n",
"\n",
"**Otherwise**, follow these steps:\n",
"\n",
"In the Cloud Console, go to the [Create service account key](https://console.cloud.google.com/apis/credentials/serviceaccountkey) page.\n",
"\n",
"**Click Create service account**.\n",
"\n",
"In the **Service account name** field, enter a name, and click **Create**.\n",
"\n",
"In the **Grant this service account access to project** section, click the Role drop-down list. Type \"Vertex\" into the filter box, and select **Vertex Administrator**. Type \"Storage Object Admin\" into the filter box, and select **Storage Object Admin**.\n",
"\n",
"Click Create. A JSON file that contains your key downloads to your local environment.\n",
"\n",
"Enter the path to your service account key as the GOOGLE_APPLICATION_CREDENTIALS variable in the cell below and run the cell."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "89788a802687"
},
"outputs": [],
"source": [
"# If you are running this notebook in Colab, run this cell and follow the\n",
"# instructions to authenticate your GCP account. This provides access to your\n",
"# Cloud Storage bucket and lets you submit training jobs and prediction\n",
"# requests.\n",
"\n",
"import os\n",
"import sys\n",
"\n",
"# If on Vertex AI Workbench, then don't execute this code\n",
"IS_COLAB = \"google.colab\" in sys.modules\n",
"if not os.path.exists(\"/opt/deeplearning/metadata/env_version\") and not os.getenv(\n",
" \"DL_ANACONDA_HOME\"\n",
"):\n",
" if \"google.colab\" in sys.modules:\n",
" from google.colab import auth as google_auth\n",
"\n",
" google_auth.authenticate_user()\n",
"\n",
" # If you are running this notebook locally, replace the string below with the\n",
" # path to your service account key and run this cell to authenticate your GCP\n",
" # account.\n",
" elif not os.getenv(\"IS_TESTING\"):\n",
" %env GOOGLE_APPLICATION_CREDENTIALS ''"
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -328,7 +457,7 @@
},
"outputs": [],
"source": [
"BUCKET_NAME = \"gs://[your-bucket-name]\" # @param {type:\"string\"}"
"BUCKET_URI = \"gs://[your-bucket-name]\" # @param {type:\"string\"}"
]
},
{
@@ -339,8 +468,8 @@
},
"outputs": [],
"source": [
"if BUCKET_NAME == \"\" or BUCKET_NAME is None or BUCKET_NAME == \"gs://[your-bucket-name]\":\n",
" BUCKET_NAME = \"gs://\" + PROJECT_ID + \"aip-\" + TIMESTAMP"
"if BUCKET_URI == \"\" or BUCKET_URI is None or BUCKET_URI == \"gs://[your-bucket-name]\":\n",
" BUCKET_URI = \"gs://\" + PROJECT_ID + \"aip-\" + TIMESTAMP"
]
},
{
@@ -360,7 +489,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l $REGION $BUCKET_NAME"
"! gsutil mb -l $REGION $BUCKET_URI"
]
},
{
@@ -380,7 +509,7 @@
},
"outputs": [],
"source": [
"! gsutil ls -al $BUCKET_NAME"
"! gsutil ls -al $BUCKET_URI"
]
},
{
@@ -392,7 +521,11 @@
"### Set up variables\n",
"\n",
"Next, set up some variables used throughout the tutorial.\n",
"### Import libraries and define constants"
"### Import libraries and define constants\n",
"\n",
"Import the BigQuery package, TensorFlow Data Validation (TFDV) package and TensorFlow Data Validation package into your Python environment. \n",
"\n",
"Import TensorFlow Transform (TFT) package and pandas into your Python environment."
]
},
{
@@ -403,97 +536,13 @@
},
"outputs": [],
"source": [
"import google.cloud.aiplatform as aip"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "import_bq"
},
"source": [
"#### Import BigQuery\n",
"\n",
"Import the BigQuery package into your Python environment."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "import_bq"
},
"outputs": [],
"source": [
"import google.cloud.aiplatform as aip\n",
"import pandas as pd\n",
"import tensorflow_data_validation as tfdv\n",
"import tensorflow_transform as tft\n",
"from google.cloud import bigquery"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "import_tfdv"
},
"source": [
"#### Import TensorFlow Data Validation\n",
"\n",
"Import the TensorFlow Data Validation (TFDV) package into your Python environment."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "import_tfdv"
},
"outputs": [],
"source": [
"import tensorflow_data_validation as tfdv"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "import_tft"
},
"source": [
"#### Import TensorFlow Transform\n",
"\n",
"Import the TensorFlow Transform (TFT) package into your Python environment."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "import_tft"
},
"outputs": [],
"source": [
"import tensorflow_transform as tft"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "import_pandas"
},
"source": [
"#### Import pandas\n",
"\n",
"Import the pandas package into your Python environment."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "import_pandas"
},
"outputs": [],
"source": [
"import pandas as pd"
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -513,7 +562,7 @@
},
"outputs": [],
"source": [
"aip.init(project=PROJECT_ID, location=REGION)"
"aip.init(project=PROJECT_ID, location=REGION, staging_bucket=BUCKET_URI)"
]
},
{
@@ -567,26 +616,13 @@
"Learn more about [All dataset documentation](https://cloud.google.com/vertex-ai/docs/datasets/datasets)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "import_file:flowers,csv,icn"
},
"outputs": [],
"source": [
"IMPORT_FILE = (\n",
" \"gs://cloud-samples-data/vision/automl_classification/flowers/all_data_v2.csv\"\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "create_dataset:image,icn"
},
"source": [
"### Create the Dataset\n",
"### Create an Image Dataset\n",
"\n",
"Next, create the `Dataset` resource using the `create` method for the `ImageDataset` class, which takes the following parameters:\n",
"\n",
@@ -601,6 +637,19 @@
"Learn more about [ImageDataset](https://cloud.google.com/vertex-ai/docs/datasets/prepare-image)."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "import_file:flowers,csv,icn"
},
"outputs": [],
"source": [
"IMPORT_FILE = (\n",
" \"gs://cloud-samples-data/vision/automl_classification/flowers/all_data_v2.csv\"\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
@@ -618,24 +667,13 @@
"print(dataset.resource_name)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "import_file:hmdb,csv,vcn"
},
"outputs": [],
"source": [
"IMPORT_FILE = \"gs://automl-video-demo-data/hmdb_split1_5classes_train_inf.csv\""
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "create_dataset:video,vcn"
},
"source": [
"### Create the Dataset\n",
"### Create a Video Dataset\n",
"\n",
"Next, create the `Dataset` resource using the `create` method for the `VideoDataset` class, which takes the following parameters:\n",
"\n",
@@ -649,6 +687,17 @@
"Learn more about [VideoDataset](https://cloud.google.com/vertex-ai/docs/datasets/prepare-video)."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "import_file:hmdb,csv,vcn"
},
"outputs": [],
"source": [
"IMPORT_FILE = \"gs://automl-video-demo-data/hmdb_split1_5classes_train_inf.csv\""
]
},
{
"cell_type": "code",
"execution_count": null,
@@ -666,24 +715,13 @@
"print(dataset.resource_name)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "import_file:happydb,csv,tcn"
},
"outputs": [],
"source": [
"IMPORT_FILE = \"gs://cloud-ml-data/NL-classification/happiness.csv\""
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "create_dataset:text,tcn"
},
"source": [
"### Create the Dataset\n",
"### Create a Text Dataset\n",
"\n",
"Next, create the `Dataset` resource using the `create` method for the `TextDataset` class, which takes the following parameters:\n",
"\n",
@@ -698,6 +736,17 @@
"Learn more about [TextDataset](https://cloud.google.com/vertex-ai/docs/datasets/prepare-text)."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "import_file:happydb,csv,tcn"
},
"outputs": [],
"source": [
"IMPORT_FILE = \"gs://cloud-ml-data/NL-classification/happiness.csv\""
]
},
{
"cell_type": "code",
"execution_count": null,
@@ -715,6 +764,24 @@
"print(dataset.resource_name)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "create_dataset:tabular,bq,lrg,v2"
},
"source": [
"### Create a Tabular Dataset\n",
"\n",
"#### CSV input data\n",
"\n",
"Next, create the `Dataset` resource using the `create` method for the `TabularDataset` class for CSV input data, which takes the following parameters:\n",
"\n",
"- `display_name`: The human readable name for the `Dataset` resource.\n",
"- `gcs_source`: A list of one or more dataset index files to import the data items into the `Dataset` resource.\n",
"\n",
"Learn more about [TabularDataset from CSV files](https://cloud.google.com/vertex-ai/docs/datasets/create-dataset-api#aiplatform_create_dataset_tabular_gcs_sample-python)"
]
},
{
"cell_type": "code",
"execution_count": null,
@@ -723,27 +790,50 @@
},
"outputs": [],
"source": [
"IMPORT_FILE = \"bq://bigquery-public-data.samples.gsod\"\n",
"BQ_TABLE = \"bigquery-public-data.samples.gsod\""
"IMPORT_FILE = \"gs://cloud-samples-data/tables/iris_1000.csv\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "create_dataset:tabular,bq,lrg,v2"
},
"outputs": [],
"source": [
"dataset = aip.TabularDataset.create(\n",
" display_name=\"example\" + \"_\" + TIMESTAMP, gcs_source=[IMPORT_FILE]\n",
")\n",
"\n",
"print(dataset.resource_name)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "create_dataset:tabular,bq,lrg,v2"
"id": "854dd1e0195c"
},
"source": [
"### Create the Dataset\n",
"#### BigQuery input data\n",
"\n",
"#### CSV input data\n",
"\n",
"Next, create the `Dataset` resource using the `create` method for the `TabularDataset` class, which takes the following parameters:\n",
"Next, create the `Dataset` resource using the `create` method for the `TabularDataset` class for BigQuery table input, which takes the following parameters:\n",
"\n",
"- `display_name`: The human readable name for the `Dataset` resource.\n",
"- `gcs_source`: A list of one or more dataset index files to import the data items into the `Dataset` resource.\n",
"- `labels`: User defined metadata. In this example, you store the location of the Cloud Storage bucket containing the user defined data.\n",
"- `bq_source`: A list of one or more BigQuery tables to import the data items into the `Dataset` resource.\n",
"\n",
"Learn more about [TabularDataset from CSV files](https://cloud.google.com/vertex-ai/docs/datasets/create-dataset-api#aiplatform_create_dataset_tabular_gcs_sample-python)"
"Learn more about [TabularDataset from BigQuery table](https://cloud.google.com/vertex-ai/docs/datasets/create-dataset-api#aiplatform_create_dataset_tabular_bigquery_sample-pythonn)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "86343c146300"
},
"outputs": [],
"source": [
"IMPORT_FILE = \"bq://bigquery-public-data.samples.gsod\"\n",
"BQ_TABLE = \"bigquery-public-data.samples.gsod\""
]
},
{
@@ -761,15 +851,63 @@
"print(dataset.resource_name)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "82e9fe20ce71"
},
"source": [
"#### Dataframe input data\n",
"\n",
"Next, create the `Dataset` resource using the `create_from_dataframe` method for the `TabularDataset` class for pandas dataframe input, which takes the following parameters:\n",
"\n",
"- `display_name`: The human readable name for the `Dataset` resource.\n",
"- `df_source`: The pandas dataframe to import the data items into the `Dataset` resource.\n",
"- `staging_path`: The BigQuery table to store the imported data."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "import_file:covid,csv,forecast"
"id": "3805f945ffdd"
},
"outputs": [],
"source": [
"IMPORT_FILE = \"gs://cloud-samples-data/ai-platform/covid/bigquery-public-covid-nyt-us-counties-train.csv\""
"# Download the table.\n",
"table = bigquery.TableReference.from_string(BQ_TABLE)\n",
"\n",
"rows = bqclient.list_rows(\n",
" table,\n",
" max_results=10000,\n",
" selected_fields=[\n",
" bigquery.SchemaField(\"station_number\", \"STRING\"),\n",
" bigquery.SchemaField(\"year\", \"INTEGER\"),\n",
" bigquery.SchemaField(\"month\", \"INTEGER\"),\n",
" bigquery.SchemaField(\"day\", \"INTEGER\"),\n",
" bigquery.SchemaField(\"mean_temp\", \"FLOAT\"),\n",
" ],\n",
")\n",
"\n",
"dataframe = rows.to_dataframe()\n",
"print(dataframe.head())"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "create_dataset:tabular,bq,lrg,v2"
},
"outputs": [],
"source": [
"dataset = aip.TabularDataset.create_from_dataframe(\n",
" display_name=\"example\" + \"_\" + TIMESTAMP,\n",
" df_source=dataframe,\n",
" staging_path=f\"bq://{PROJECT_ID}.samples.gsod\",\n",
")\n",
"\n",
"print(dataset.resource_name)"
]
},
{
@@ -778,7 +916,7 @@
"id": "create_dataset:tabular,forecast,v2"
},
"source": [
"### Create the Dataset\n",
"### Create a Time Series Dataset\n",
"\n",
"Next, create the `Dataset` resource using the `create` method for the `TimeSeriesDataset` class, which takes the following parameters:\n",
"\n",
@@ -789,6 +927,17 @@
"Learn more about [TimeSeriesDataset](https://cloud.google.com/vertex-ai/docs/datasets/prepare-tabular)."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "import_file:covid,csv,forecast"
},
"outputs": [],
"source": [
"IMPORT_FILE = \"gs://cloud-samples-data/ai-platform/covid/bigquery-public-covid-nyt-us-counties-train.csv\""
]
},
{
"cell_type": "code",
"execution_count": null,
@@ -1149,9 +1298,9 @@
"comps = BQ_TABLE.split(\".\")\n",
"BQ_PROJECT_DATASET_TABLE = comps[0] + \":\" + comps[1] + \".\" + comps[2]\n",
"\n",
"! bq --location=us extract --destination_format CSV $BQ_PROJECT_DATASET_TABLE $BUCKET_NAME/mydata*.csv\n",
"! bq --location=us extract --destination_format CSV $BQ_PROJECT_DATASET_TABLE $BUCKET_URI/mydata*.csv\n",
"\n",
"IMPORT_FILES = ! gsutil ls $BUCKET_NAME/mydata*.csv\n",
"IMPORT_FILES = ! gsutil ls $BUCKET_URI/mydata*.csv\n",
"\n",
"print(IMPORT_FILES)\n",
"\n",
@@ -1209,6 +1358,38 @@
"To create a dataframe from multiple CSV sources, you read each CSV file and concatenate the dataframes together."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "bcd2e4e0703b"
},
"source": [
"If you are running this notebook on Colab, run the following cell to install packages fsspec and gcsfs."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "927bd3f92268"
},
"outputs": [],
"source": [
"# If you are running this notebook in Colab, run this cell and follow the\n",
"# instructions to authenticate your GCP account. This provides access to your\n",
"# Cloud Storage bucket and lets you submit training jobs and prediction\n",
"# requests.\n",
"\n",
"import os\n",
"import sys\n",
"\n",
"# If on Workbench AI Notebook, then don't execute this code\n",
"if not os.path.exists(\"/opt/deeplearning/metadata/env_version\"):\n",
" if \"google.colab\" in sys.modules:\n",
" ! pip3 install fsspec\n",
" ! pip3 install gcsfs"
]
},
{
"cell_type": "code",
"execution_count": null,
@@ -1269,7 +1450,7 @@
},
"outputs": [],
"source": [
"EXPORTED_DIR = f\"{BUCKET_NAME}/exported\"\n",
"EXPORTED_DIR = f\"{BUCKET_URI}/exported\"\n",
"exported_files = dataset.export_data(output_dir=EXPORTED_DIR)\n",
"\n",
"! gsutil ls $EXPORTED_DIR"
@@ -1498,7 +1679,7 @@
" data = f.readlines()\n",
"\n",
"# The path to the TFRecord cached file.\n",
"GCS_TFRECORD_URI = BUCKET_NAME + \"/flowers.tfrecord\"\n",
"GCS_TFRECORD_URI = BUCKET_URI + \"/flowers.tfrecord\"\n",
"\n",
"# Create the TFRecord cached file\n",
"with tf.io.TFRecordWriter(GCS_TFRECORD_URI) as writer:\n",
@@ -1532,14 +1713,7 @@
"Otherwise, you can delete the individual resources you created in this tutorial:\n",
"\n",
"- Dataset\n",
"- Pipeline\n",
"- Model\n",
"- Endpoint\n",
"- AutoML Training Job\n",
"- Batch Job\n",
"- Custom Job\n",
"- Hyperparameter Tuning Job\n",
"- Cloud Storage Bucket"
"- Bucket"
]
},
{
@@ -1550,61 +1724,16 @@
},
"outputs": [],
"source": [
"delete_all = True\n",
"delete_bucket = False\n",
"\n",
"if delete_all:\n",
" # Delete the dataset using the Vertex dataset object\n",
" try:\n",
" if \"dataset\" in globals():\n",
" dataset.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"# Delete the dataset using the Vertex dataset object\n",
"datasets = aip.TabularDataset.list(filter=f'display_name=\"example_{TIMESTAMP}\"')\n",
"for dataset in datasets:\n",
" dataset.delete()\n",
"\n",
" # Delete the model using the Vertex model object\n",
" try:\n",
" if \"model\" in globals():\n",
" model.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" # Delete the endpoint using the Vertex endpoint object\n",
" try:\n",
" if \"endpoint\" in globals():\n",
" endpoint.undeploy_all()\n",
" endpoint.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" # Delete the AutoML or Pipeline training job\n",
" try:\n",
" if \"dag\" in globals():\n",
" dag.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" # Delete the custom training job\n",
" try:\n",
" if \"job\" in globals():\n",
" job.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" # Delete the batch prediction job using the Vertex batch prediction object\n",
" try:\n",
" if \"batch_predict_job\" in globals():\n",
" batch_predict_job.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" # Delete the hyperparameter tuning job using the Vertex hyperparameter tuning object\n",
" try:\n",
" if \"hpt_job\" in globals():\n",
" hpt_job.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" if \"BUCKET_NAME\" in globals():\n",
" ! gsutil rm -r $BUCKET_NAME"
"# Delete the bucket\n",
"if delete_bucket or os.getenv(\"IS_TESTING\"):\n",
" ! gsutil rm -r $BUCKET_URI"
]
}
],
File diff suppressed because it is too large Load Diff
@@ -39,12 +39,15 @@
" </a>\n",
" </td>\n",
" <td>\n",
" <a href=\"https://console.cloud.google.com/ai/platform/notebooks/deploy-notebook?download_url=https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/ml_ops/stage1/mlops_data_management.ipynb\">\n",
" Open in Google Cloud Notebooks\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/community/ml_ops/stage1/mlops_data_management.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>\n",
"<br/><br/><br/>"
"<br/><br/><br/>\n",
"\n",
"*Note: This notebook is not supported for execution in Colab*"
]
},
{
@@ -59,17 +62,6 @@
"This tutorial demonstrates how to use Vertex AI for E2E MLOps on Google Cloud in production. This tutorial covers stage 1 : data management."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "dataset:bq,chicago,lbn"
},
"source": [
"### Dataset\n",
"\n",
"The dataset used for this tutorial is the [Chicago Taxi](https://www.kaggle.com/chicago/chicago-taxi-trips-bq). The version of the dataset you will use in this tutorial is stored in a public BigQuery table. The trained model predicts whether someone would leave a tip for a taxi fare."
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -114,6 +106,34 @@
" - Preprocess the data with `Dataflow`"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "dataset:bq,chicago,lbn"
},
"source": [
"### Dataset\n",
"\n",
"The dataset used for this tutorial is the [Chicago Taxi](https://www.kaggle.com/chicago/chicago-taxi-trips-bq). The version of the dataset used in this tutorial is stored in a public BigQuery table. The trained model predicts whether someone leaves a tip for a taxi fare."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "9e483012a752"
},
"source": [
"### Costs\n",
"This tutorial uses billable components of Google Cloud:\n",
"\n",
"- Vertex AI\n",
"- Cloud Storage\n",
"- BigQuery\n",
"- Dataflow\n",
"\n",
"Learn about [Vertex AI pricing](https://cloud.google.com/vertex-ai/pricing), [Cloud Storage pricing](https://cloud.google.com/storage/pricing), [BigQuery pricing](https://cloud.google.com/bigquery/pricing), and [Dataflow pricing](https://cloud.google.com/dataflow/pricing) and use the [Pricing Calculator](https://cloud.google.com/products/calculator/) to generate a cost estimate based on your projected usage."
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -133,20 +153,33 @@
},
"outputs": [],
"source": [
"import os\n",
"\n",
"# The Vertex AI Workbench Notebook product has specific requirements\n",
"IS_WORKBENCH_NOTEBOOK = os.getenv(\"DL_ANACONDA_HOME\") and not os.getenv(\"VIRTUAL_ENV\")\n",
"IS_USER_MANAGED_WORKBENCH_NOTEBOOK = os.path.exists(\n",
" \"/opt/deeplearning/metadata/env_version\"\n",
")\n",
"\n",
"# Vertex AI Notebook requires dependencies to be installed with '--user'\n",
"USER_FLAG = \"\"\n",
"if IS_WORKBENCH_NOTEBOOK:\n",
" USER_FLAG = \"--user\"\n",
"\n",
"ONCE_ONLY = False\n",
"if ONCE_ONLY:\n",
" ! pip3 install -U tensorflow==2.5 $USER_FLAG\n",
" ! pip3 install -U tensorflow-data-validation==1.2 $USER_FLAG\n",
" ! pip3 install -U tensorflow-transform==1.2 $USER_FLAG\n",
" ! pip3 install -U tensorflow-io==0.18 $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-aiplatform[tensorboard] $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-pipeline-components $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-bigquery $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-logging $USER_FLAG\n",
" ! pip3 install --upgrade apache-beam[gcp] $USER_FLAG\n",
" ! pip3 install --upgrade pyarrow $USER_FLAG\n",
" ! pip3 install --upgrade cloudml-hypertune $USER_FLAG\n",
" ! pip3 install --upgrade kfp $USER_FLAG"
" ! pip3 install -U {USER_FLAG} -q tensorflow==2.5 \\\n",
" tensorflow-data-validation==1.2 \\\n",
" tensorflow-transform==1.2 \\\n",
" tensorflow-io==0.18 \n",
" \n",
" ! pip3 install --upgrade {USER_FLAG} -q google-cloud-aiplatform[tensorboard] \\\n",
" google-cloud-pipeline-components \\\n",
" google-cloud-bigquery \\\n",
" google-cloud-logging \\\n",
" apache-beam[gcp] \\\n",
" pyarrow \\\n",
" cloudml-hypertune\n"
]
},
{
@@ -178,6 +211,32 @@
" app.kernel.do_shutdown(True)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "84cd83853240"
},
"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",
"1. [Make sure that billing is enabled for your project](https://cloud.google.com/billing/docs/how-to/modify-project).\n",
"\n",
"1. [Enable the Vertex AI, BigQuery, Compute Engine and Cloud Storage APIs](https://console.cloud.google.com/flows/enableapi?apiid=aiplatform.googleapis.com,bigquery,compute_component,storage_component).\n",
"\n",
"1. If you are running this notebook locally, you need to install the [Cloud SDK](https://cloud.google.com/sdk).\n",
"\n",
"1. Enter your project ID in the cell below. Then run the cell to make sure the\n",
"Cloud SDK uses the right project for all the commands in this notebook.\n",
"\n",
"**Note**: Jupyter runs lines prefixed with `!` as shell commands, and it interpolates Python variables prefixed with `$` into these commands."
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -254,7 +313,10 @@
},
"outputs": [],
"source": [
"REGION = \"us-central1\" # @param {type: \"string\"}"
"REGION = \"[your-region]\" # @param {type: \"string\"}\n",
"\n",
"if REGION == \"[your-region]\":\n",
" REGION = \"us-central1\""
]
},
{
@@ -281,6 +343,66 @@
"TIMESTAMP = datetime.now().strftime(\"%Y%m%d%H%M%S\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "77c385f0db59"
},
"source": [
"### Authenticate your Google Cloud account\n",
"\n",
"**If you are using Vertex AI Workbench Notebooks**, your environment is already authenticated. \n",
"\n",
"**If you are using Colab**, run the cell below and follow the instructions when prompted to authenticate your account via oAuth.\n",
"\n",
"**Otherwise**, follow these steps:\n",
"\n",
"In the Cloud Console, go to the [Create service account key](https://console.cloud.google.com/apis/credentials/serviceaccountkey) page.\n",
"\n",
"1. **Click Create service account**.\n",
"\n",
"2. In the **Service account name** field, enter a name, and click **Create**.\n",
"\n",
"3. In the **Grant this service account access to project** section, click the Role drop-down list. Type \"Vertex AI\" into the filter box, and select **Vertex AI Administrator**. Type \"Storage Object Admin\" into the filter box, and select **Storage Object Admin**.\n",
"\n",
"4. Click Create. A JSON file that contains your key downloads to your local environment.\n",
"\n",
"5. Enter the path to your service account key as the GOOGLE_APPLICATION_CREDENTIALS variable in the cell below and run the cell."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "535223fa4b84"
},
"outputs": [],
"source": [
"# If you are running this notebook in Colab, run this cell and follow the\n",
"# instructions to authenticate your GCP account. This provides access to your\n",
"# Cloud Storage bucket and lets you submit training jobs and prediction\n",
"# requests.\n",
"\n",
"import os\n",
"import sys\n",
"\n",
"# If on Vertex AI Workbench, then don't execute this code\n",
"IS_COLAB = \"google.colab\" in sys.modules\n",
"if not os.path.exists(\"/opt/deeplearning/metadata/env_version\") and not os.getenv(\n",
" \"DL_ANACONDA_HOME\"\n",
"):\n",
" if \"google.colab\" in sys.modules:\n",
" from google.colab import auth as google_auth\n",
"\n",
" google_auth.authenticate_user()\n",
"\n",
" # If you are running this notebook locally, replace the string below with the\n",
" # path to your service account key and run this cell to authenticate your GCP\n",
" # account.\n",
" elif not os.getenv(\"IS_TESTING\"):\n",
" %env GOOGLE_APPLICATION_CREDENTIALS ''"
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -291,7 +413,7 @@
"\n",
"**The following steps are required, regardless of your notebook environment.**\n",
"\n",
"When you submit a custom training job using the Vertex SDK, you upload a Python package\n",
"When you submit a custom training job using the Vertex AI SDK, you upload a Python package\n",
"containing your training code to a Cloud Storage bucket. Vertex AI runs\n",
"the code from this package. In this tutorial, Vertex AI also saves the\n",
"trained model that results from your job in the same bucket. You can then\n",
@@ -309,7 +431,8 @@
},
"outputs": [],
"source": [
"BUCKET_NAME = \"gs://[your-bucket-name]\" # @param {type:\"string\"}"
"BUCKET_NAME = \"[your-bucket-name]\" # @param {type:\"string\"}\n",
"BUCKET_URI = f\"gs://{BUCKET_NAME}\""
]
},
{
@@ -320,8 +443,9 @@
},
"outputs": [],
"source": [
"if BUCKET_NAME == \"\" or BUCKET_NAME is None or BUCKET_NAME == \"gs://[your-bucket-name]\":\n",
" BUCKET_NAME = \"gs://\" + PROJECT_ID + \"aip-\" + TIMESTAMP"
"if BUCKET_NAME == \"\" or BUCKET_NAME is None or BUCKET_NAME == \"[your-bucket-name]\":\n",
" BUCKET_NAME = PROJECT_ID + \"aip-\" + TIMESTAMP\n",
" BUCKET_URI = \"gs://\" + BUCKET_NAME"
]
},
{
@@ -341,7 +465,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l $REGION $BUCKET_NAME"
"! gsutil mb -l $REGION $BUCKET_URI"
]
},
{
@@ -361,7 +485,7 @@
},
"outputs": [],
"source": [
"! gsutil ls -al $BUCKET_NAME"
"! gsutil ls -al $BUCKET_URI"
]
},
{
@@ -516,7 +640,7 @@
},
"outputs": [],
"source": [
"aip.init(project=PROJECT_ID, staging_bucket=BUCKET_NAME)"
"aip.init(project=PROJECT_ID, staging_bucket=BUCKET_URI)"
]
},
{
@@ -538,7 +662,7 @@
},
"outputs": [],
"source": [
"bqclient = bigquery.Client()"
"bqclient = bigquery.Client(project=PROJECT_ID)"
]
},
{
@@ -661,6 +785,11 @@
"LIMIT = 300000\n",
"YEAR = 2020\n",
"\n",
"# First, create the dataset entry\n",
"dataset = bigquery.Dataset(f\"{PROJECT_ID}.{BQ_DATASET}\")\n",
"dataset.location = \"US\"\n",
"dataset = bqclient.create_dataset(dataset, timeout=30)\n",
"\n",
"query = f\"\"\"\n",
"CREATE OR REPLACE TABLE `{BQ_TABLE_COPY}`\n",
"AS (\n",
@@ -757,7 +886,7 @@
"dataset = aip.TabularDataset.create(\n",
" display_name=\"Chicago Taxi\" + \"_\" + TIMESTAMP,\n",
" bq_source=[IMPORT_FILE],\n",
" labels={\"user_metadata\": BUCKET_NAME[5:]},\n",
" labels={\"user_metadata\": BUCKET_NAME},\n",
")\n",
"\n",
"label_column = \"tip_bin\"\n",
@@ -949,9 +1078,9 @@
},
"outputs": [],
"source": [
"STATISTICS_SCHEMA = BUCKET_NAME + \"/statistics.jsonl\"\n",
"STATISTICS_SCHEMA = BUCKET_URI + \"/statistics.jsonl\"\n",
"\n",
"tfdv.write_stats_text(stats, BUCKET_NAME + \"/statistics.jsonl\")\n",
"tfdv.write_stats_text(stats, BUCKET_URI + \"/statistics.jsonl\")\n",
"\n",
"with tf.io.gfile.GFile(\n",
" \"gs://\" + dataset.labels[\"user_metadata\"] + \"/metadata.jsonl\", \"r\"\n",
@@ -964,7 +1093,7 @@
") as f:\n",
" json.dump(metadata, f)\n",
"\n",
"!gsutil cat $BUCKET_NAME/metadata.jsonl"
"! gsutil cat $BUCKET_URI/metadata.jsonl"
]
},
{
@@ -1011,7 +1140,7 @@
},
"outputs": [],
"source": [
"SCHEMA_LOCATION = BUCKET_NAME + \"/schema.txt\"\n",
"SCHEMA_LOCATION = BUCKET_URI + \"/schema.txt\"\n",
"\n",
"# When running Apache Beam directly (file is directly accessed)\n",
"tfdv.write_schema_text(output_path=SCHEMA_LOCATION, schema=schema)\n",
@@ -1049,7 +1178,7 @@
") as f:\n",
" json.dump(metadata, f)\n",
"\n",
"!gsutil cat $BUCKET_NAME/metadata.jsonl"
"! gsutil cat $BUCKET_URI/metadata.jsonl"
]
},
{
@@ -1101,7 +1230,7 @@
"import setuptools\n",
"\n",
"REQUIRED_PACKAGES = [\n",
" \"google-cloud-aiplatform==1.4.2\",\n",
" \"google-cloud-aiplatform\",\n",
" \"tensorflow-transform==1.2.0\",\n",
" \"tensorflow-data-validation==1.2.0\",\n",
"]\n",
@@ -1372,10 +1501,10 @@
" )\n",
"\n",
"\n",
"EXPORTED_JSONL_PREFIX = os.path.join(BUCKET_NAME, \"exported_data/jsonl\")\n",
"EXPORTED_TFREC_PREFIX = os.path.join(BUCKET_NAME, \"exported_data/tfrec\")\n",
"TRANSFORMED_DATA_PREFIX = os.path.join(BUCKET_NAME, \"transformed_data\")\n",
"TRANSFORM_ARTIFACTS_DIR = os.path.join(BUCKET_NAME, \"transformed_artifacts\")\n",
"EXPORTED_JSONL_PREFIX = os.path.join(BUCKET_URI, \"exported_data/jsonl\")\n",
"EXPORTED_TFREC_PREFIX = os.path.join(BUCKET_URI, \"exported_data/tfrec\")\n",
"TRANSFORMED_DATA_PREFIX = os.path.join(BUCKET_URI, \"transformed_data\")\n",
"TRANSFORM_ARTIFACTS_DIR = os.path.join(BUCKET_URI, \"transformed_artifacts\")\n",
"\n",
"QUERY_STRING = \"SELECT * FROM {} LIMIT 300000\".format(BQ_TABLE)\n",
"JOB_NAME = \"chicago\" + TIMESTAMP\n",
@@ -1388,7 +1517,7 @@
" \"transform_artifact_dir\": TRANSFORM_ARTIFACTS_DIR,\n",
" \"exported_jsonl_prefix\": EXPORTED_JSONL_PREFIX,\n",
" \"exported_tfrec_prefix\": EXPORTED_TFREC_PREFIX,\n",
" \"temp_location\": os.path.join(BUCKET_NAME, \"temp\"),\n",
" \"temp_location\": os.path.join(BUCKET_URI, \"temp\"),\n",
" \"project\": PROJECT_ID,\n",
" \"region\": REGION,\n",
" \"setup_file\": \"./setup.py\",\n",
@@ -1459,7 +1588,7 @@
") as f:\n",
" json.dump(metadata, f)\n",
"\n",
"!gsutil cat $BUCKET_NAME/metadata.jsonl"
"! gsutil cat $BUCKET_URI/metadata.jsonl"
]
},
{
@@ -1473,17 +1602,9 @@
"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",
"Otherwise, you can delete the individual resources you created in this tutorial.\n",
"\n",
"- Dataset\n",
"- Pipeline\n",
"- Model\n",
"- Endpoint\n",
"- AutoML Training Job\n",
"- Batch Job\n",
"- Custom Job\n",
"- Hyperparameter Tuning Job\n",
"- Cloud Storage Bucket"
"*Note:* stage2/mlops_experimentation is dependent on the resources created by this stage1 notebook."
]
},
{
@@ -1504,8 +1625,8 @@
" except Exception as e:\n",
" print(e)\n",
"\n",
" if \"BUCKET_NAME\" in globals():\n",
" ! gsutil rm -r $BUCKET_NAME"
" if \"BUCKET_URI\" in globals():\n",
" ! gsutil rm -r $BUCKET_URI"
]
}
],
Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

+259 -122
View File
@@ -25,83 +25,20 @@ The second stage in MLOps is experimenting in developing one or more baseline mo
- Use the What-if-Tool (WIT) to explore how the trained model would make predictions in different scenarios.
<img src='stage2.png'>
<img src='stage2v3.png'>
<br/>
<br/>
<br/>
<img src='stage2.2v1.png'>
## Notebooks
### Get Started
[Get Started with Vertex Experiments and Vertex ML Metadata](get_started_vertex_experiments.ipynb)
[Get started with Vertex AI Training for R](community/ml_ops/stage2/get_started_vertex_training_r.ipynb)
```
The steps performed include:
In this tutorial, you learn how to use `Vertex AI Training` for training a R custom model.
- Use Python logging to log training configuration/results locally.
- Use Google Cloud Logging to log training configuration/results in cloud storage.
- Create a Vertex AI `Experiment` resource.
- Instantiate an experiment run.
- Log parameters for the run.
- Log metrics for the run.
- Display the logged experiment run.
```
[Get Started with Vertex TensorBoard](get_started_vertex_tensorboard.ipynb)
```
The steps performed include:
- Create a TensorBoard callback when training a model.
- Using Tensorboard with locally trained model.
- Using Vertex AI TensorBoard with Vertex AI Training.
```
[Get Started with Custom Training Packages (Tensorflow)](get_started_vertex_training.ipynb)
```
The steps performed include:
- Training using a single Python script.
- Training using a Python package.
- Training using a custom training image.
- Laying out a training package.
```
[Get Started with Custom Training Packages (Scikit-Learn)](get_started_vertex_training_sklearn.ipynb)
```
The steps performed include:
- Training using a Python package.
- Report accuracy when hyperparameter tuning.
- Save the model artifacts to Cloud Storage using GCSFuse.
- Create a `Vertex AI Model` resource.
```
[Get Started with Custom Training Packages (XGBoost)](get_started_vertex_training_xgboost.ipynb)
```
The steps performed include:
- Training using a Python package.
- Report accuracy when hyperparameter tuning.
- Save the model artifacts to Cloud Storage using GCSFuse.
- Create a `Vertex AI Model` resource.
```
[Get Started with Custom Training Packages (Pytorch)](get_started_vertex_training_pytorch.ipynb)
```
The steps performed include:
- Single node training using a Python package.
- Report accuracy when hyperparameter tuning.
- Save the model artifacts to Cloud Storage using GCSFuse.
- Create a `Vertex AI Model` resource.
```
[Get Started with Custom Training Packages (R)](get_started_vertex_training_r.ipynb)
```
The steps performed include:
- Locally train an R model in a notebook using %%R magic commands
@@ -113,11 +50,260 @@ The steps performed include:
- Create a R-to-Python training package.
- Create a training image for training the model.
- Train a R model using `Vertex AI Trainingh` service with the R-to-Python training package.
```
[Get Started with Distributed Training](get_started_vertex_distributed_training.ipynb)
[Get started with Logging](community/ml_ops/stage2/get_started_with_logging.ipynb)
In this tutorial, you learn how to use Python and Cloud logging awhen training with `Vertex AI`.
The steps performed include:
- Use Python logging to log training configuration/results locally.
- Use Google Cloud Logging to log training configuration/results in cloud storage.
[Get started with Vertex AI Hyperparameter Tuning for XGBoost] (community/ml_ops/stage2/get_started_vertex_hpt_xgboost.ipynb)
In this tutorial, you learn how to use `Vertex AI Hyperparameter Tuning` for training a XGBoost custom model.
The steps performed include:
- Training using a Python package.
- Report accuracy when hyperparameter tuning.
- Save the model artifacts to Cloud Storage using GCSFuse.
- Create a `Vertex AI Model` resource.
[Get started with Vertex AI Training for XGBoost](community/ml_ops/stage2/get_started_vertex_training_xgboost.ipynb)
In this tutorial, you learn how to use `Vertex AI Training` for training a XGBoost custom model.
The steps performed include:
- Training using a Python package.
- Report accuracy when hyperparameter tuning.
- Save the model artifacts to Cloud Storage using GCSFuse.
- Create a `Vertex AI Model` resource.
[Get started with TabNet builtin algorithm for training tabular models](community/ml_ops/stage2/get_started_with_tabnet.ipynb)
In this notebook, you learn how to run `Vertex AI TabNet` built algorithm for training custom tabular models.
The steps performed include:
- Get the training data.
- Configure training parameters for the `Vertex AI TabNet` container.
- Train the model using `Vertex AI Training` using CSV data.
- Upload the model as a `Vertex AI Model` resource.
- Deploy the `Vertex AI Model` resource to a `Vertex AI Endpoint` resource.
- Make a prediction with the deployed model.
- Hyperparameter tuning the `Vertex AI TabNet` model.
- Train the model using `Vertex AI Training` using BigQuery table.
[Get started with prebuilt TFHub models](community/ml_ops/stage2/get_started_with_tfhub_models.ipynb)
In this tutorial, you learn how to use `Vertex AI Training` with prebuilt models from TensorFlow Hub.
The steps performed include:
- Download a TensorFlow Hub prebuilt model.
- Add the task component as a classifier for the CIFAR-10 dataset.
- Fine tune locally the model with transfer learning training.
- Construct a custom training script:
- Get training data from TensorFlow Datasets
- Get model architecture from TensorFlow Hub
- Train then model
- Save model artifacts and upload as Vertex AI Model resource.
[Get started with BigQuery ML Training](community/ml_ops/stage2/get_started_bqml_training.ipynb)
In this tutorial, you learn how to use `BigQueryML` (BQML) for training with `Vertex AI`.
The steps performed include:
- Create a local BigQuery table in your project
- Train a BQML model
- Evaluate the BQML model
- Export the BQML model as a cloud model
- Upload the exported model as a `Vertex AI Model` resource
- Hyperparameter tune a BQML model with `Vertex AI Vizier`
- Automatically register a BQML model to `Vertex AI Model Registry`
[Get started with Vertex AI Vizier](community/ml_ops/stage2/get_started_vertex_vizier.ipynb)
In this tutorial, you learn how to use `Vertex AI Vizier` for when training with `Vertex AI`.
The steps performed include:
- Hyperparameter tuning with Random algorithm.
- Hyperparameter tuning with Vizier (Bayesian) algorithm.
- Suggesting trials and updating results for Vizier study
[Get started with distributed training using DASK](community/ml_ops/stage2/get_started_with_distributed_training_xgboost.ipynb)
In this tutorial, you learn how to use `Vertex AI Training` for distributed training of XGBoost model using the OSS package DASK. Additionally, you learn to construct and deploy a custom serving container using a Flask web server.
The steps performed include:
- Construct an XGBoost training script using DASK for distributed training.
- Construct a custom training container.
- Configure a distributed custom training job.
- Execute the custom training job.
- Construct a custom serving container using Flask.
- Upload the trained XGBoost model as a `Vertex AI Model` resource.
- Create a `Vertex AI Endpoint` resource.
- Deploy the `Vertex AI Model` resource to `Vertex AI Endpoint` resource.
- Make a prediction.
[Get started with Vertex AI TensorBoard](community/ml_ops/stage2/get_started_vertex_tensorboard.ipynb)
In this tutorial, you learn how to use `Vertex AI TensorBoard` when training with `Vertex AI`.
The steps performed include:
- Create a TensorBoard callback when training a model.
- Using TensorBoard with locally trained model.
- Using Vertex AI TensorBoard with Vertex AI Training.
[Get started with Vertex AI Training for R using R Kernel](community/ml_ops/stage2/get_started_vertex_training_r_using_r_kernel.ipynb)
In this tutorial, you learn how to use `Vertex AI`, using an R kernel, for training and deploying an R custom model.
The steps performed include:
- Create a custom R training script
- Create a custom R serving script
- Create a custom R deployment (serving) container.
- Train the model using `Vertex AI` custom training.
- Create an `Endpoint` resouce.
- Deploy the `Model` resource (trained R model) to the `Endpoint` resource.
- Make an online prediction.
[Get started Vision API test preprocessing and AutoML text model generation](community/ml_ops/stage2/get_started_with_visionapi_and_automl.ipynb)
In this tutorial, you create an `AutoML` text entity extraction model pre-existing extracted data by generating a custom import file. You deploy this mode for online prediction from a Python script using the `BigQuery`, `Vision AI`, Cloud Storage and `Vertex AI SDK` for Python.
The steps performed include:
- Preprocess training files using `Vision AI` APIs to extract the text from PDF files.
- Create a custom import file that includes annotation data based on the sample `BigQuery` dataset.
- Create a `Vertex AI Dataset` resource.
- Train the model.
- View the model evaluation.
- Deploy the `Vertex AI Model` resource to a serving `Endpoint` resource.
- Make a prediction.
- Undeploy the `Model`.
[Get started with Vertex AI Experiments](community/ml_ops/stage2/get_started_vertex_experiments.ipynb)
In this tutorial, you learn how to use `Vertex AI Experiments` when training with `Vertex AI`.
The steps performed include:
- Local (notebook) Training
- Create an experiment
- Create a first run in the experiment
- Log parameters and metrics
- Create artifact lineage
- Visualize the experiment results
- Execute a second run
- Compare the two runs in the experiment
- Cloud (`Vertex AI`) Training
- Within the training script:
- Create an experiment
- Log parameters and metrics
- Create artifact lineage
- Create a `Vertex AI Training` custom job
- Execute the custom job
- Visualize the experiment results
[AutoML Image Classfication Training with Customer Managed Encryption Keys (CMEK)](community/ml_ops/stage2/get_started_with_cmek_training.ipynb)
In this tutorial, you learn how to use a customer managed encryption key (CMEK) for `Vertex AI AutoML` training.
The steps performed include:
- Creating a customer managed encryption key.
- Creating an image dataset with CMEK encryption.
- Train an AutoML model with CMEK encryption.
[Get started with Vertex AI Feature Store](community/ml_ops/stage2/get_started_vertex_feature_store.ipynb)
In this tutorial, you learn how to use `Vertex AI Feature Store` when training and predicting with `Vertex AI`.
The steps performed include:
- Creating a Vertex AI `Featurestore` resource.
- Creating `EntityType` resources for the `Featurestore` resource.
- Creating `Feature` resources for each `EntityType` resource.
- Import feature values (entity data items) into `Featurestore` resource.
- From a Cloud Storage location.
- From a pandas DataFrame.
- Perform online serving from a `Featurestore` resource.
- Perform batch serving from a `Featurestore` resource.
[Get started with AutoML Training](community/ml_ops/stage2/get_started_automl_training.ipynb)
In this tutorial, you learn how to use `AutoML` for training with `Vertex AI`.
The steps performed include:
- Train an image model
- Export the image model as an edge model
- Train a tabular model
- Export the tabular model as a cloud model
- Train a text model
- Train a video model
[Get started with Vertex AI Training for LightGBM](community/ml_ops/stage2/get_started_vertex_training_lightgbm.ipynb)
In this tutorial, you learn how to use `Vertex AI Training` for training a LightGBM custom model.
The steps performed include:
- Training using a Python package.
- Save the model artifacts to Cloud Storage using GCSFuse.
- Construct a FastAPI prediction server.
- Construct a Dockerfile deployment image.
- Test the deployment image locally.
- Create a `Vertex AI Model` resource.
[Get started with Vertex AI Training for Scikit-Learn](community/ml_ops/stage2/get_started_vertex_training_sklearn.ipynb)
In this tutorial, you learn how to use `Vertex AI Training` for training a Scikit-Learn custom model.
The steps performed include:
- Training using a Python package.
- Report accuracy when hyperparameter tuning.
- Save the model artifacts to Cloud Storage using GCSFuse.
- Create a `Vertex AI Model` resource.
[Get started with Vertex AI Training](community/ml_ops/stage2/get_started_vertex_training.ipynb)
In this tutorial, you learn how to use `Vertex AI Training` for custom models when training with `Vertex AI`.
The steps performed include:
- Training using a single Python script.
- Training using a Python package.
- Training using a custom training image.
- Laying out a training package.
[Get started with Vertex AI Training for Pytorch](community/ml_ops/stage2/get_started_vertex_training_pytorch.ipynb)
In this tutorial, you learn how to use `Vertex AI Training` for training a Pytorch custom model.
The steps performed include:
- Single node training using a Python package.
- Report accuracy when hyperparameter tuning.
- Save the model artifacts to Cloud Storage using GCSFuse.
- Create a `Vertex AI Model` resource.
[Get started with Vertex AI Distributed Training](community/ml_ops/stage2/get_started_vertex_distributed_training.ipynb)
In this tutorial, you learn how to use `Vertex AI Distributed Training` for when training with `Vertex AI`.
```
The steps performed include:
- `MirroredStrategy`: Train on a single VM with multiple GPUs.
@@ -125,54 +311,6 @@ The steps performed include:
- `MultiWorkerMirroredStrategy`: Train on multiple VMs with fine grain control of replicas.
- `ReductionServer`: Train on multiple VMS and sync updates across VMS with `Vertex AI Reduction Server`.
- `TPUTraining`: Train with multiple Cloud TPUs.
```
[Get Started with Vizier Hyperparameter Tuning](get_started_vertex_vizier.ipynb)
```
The steps performed include:
- Hyperparameter tuning with Random algorithm.
- Hyperparameter tuning with Vizier (Bayesian) algorithm.
```
[Get Started with AutoML Training](get_started_automl_training.ipynb)
```
The steps performed include:
- Train an image model.
- Export the image model as an edge model.
- Train a tabular model.
- Export the tabular model as a cloud model.
- Train a text model.
```
[Get Started with BQML Training](get_started_bqml_training.ipynb)
```
The steps performed include:
- Create a local BQ table in your project.
- Train a BQML model.
- Evaluate the BQML model.
- Export the BQML model as a cloud model.
- Upload the exported model as a Vertex AI Model resource.
- Hyperparameter tune a BQML model with Vertex AI Vizier.
```
[Get Started with Vertex Feature Store](get_started_vertex_feature_store.ipynb)
```
The steps performed include:
- Creating a Vertex AI `Featurestore` resource.
- Creating `EntityType` resources for the `Featurestore` resource.
- Creating `Feature` resources for each `EntityType` resource.
- Import feature values (entity data items) into `Featurestore` resource.
- Perform online serving from a `Featurestore` resource.
- Perform batch serving from a `Featurestore` resource.
```
### E2E Stage Example
@@ -180,7 +318,6 @@ The steps performed include:
```
The steps performed include:
- Review the `Dataset` resource created during stage 1.
- Train an AutoML tabular binary classifier model in the background.
- Build the experimental model architecture.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -8,7 +8,7 @@
},
"outputs": [],
"source": [
"# Copyright 2021 Google LLC\n",
"# Copyright 2022 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",
@@ -29,9 +29,14 @@
"id": "title:generic,gcp"
},
"source": [
"# E2E ML on GCP: MLOps stage 2 : experimentation: get started with Vertex Distributed Training\n",
"# E2E ML on GCP: MLOps stage 2 : experimentation: get started with Vertex AI Distributed Training\n",
"\n",
"<table align=\"left\">\n",
" <td>\n",
" <a href=\"https://colab.research.google.com/github/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/ml_ops/stage2/get_started_vertex_distributed_training.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/ml_ops/stage2/get_started_vertex_distributed_training.ipynb\">\n",
" <img src=\"https://cloud.google.com/ml-engine/images/github-logo-32px.png\" alt=\"GitHub logo\">\n",
@@ -39,8 +44,9 @@
" </a>\n",
" </td>\n",
" <td>\n",
" <a href=\"https://console.cloud.google.com/ai/platform/notebooks/deploy-notebook?download_url=https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/ml_ops/stage2/get_started_vertex_distributed_training.ipynb\">\n",
" Open in Google Cloud Notebooks\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/community/ml_ops/stage2/get_started_vertex_distributed_training.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>\n",
@@ -56,18 +62,7 @@
"## Overview\n",
"\n",
"\n",
"This tutorial demonstrates how to use Vertex AI for E2E MLOps on Google Cloud in production. This tutorial covers stage 2 : experimentation: get started with Vertex Distributed Training."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "dataset:custom,boston,lrg"
},
"source": [
"### Dataset\n",
"\n",
"The dataset used for this tutorial is the [Boston Housing Prices dataset](https://www.cs.toronto.edu/~delve/data/boston/bostonDetail.html). The version of the dataset you will use in this tutorial is built into TensorFlow. The trained model predicts the median price of a house in units of 1K USD."
"This tutorial demonstrates how to use Vertex AI for E2E MLOps on Google Cloud in production. This tutorial covers stage 2 : experimentation: get started with Vertex Distributed Training. Please note: There are incompatibilities between Colab and Docker and the Docker section may not work until resolved by the platform."
]
},
{
@@ -126,59 +121,86 @@
{
"cell_type": "markdown",
"metadata": {
"id": "install_mlops"
"id": "dataset:custom,boston,lrg"
},
"source": [
"## Installations\n",
"### Dataset\n",
"\n",
"Install *one time* the packages for executing the MLOps notebooks."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "install_mlops"
},
"outputs": [],
"source": [
"ONCE_ONLY = False\n",
"if ONCE_ONLY:\n",
" ! pip3 install -U tensorflow==2.5 $USER_FLAG\n",
" ! pip3 install -U tensorflow-data-validation==1.2 $USER_FLAG\n",
" ! pip3 install -U tensorflow-transform==1.2 $USER_FLAG\n",
" ! pip3 install -U tensorflow-io==0.18 $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-aiplatform[tensorboard] $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-pipeline-components $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-bigquery $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-logging $USER_FLAG\n",
" ! pip3 install --upgrade apache-beam[gcp] $USER_FLAG\n",
" ! pip3 install --upgrade pyarrow $USER_FLAG\n",
" ! 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"
"The dataset used for this tutorial is the [Boston Housing Prices dataset](https://www.cs.toronto.edu/~delve/data/boston/bostonDetail.html). The version of the dataset you use in this tutorial is built into TensorFlow. The trained model predicts the median price of a house in units of 1K USD."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "restart"
"id": "d10166df7141"
},
"source": [
"### Restart the kernel\n",
"### Costs\n",
" \n",
"This tutorial uses billable components of Google Cloud:\n",
"\n",
"Once you've installed the additional packages, you need to restart the notebook kernel so it can find the packages."
"Vertex AI\n",
"Cloud Storage\n",
"\n",
"Learn about [Vertex AI pricing](https://cloud.google.com/vertex-ai/pricing) and [Cloud Storage pricing](https://cloud.google.com/storage/pricing), 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": "XkYpRvOQyVYb"
},
"source": [
"## Installation\n",
"\n",
"Install the packages required for executing this notebook."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "restart"
"id": "xs_Kt8RcyXTC"
},
"outputs": [],
"source": [
"import os\n",
"\n",
"# The Vertex AI Workbench Notebook product has specific requirements\n",
"IS_WORKBENCH_NOTEBOOK = os.getenv(\"DL_ANACONDA_HOME\") and not os.getenv(\"VIRTUAL_ENV\")\n",
"IS_USER_MANAGED_WORKBENCH_NOTEBOOK = os.path.exists(\n",
" \"/opt/deeplearning/metadata/env_version\"\n",
")\n",
"\n",
"# Vertex AI Notebook requires dependencies to be installed with '--user'\n",
"USER_FLAG = \"\"\n",
"if IS_WORKBENCH_NOTEBOOK:\n",
" USER_FLAG = \"--user\"\n",
"\n",
"! pip3 install {USER_FLAG} --upgrade google-cloud-aiplatform -q"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "oQhwq1iozAxh"
},
"source": [
"### Restart the kernel\n",
"\n",
"After you install the additional packages, you need to restart the notebook kernel so it can find the packages."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "zo3YFZXLzCRJ"
},
"outputs": [],
"source": [
"# Automatically restart kernel after installs\n",
"import os\n",
"\n",
"if not os.getenv(\"IS_TESTING\"):\n",
@@ -189,6 +211,32 @@
" app.kernel.do_shutdown(True)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "84cd83853240"
},
"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",
"1. [Make sure that billing is enabled for your project](https://cloud.google.com/billing/docs/how-to/modify-project).\n",
"\n",
"1. [Enable the Vertex AI, BigQuery, Compute Engine and Cloud Storage APIs](https://console.cloud.google.com/flows/enableapi?apiid=aiplatform.googleapis.com,bigquery,compute_component,storage_component).\n",
"\n",
"1. If you are running this notebook locally, you need to install the [Cloud SDK](https://cloud.google.com/sdk).\n",
"\n",
"1. Enter your project ID in the cell below. Then run the cell to make sure the\n",
"Cloud SDK uses the right project for all the commands in this notebook.\n",
"\n",
"**Note**: Jupyter runs lines prefixed with `!` as shell commands, and it interpolates Python variables prefixed with `$` into these commands."
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -261,11 +309,14 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "region"
"id": "qohAA9fJulvP"
},
"outputs": [],
"source": [
"REGION = \"us-central1\" # @param {type: \"string\"}"
"REGION = \"[your-region]\" # @param {type: \"string\"}\n",
"\n",
"if REGION == \"[your-region]\":\n",
" REGION = \"us-central1\""
]
},
{
@@ -283,7 +334,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "timestamp"
"id": "8NKwwe7aulvQ"
},
"outputs": [],
"source": [
@@ -292,6 +343,82 @@
"TIMESTAMP = datetime.now().strftime(\"%Y%m%d%H%M%S\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "poKeKYG8ulvQ"
},
"source": [
"### Authenticate your Google Cloud account\n",
"\n",
"**If you are using Vertex AI Workbench Notebooks**, your environment is already\n",
"authenticated. Skip this step."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "MIpJGzF9ulvQ"
},
"source": [
"**If you are using Colab**, run the cell below and follow the instructions\n",
"when prompted to authenticate your account via oAuth.\n",
"\n",
"**Otherwise**, follow these steps:\n",
"\n",
"1. In the Cloud Console, go to the [**Create service account key**\n",
" page](https://console.cloud.google.com/apis/credentials/serviceaccountkey).\n",
"\n",
"2. Click **Create service account**.\n",
"\n",
"3. In the **Service account name** field, enter a name, and\n",
" click **Create**.\n",
"\n",
"4. In the **Grant this service account access to project** section, click the **Role** drop-down list. Type \"Vertex AI\"\n",
"into the filter box, and select\n",
" **Vertex AI Administrator**. Type \"Storage Object Admin\" into the filter box, and select **Storage Object Admin**.\n",
"\n",
"5. Click *Create*. A JSON file that contains your key downloads to your\n",
"local environment.\n",
"\n",
"6. Enter the path to your service account key as the\n",
"`GOOGLE_APPLICATION_CREDENTIALS` variable in the cell below and run the cell."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "Vh6KDXB5ulvQ"
},
"outputs": [],
"source": [
"# If you are running this notebook in Colab, run this cell and follow the\n",
"# instructions to authenticate your GCP account. This provides access to your\n",
"# Cloud Storage bucket and lets you submit training jobs and prediction\n",
"# requests.\n",
"\n",
"import os\n",
"import sys\n",
"\n",
"# If on Vertex AI Workbench, then don't execute this code\n",
"IS_COLAB = False\n",
"if not os.path.exists(\"/opt/deeplearning/metadata/env_version\") and not os.getenv(\n",
" \"DL_ANACONDA_HOME\"\n",
"):\n",
" if \"google.colab\" in sys.modules:\n",
" IS_COLAB = True\n",
" from google.colab import auth as google_auth\n",
"\n",
" google_auth.authenticate_user()\n",
"\n",
" # If you are running this notebook locally, replace the string below with the\n",
" # path to your service account key and run this cell to authenticate your GCP\n",
" # account.\n",
" elif not os.getenv(\"IS_TESTING\"):\n",
" %env GOOGLE_APPLICATION_CREDENTIALS ''"
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -315,7 +442,8 @@
},
"outputs": [],
"source": [
"BUCKET_NAME = \"gs://[your-bucket-name]\" # @param {type:\"string\"}"
"BUCKET_NAME = \"[your-bucket-name]\" # @param {type:\"string\"}\n",
"BUCKET_URI = f\"gs://{BUCKET_NAME}\""
]
},
{
@@ -326,8 +454,9 @@
},
"outputs": [],
"source": [
"if BUCKET_NAME == \"\" or BUCKET_NAME is None or BUCKET_NAME == \"gs://[your-bucket-name]\":\n",
" BUCKET_NAME = \"gs://\" + PROJECT_ID + \"aip-\" + TIMESTAMP"
"if BUCKET_NAME == \"\" or BUCKET_NAME is None or BUCKET_NAME == \"[your-bucket-name]\":\n",
" BUCKET_NAME = PROJECT_ID + \"aip-\" + TIMESTAMP\n",
" BUCKET_URI = f\"gs://{BUCKET_NAME}\""
]
},
{
@@ -343,11 +472,11 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "create_bucket"
"id": "Moosy2rOulvR"
},
"outputs": [],
"source": [
"! gsutil mb -l $REGION $BUCKET_NAME"
"! gsutil mb -l $REGION $BUCKET_URI"
]
},
{
@@ -363,11 +492,11 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "validate_bucket"
"id": "56irx2CvulvS"
},
"outputs": [],
"source": [
"! gsutil ls -al $BUCKET_NAME"
"! gsutil ls -al $BUCKET_URI"
]
},
{
@@ -408,11 +537,11 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "init_aip:mbsdk"
"id": "wbvYPSTDulvS"
},
"outputs": [],
"source": [
"aip.init(project=PROJECT_ID, staging_bucket=BUCKET_NAME)"
"aip.init(project=PROJECT_ID, staging_bucket=BUCKET_URI)"
]
},
{
@@ -441,7 +570,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "accelerators:training,prediction,ngpu,mbsdk"
"id": "PryARdnoulvT"
},
"outputs": [],
"source": [
@@ -483,14 +612,14 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "container:training,prediction"
"id": "LhhUFw2nulvT"
},
"outputs": [],
"source": [
"if os.getenv(\"IS_TESTING_TF\"):\n",
" TF = os.getenv(\"IS_TESTING_TF\")\n",
"else:\n",
" TF = \"2.1\".replace(\".\", \"-\")\n",
" TF = \"2.5\".replace(\".\", \"-\")\n",
"\n",
"if TF[0] == \"2\":\n",
" if TRAIN_GPU:\n",
@@ -551,7 +680,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "machine:training"
"id": "vytMaukeulvT"
},
"outputs": [],
"source": [
@@ -613,7 +742,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "create_custom_pp_training_job:mbsdk"
"id": "mhw34XoOulvU"
},
"outputs": [],
"source": [
@@ -621,7 +750,7 @@
"\n",
"job = aip.CustomPythonPackageTrainingJob(\n",
" display_name=DISPLAY_NAME,\n",
" python_package_gcs_uri=f\"{BUCKET_NAME}/trainer_boston.tar.gz\",\n",
" python_package_gcs_uri=f\"{BUCKET_URI}/trainer_boston.tar.gz\",\n",
" python_module_name=\"trainer.task\",\n",
" container_uri=TRAIN_IMAGE,\n",
" model_serving_container_image_uri=DEPLOY_IMAGE,\n",
@@ -662,7 +791,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "examine_training_package"
"id": "IAaZpZyyulvU"
},
"outputs": [],
"source": [
@@ -711,7 +840,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "taskpy_contents:mirrored,boston"
"id": "zKzddzl6ulvV"
},
"outputs": [],
"source": [
@@ -767,6 +896,13 @@
" strategy = tf.distribute.MultiWorkerMirroredStrategy()\n",
" logging.info(\"Multi-worker Strategy distributed training\")\n",
" logging.info('TF_CONFIG = {}'.format(os.environ.get('TF_CONFIG', 'Not found')))\n",
" # Single Machine, multiple TPU devices\n",
"elif args.distribute == 'tpu':\n",
" cluster_resolver = tf.distribute.cluster_resolver.TPUClusterResolver(tpu=\"local\")\n",
" tf.config.experimental_connect_to_cluster(cluster_resolver)\n",
" tf.tpu.experimental.initialize_tpu_system(cluster_resolver)\n",
" strategy = tf.distribute.TPUStrategy(cluster_resolver)\n",
" print(\"All devices: \", tf.config.list_logical_devices('TPU'))\n",
"\n",
"logging.info('num_replicas_in_sync = {}'.format(strategy.num_replicas_in_sync))\n",
"\n",
@@ -825,8 +961,11 @@
" else:\n",
" task_type, task_id = None, None\n",
"\n",
" if args.distribute==\"tpu\":\n",
" save_locally = tf.saved_model.SaveOptions(experimental_io_device='/job:localhost')\n",
" model.save(args.model_dir, options=save_locally)\n",
" # single, mirrored or primary for multiworker\n",
" if _is_chief(task_type, task_id):\n",
" elif _is_chief(task_type, task_id):\n",
" model.save(args.model_dir)\n",
" # non-primary workers for multi-workers\n",
" else:\n",
@@ -860,14 +999,14 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "tarball_training_script"
"id": "LFUHioqTulvV"
},
"outputs": [],
"source": [
"! rm -f custom.tar custom.tar.gz\n",
"! tar cvf custom.tar custom\n",
"! gzip custom.tar\n",
"! gsutil cp custom.tar.gz $BUCKET_NAME/trainer_boston.tar.gz"
"! gsutil cp custom.tar.gz $BUCKET_URI/trainer_boston.tar.gz"
]
},
{
@@ -885,11 +1024,11 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "run_custom_pp_training_job:mirrored"
"id": "LnUX0UkvulvV"
},
"outputs": [],
"source": [
"MODEL_DIR = BUCKET_NAME\n",
"MODEL_DIR = BUCKET_URI\n",
"\n",
"CMDARGS = [\"--epochs=5\", \"--batch_size=16\", \"--distribute=mirrored\"]\n",
"\n",
@@ -920,7 +1059,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "delete_job"
"id": "iUWHFpPoulvW"
},
"outputs": [],
"source": [
@@ -942,7 +1081,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "model_delete:mbsdk"
"id": "-0gqCUTEulvW"
},
"outputs": [],
"source": [
@@ -1027,7 +1166,7 @@
{
"cell_type": "markdown",
"metadata": {
"id": "create_custom_pp_training_job:mbsdk"
"id": "aXvPN8P6ulvX"
},
"source": [
"### Create and run custom training job\n",
@@ -1053,7 +1192,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "create_custom_pp_training_job:mbsdk"
"id": "kYcFsVSEulvX"
},
"outputs": [],
"source": [
@@ -1061,7 +1200,7 @@
"\n",
"job = aip.CustomPythonPackageTrainingJob(\n",
" display_name=DISPLAY_NAME,\n",
" python_package_gcs_uri=f\"{BUCKET_NAME}/trainer_boston.tar.gz\",\n",
" python_package_gcs_uri=f\"{BUCKET_URI}/trainer_boston.tar.gz\",\n",
" python_module_name=\"trainer.task\",\n",
" container_uri=TRAIN_IMAGE,\n",
" model_serving_container_image_uri=DEPLOY_IMAGE,\n",
@@ -1084,11 +1223,11 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "run_custom_pp_training_job:multiworker"
"id": "GHRxPU32ulvX"
},
"outputs": [],
"source": [
"MODEL_DIR = BUCKET_NAME\n",
"MODEL_DIR = BUCKET_URI\n",
"\n",
"CMDARGS = [\"--epochs=5\", \"--batch_size=16\", \"--distribute=multiworker\"]\n",
"\n",
@@ -1111,7 +1250,7 @@
{
"cell_type": "markdown",
"metadata": {
"id": "delete_job"
"id": "92D_hbuVulvX"
},
"source": [
"### Delete a custom training job\n",
@@ -1123,7 +1262,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "delete_job"
"id": "CqrfWkB3ulvX"
},
"outputs": [],
"source": [
@@ -1175,14 +1314,13 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "write_docker_file:training,multiworker"
"id": "pGI2viDAulvY"
},
"outputs": [],
"source": [
"%%writefile custom/Dockerfile\n",
"\n",
"FROM gcr.io/deeplearning-platform-release/tf2-gpu.2-5\n",
"WORKDIR /root\n",
"\n",
"WORKDIR /\n",
"\n",
@@ -1208,7 +1346,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "name_container:training"
"id": "7P8cdlFtulvY"
},
"outputs": [],
"source": [
@@ -1228,11 +1366,15 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "build_container:training"
"id": "jmw5cakNulvY"
},
"outputs": [],
"source": [
"! docker build custom -t $TRAIN_IMAGE"
"if not IS_COLAB:\n",
" ! docker build custom -t $TRAIN_IMAGE\n",
"else:\n",
" # install docker daemon\n",
" ! apt-get -qq install docker.io"
]
},
{
@@ -1250,11 +1392,12 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "test_container:training"
"id": "jJGLjU-TulvZ"
},
"outputs": [],
"source": [
"! docker run $TRAIN_IMAGE --epochs=5 --model-dir=./"
"if not IS_COLAB:\n",
" ! docker run $TRAIN_IMAGE --epochs=5 --model-dir=./"
]
},
{
@@ -1272,11 +1415,42 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "register_container:training"
"id": "GAXGjae7ulvZ"
},
"outputs": [],
"source": [
"! docker push $TRAIN_IMAGE"
"if not IS_COLAB:\n",
" ! docker push $TRAIN_IMAGE"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "f50e9c553fb7"
},
"source": [
"*Executes in Colab*"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "a7e8c98f1e56"
},
"outputs": [],
"source": [
"%%bash -s $IS_COLAB $TRAIN_IMAGE\n",
"if [ $1 == \"False\" ]; then\n",
" exit 0\n",
"fi\n",
"set -x\n",
"dockerd -b none --iptables=0 -l warn &\n",
"for i in $(seq 5); do [ ! -S \"/var/run/docker.sock\" ] && sleep 2 || break; done\n",
"docker build custom -t $2\n",
"docker run $2 --epochs=5 --model-dir=./\n",
"docker push $2\n",
"kill $(jobs -p)"
]
},
{
@@ -1296,13 +1470,13 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "worker_pool_primary"
"id": "CEAnXBzCulvZ"
},
"outputs": [],
"source": [
"PRIMARY_COMPUTE = \"n2-highcpu-64\"\n",
"\n",
"MODEL_DIR = BUCKET_NAME\n",
"MODEL_DIR = BUCKET_URI\n",
"\n",
"CMDARGS = [\n",
" \"--model-dir=\" + MODEL_DIR,\n",
@@ -1339,7 +1513,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "worker_pool_training"
"id": "6dchPSfNulvZ"
},
"outputs": [],
"source": [
@@ -1375,7 +1549,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "custom_job:worker_pool"
"id": "m2VgmqEOulva"
},
"outputs": [],
"source": [
@@ -1399,7 +1573,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "run_custom_job:multiworker"
"id": "hg8vnI_Wulva"
},
"outputs": [],
"source": [
@@ -1413,7 +1587,7 @@
{
"cell_type": "markdown",
"metadata": {
"id": "delete_job"
"id": "WT76Sc-culva"
},
"source": [
"### Delete a custom training job\n",
@@ -1425,7 +1599,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "delete_job"
"id": "I_IxVfuDulva"
},
"outputs": [],
"source": [
@@ -1474,7 +1648,7 @@
{
"cell_type": "markdown",
"metadata": {
"id": "custom_job:worker_pool"
"id": "L8Av8ATVulvb"
},
"source": [
"### Create CustomJob with worker pool specifications\n",
@@ -1490,7 +1664,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "custom_job:worker_pool"
"id": "TUWEP1Lmulvb"
},
"outputs": [],
"source": [
@@ -1502,7 +1676,7 @@
{
"cell_type": "markdown",
"metadata": {
"id": "run_custom_job:multiworker"
"id": "_95FH8jeulvb"
},
"source": [
"### Run the CustomJob\n",
@@ -1514,7 +1688,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "run_custom_job:multiworker"
"id": "IEbrY05Gulvb"
},
"outputs": [],
"source": [
@@ -1528,7 +1702,7 @@
{
"cell_type": "markdown",
"metadata": {
"id": "delete_job"
"id": "8R2Bnmwmulvb"
},
"source": [
"### Delete a custom training job\n",
@@ -1540,7 +1714,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "delete_job"
"id": "s1geVE3Lulvb"
},
"outputs": [],
"source": [
@@ -1583,14 +1757,14 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "docker_write:tpu"
"id": "nQVPtknpulvb"
},
"outputs": [],
"source": [
"%%writefile custom/Dockerfile\n",
"FROM python:3.8\n",
"\n",
"WORKDIR /root\n",
"WORKDIR /\n",
"\n",
"# Copies the trainer code to the docker image.\n",
"COPY trainer /trainer\n",
@@ -1622,11 +1796,11 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "docker_push:tpu"
"id": "J_d_zEXUulvc"
},
"outputs": [],
"source": [
"TRAIN_IMAGE = f\"gcr.io/\" + PROJECT_ID + \"/tpu-train:latest\"\n",
"TRAIN_IMAGE = \"gcr.io/\" + PROJECT_ID + \"/tpu-train:latest\"\n",
"\n",
"os.chdir(\"custom\")\n",
"! docker build --quiet --tag={TRAIN_IMAGE} .\n",
@@ -1653,7 +1827,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "worker_pool_tpu"
"id": "d514eU7lulvc"
},
"outputs": [],
"source": [
@@ -1701,7 +1875,7 @@
{
"cell_type": "markdown",
"metadata": {
"id": "custom_job:worker_pool"
"id": "RruSqNfrulvc"
},
"source": [
"### Create CustomJob with worker pool specifications\n",
@@ -1717,7 +1891,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "custom_job:worker_pool"
"id": "2QvSqbbHulvc"
},
"outputs": [],
"source": [
@@ -1729,7 +1903,7 @@
{
"cell_type": "markdown",
"metadata": {
"id": "run_custom_job:multiworker"
"id": "Iw4L3UIfulvd"
},
"source": [
"### Run the CustomJob\n",
@@ -1741,7 +1915,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "run_custom_job:multiworker"
"id": "zmqCNS78ulvd"
},
"outputs": [],
"source": [
@@ -1755,7 +1929,7 @@
{
"cell_type": "markdown",
"metadata": {
"id": "delete_job"
"id": "gWZoH9QKulvd"
},
"source": [
"### Delete a custom training job\n",
@@ -1767,7 +1941,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "delete_job"
"id": "Lt8BJ4iBulvd"
},
"outputs": [],
"source": [
@@ -1787,13 +1961,7 @@
"\n",
"Otherwise, you can delete the individual resources you created in this tutorial:\n",
"\n",
"- Dataset\n",
"- Pipeline\n",
"- Model\n",
"- Endpoint\n",
"- Batch Job\n",
"- Custom Job\n",
"- Hyperparameter Tuning Job\n",
"\n",
"- Cloud Storage Bucket"
]
},
@@ -1801,70 +1969,15 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "cleanup"
"id": "U98Wzc01ulvd"
},
"outputs": [],
"source": [
"delete_dataset = True\n",
"delete_pipeline = True\n",
"delete_model = True\n",
"delete_endpoint = True\n",
"delete_batchjob = True\n",
"delete_customjob = True\n",
"delete_hptjob = True\n",
"delete_bucket = True\n",
"# Set this to true only if you'd like to delete your bucket\n",
"delete_bucket = False\n",
"\n",
"# Delete the dataset using the Vertex fully qualified identifier for the dataset\n",
"try:\n",
" if delete_dataset and \"dataset_id\" in globals():\n",
" clients[\"dataset\"].delete_dataset(name=dataset_id)\n",
"except Exception as e:\n",
" print(e)\n",
"\n",
"# Delete the training pipeline using the Vertex fully qualified identifier for the pipeline\n",
"try:\n",
" if delete_pipeline and \"pipeline_id\" in globals():\n",
" clients[\"pipeline\"].delete_training_pipeline(name=pipeline_id)\n",
"except Exception as e:\n",
" print(e)\n",
"\n",
"# Delete the model using the Vertex fully qualified identifier for the model\n",
"try:\n",
" if delete_model and \"model_to_deploy_id\" in globals():\n",
" clients[\"model\"].delete_model(name=model_to_deploy_id)\n",
"except Exception as e:\n",
" print(e)\n",
"\n",
"# Delete the endpoint using the Vertex fully qualified identifier for the endpoint\n",
"try:\n",
" if delete_endpoint and \"endpoint_id\" in globals():\n",
" clients[\"endpoint\"].delete_endpoint(name=endpoint_id)\n",
"except Exception as e:\n",
" print(e)\n",
"\n",
"# Delete the batch job using the Vertex fully qualified identifier for the batch job\n",
"try:\n",
" if delete_batchjob and \"batch_job_id\" in globals():\n",
" clients[\"job\"].delete_batch_prediction_job(name=batch_job_id)\n",
"except Exception as e:\n",
" print(e)\n",
"\n",
"# Delete the custom job using the Vertex fully qualified identifier for the custom job\n",
"try:\n",
" if delete_customjob and \"job_id\" in globals():\n",
" clients[\"job\"].delete_custom_job(name=job_id)\n",
"except Exception as e:\n",
" print(e)\n",
"\n",
"# Delete the hyperparameter tuning job using the Vertex fully qualified identifier for the hyperparameter tuning job\n",
"try:\n",
" if delete_hptjob and \"hpt_job_id\" in globals():\n",
" clients[\"job\"].delete_hyperparameter_tuning_job(name=hpt_job_id)\n",
"except Exception as e:\n",
" print(e)\n",
"\n",
"if delete_bucket and \"BUCKET_NAME\" in globals():\n",
" ! gsutil rm -r $BUCKET_NAME"
"if delete_bucket or os.getenv(\"IS_TESTING\"):\n",
" ! gsutil rm -r $BUCKET_URI"
]
}
],
File diff suppressed because it is too large Load Diff
@@ -29,7 +29,7 @@
"id": "title:generic,gcp"
},
"source": [
"# E2E ML on GCP: MLOps stage 2 : experimentation: get started with Feature Store\n",
"# E2E ML on GCP: MLOps stage 2 : experimentation: get started with Vertex AI Feature Store\n",
"\n",
"<table align=\"left\">\n",
" <td>\n",
@@ -38,11 +38,20 @@
" View on GitHub\n",
" </a>\n",
" </td>\n",
" \n",
" <td>\n",
" <a href=\"https://console.cloud.google.com/ai/platform/notebooks/deploy-notebook?download_url=https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/ml_ops/stage2/get_started_vertex_feature_store.ipynb\">\n",
" Open in Google Cloud Notebooks\n",
" <a href=\"https://colab.research.google.com/github/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/ml_ops/stage2/get_started_vertex_feature_store.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",
" \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/community/ml_ops/stage2/get_started_vertex_feature_store.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",
" \n",
"</table>\n",
"<br/><br/><br/>"
]
@@ -59,19 +68,6 @@
"This tutorial demonstrates how to use Vertex AI for E2E MLOps on Google Cloud in production. This tutorial covers stage 2 : experimentation: get started with Feature Store."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "dataset:movies,lbn,avro"
},
"source": [
"### Dataset\n",
"\n",
"The dataset used for this tutorial is the Movie Recommendations. The version of the dataset you will use in this tutorial is stored in a public Cloud Storage bucket, in Avro format.\n",
"\n",
"The dataset predicts whether a persons will watch a movie."
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -80,7 +76,7 @@
"source": [
"### Objective\n",
"\n",
"In this tutorial, you learn how to use `Vertex AI Feature Store` for when training and prediction with `Vertex AI`.\n",
"In this tutorial, you learn how to use `Vertex AI Feature Store` when training and predicting with `Vertex AI`.\n",
"\n",
"This tutorial uses the following Google Cloud ML services:\n",
"\n",
@@ -92,10 +88,41 @@
" - Creating `EntityType` resources for the `Featurestore` resource.\n",
" - Creating `Feature` resources for each `EntityType` resource.\n",
"- Import feature values (entity data items) into `Featurestore` resource.\n",
" - From a Cloud Storage location.\n",
" - From a pandas DataFrame.\n",
"- Perform online serving from a `Featurestore` resource.\n",
"- Perform batch serving from a `Featurestore` resource."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "dataset:movies,lbn,avro"
},
"source": [
"### Dataset\n",
"\n",
"The dataset used for this tutorial is the `Movie Recommendations` dataset. The version of the dataset you use in this tutorial is stored in a public Cloud Storage bucket, in Avro format.\n",
"\n",
"This dataset is used to predict whether a person watches a movie or not."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "81c777b8ad32"
},
"source": [
"### Costs\n",
"This tutorial uses billable components of Google Cloud:\n",
"\n",
"- Vertex AI\n",
"- Cloud Storage\n",
"- BigQuery\n",
"\n",
"Learn about [Vertex AI pricing](https://cloud.google.com/vertex-ai/pricing), [Cloud Storage pricing](https://cloud.google.com/storage/pricing) and [BigQuery pricing](https://cloud.google.com/bigquery/pricing) and use the [Pricing Calculator](https://cloud.google.com/products/calculator/) to generate a cost estimate based on your projected usage."
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -104,7 +131,7 @@
"source": [
"## Installations\n",
"\n",
"Install *one time* the packages for executing the MLOps notebooks."
"Install the following packages for further running this notebook."
]
},
{
@@ -115,24 +142,21 @@
},
"outputs": [],
"source": [
"ONCE_ONLY = False\n",
"if ONCE_ONLY:\n",
" ! pip3 install -U tensorflow==2.5 $USER_FLAG\n",
" ! pip3 install -U tensorflow-data-validation==1.2 $USER_FLAG\n",
" ! pip3 install -U tensorflow-transform==1.2 $USER_FLAG\n",
" ! pip3 install -U tensorflow-io==0.18 $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-aiplatform[tensorboard] $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-pipeline-components $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-bigquery $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-logging $USER_FLAG\n",
" ! pip3 install --upgrade apache-beam[gcp] $USER_FLAG\n",
" ! pip3 install --upgrade pyarrow $USER_FLAG\n",
" ! 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\n",
" ! pip3 install --upgrade python-tabulate $USER_FLAG\n",
" ! pip3 install -U opencv-python-headless==4.5.2.52 $USER_FLAG"
"import os\n",
"\n",
"# The Vertex AI Workbench Notebook product has specific requirements\n",
"IS_WORKBENCH_NOTEBOOK = os.getenv(\"DL_ANACONDA_HOME\") and not os.getenv(\"VIRTUAL_ENV\")\n",
"IS_USER_MANAGED_WORKBENCH_NOTEBOOK = os.path.exists(\n",
" \"/opt/deeplearning/metadata/env_version\"\n",
")\n",
"\n",
"# Vertex AI Notebook requires dependencies to be installed with '--user'\n",
"USER_FLAG = \"\"\n",
"if IS_WORKBENCH_NOTEBOOK:\n",
" USER_FLAG = \"--user\"\n",
"\n",
"# Install the dependecies\n",
"! pip3 install --upgrade google-cloud-aiplatform google-cloud-bigquery pyarrow avro $USER_FLAG -q"
]
},
{
@@ -164,6 +188,32 @@
" app.kernel.do_shutdown(True)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "project_id"
},
"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",
"1. [Make sure that billing is enabled for your project](https://cloud.google.com/billing/docs/how-to/modify-project).\n",
"\n",
"1. [Enable the Vertex AI, Compute Engine, Cloud Storage and Cloud Logging APIs](https://console.cloud.google.com/flows/enableapi?apiid=aiplatform.googleapis.com,compute_component,storage_component,logging).\n",
"\n",
"1. If you are running this notebook locally, you need to install the [Cloud SDK](https://cloud.google.com/sdk).\n",
"\n",
"1. Enter your project ID in the cell below. Then run the cell to make sure the\n",
"Cloud SDK uses the right project for all the commands in this notebook.\n",
"\n",
"**Note**: Jupyter runs lines prefixed with `!` as shell commands, and it interpolates Python variables prefixed with `$` into these commands."
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -240,7 +290,10 @@
},
"outputs": [],
"source": [
"REGION = \"us-central1\" # @param {type: \"string\"}"
"REGION = \"[your-region]\" # @param {type: \"string\"}\n",
"\n",
"if REGION == \"[your-region]\":\n",
" REGION = \"us-central1\""
]
},
{
@@ -267,15 +320,72 @@
"TIMESTAMP = datetime.now().strftime(\"%Y%m%d%H%M%S\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "29b110b44457"
},
"source": [
"### Authenticate your Google Cloud account\n",
"\n",
"**If you are using Vertex AI Workbench Notebooks**, your environment is already authenticated. Skip this step.\n",
"\n",
"**If you are using Colab**, run the cell below and follow the instructions when prompted to authenticate your account via oAuth.\n",
"\n",
"**Otherwise**, follow these steps:\n",
"\n",
"In the Cloud Console, go to the [Create service account key](https://console.cloud.google.com/apis/credentials/serviceaccountkey) page.\n",
"\n",
"1. **Click Create service account**.\n",
"\n",
"2. In the **Service account name** field, enter a name, and click **Create**.\n",
"\n",
"3. In the **Grant this service account access to project** section, click the Role drop-down list. Type \"Vertex\" into the filter box, and select **Vertex Administrator**. Type \"Storage Object Admin\" into the filter box, and select **Storage Object Admin**.\n",
"\n",
"4. Click Create. A JSON file that contains your key downloads to your local environment.\n",
"\n",
"5. Enter the path to your service account key as the GOOGLE_APPLICATION_CREDENTIALS variable in the cell below and run the cell."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "89788a802687"
},
"outputs": [],
"source": [
"# If you are running this notebook in Colab, run this cell and follow the\n",
"# instructions to authenticate your GCP account. This provides access to your\n",
"# Cloud Storage bucket and lets you submit training jobs and prediction\n",
"# requests.\n",
"\n",
"import os\n",
"import sys\n",
"\n",
"# If on Vertex AI Workbench, then don't execute this code\n",
"IS_COLAB = \"google.colab\" in sys.modules\n",
"if not os.path.exists(\"/opt/deeplearning/metadata/env_version\") and not os.getenv(\n",
" \"DL_ANACONDA_HOME\"\n",
"):\n",
" if \"google.colab\" in sys.modules:\n",
" from google.colab import auth as google_auth\n",
"\n",
" google_auth.authenticate_user()\n",
"\n",
" # If you are running this notebook locally, replace the string below with the\n",
" # path to your service account key and run this cell to authenticate your GCP\n",
" # account.\n",
" elif not os.getenv(\"IS_TESTING\"):\n",
" %env GOOGLE_APPLICATION_CREDENTIALS ''"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "setup_vars"
},
"source": [
"### Set up variables\n",
"\n",
"Next, set up some variables used throughout the tutorial.\n",
"### Import libraries and define constants"
]
},
@@ -287,28 +397,7 @@
},
"outputs": [],
"source": [
"import google.cloud.aiplatform as aip"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "import_bq"
},
"source": [
"#### Import BigQuery\n",
"\n",
"Import the BigQuery package into your Python environment."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "import_bq"
},
"outputs": [],
"source": [
"import google.cloud.aiplatform as aiplatform\n",
"from google.cloud import bigquery"
]
},
@@ -318,9 +407,7 @@
"id": "init_bq"
},
"source": [
"### Create BigQuery client\n",
"\n",
"Create the BigQuery client."
"Initialize Vertex AI and BigQuery clients."
]
},
{
@@ -331,7 +418,8 @@
},
"outputs": [],
"source": [
"bqclient = bigquery.Client()"
"aiplatform.init(project=PROJECT_ID)\n",
"bqclient = bigquery.Client(project=PROJECT_ID)"
]
},
{
@@ -348,11 +436,11 @@
"\n",
"Now it's time to do a live prediction. You get a transaction from the cash register, but all it has is the credit card number and this transaction. It does not have the enriched data the model needs. During serving, the credit card number is used as an index to Feature Store to get the enriched data needed for the model.\n",
"\n",
"Next problem. Let's say the enriched data the model was trained on was timestamp June 1. This transaction is June 15. Assume that the user has made other transactions between June 1 and 15, and the enriched data has been continuously updated in Feature Store. But the model was trained on June 1st data. FeatureStore knows the version number and serves the June 1 version to the model (not the current June 15); otherwise, if you used June 15 data you have training-serving skew.\n",
"On the other hand, let's say the enriched data the model was trained on was timestamped on June 1st. The current transaction is from June 15th. Assume that the user has made other transactions between June 1st and 15th, and the enriched data has been continuously updated in Feature Store. But the model was trained on June 1st data. FeatureStore knows the version number and serves the June 1st version to the model (not the current June 15th). Otherwise, if you used June 15th data, you would have training-serving skew.\n",
"\n",
"Next problem, data drift. Things change, suddenly one day everybody is buying toilet paper! There is a significant change in the distribution of the current stored enriched data from the distribution that the deployed model was trained on. FeatureStore can detect changes/thresholds in distribution changes and trigger a notification for retraining the model.\n",
"Another problem here is the data drift. Things change and suddenly one day, everybody is buying toilet paper! There is a significant change in the distribution of existing enriched data from the distribution that the deployed model was trained on. FeatureStore can detect changes/thresholds in distribution changes and trigger a notification for retraining the model.\n",
"\n",
"Learn more about [Vertex AI Feature Store API](https://cloud.google.com/vertex-ai/docs/featurestore)"
"Learn more about [Vertex AI Feature Store API](https://cloud.google.com/vertex-ai/docs/featurestore)."
]
},
{
@@ -367,9 +455,9 @@
"\n",
" Featurestore -> EntityType -> Feature\n",
"\n",
"- `Featurestore`: the place to store your features\n",
"- `Featurestore`: the place to store your features.\n",
"- `EntityType`: under a `Featurestore`, an `EntityType` describes an object to be modeled, real one or virtual one.\n",
"- `Feature`: under an `EntityType`, a `Feature` describes an attribute of the `EntityType`\n",
"- `Feature`: under an `EntityType`, a `Feature` describes an attribute of the `EntityType`.\n",
"\n",
"Learn more about [Vertex AI Feature Store data model](https://cloud.google.com/vertex-ai/docs/featurestore/concepts).\n",
"\n",
@@ -403,9 +491,9 @@
"outputs": [],
"source": [
"# Represents featurestore resource path.\n",
"FEATURESTORE_NAME = \"movies\"\n",
"FEATURESTORE_NAME = \"movies_\" + TIMESTAMP\n",
"\n",
"featurestore = aip.Featurestore.create(\n",
"featurestore = aiplatform.Featurestore.create(\n",
" featurestore_id=FEATURESTORE_NAME,\n",
" online_store_fixed_node_count=1,\n",
" project=PROJECT_ID,\n",
@@ -434,7 +522,7 @@
},
"outputs": [],
"source": [
"for featurestore in aip.Featurestore.list():\n",
"for featurestore in aiplatform.Featurestore.list():\n",
" print(featurestore)"
]
},
@@ -461,7 +549,7 @@
},
"outputs": [],
"source": [
"featurestore = featurestore = aip.Featurestore(\n",
"featurestore = featurestore = aiplatform.Featurestore(\n",
" featurestore_name=FEATURESTORE_NAME, project=PROJECT_ID, location=REGION\n",
")\n",
"print(featurestore)"
@@ -520,7 +608,7 @@
"outputs": [],
"source": [
"def create_features(featurestore_name, entity_name, features):\n",
" entity_type = aip.EntityType(\n",
" entity_type = aiplatform.EntityType(\n",
" entity_type_name=entity_name, featurestore_id=featurestore_name\n",
" )\n",
"\n",
@@ -571,7 +659,7 @@
},
"outputs": [],
"source": [
"for featurestore in aip.Featurestore.list():\n",
"for featurestore in aiplatform.Featurestore.list():\n",
" print(featurestore)"
]
},
@@ -583,7 +671,7 @@
"source": [
"### Search `Feature` resources using a filter\n",
"\n",
"You can narrow your search of `Feature` resources using the method `list_features()` and specifying a `filter` filter."
"You can narrow your search of `Feature` resources using the method `list_features()` and specifying a `filter` string."
]
},
{
@@ -635,17 +723,26 @@
},
"outputs": [],
"source": [
"features = aip.Feature.search(query=\"value_type=DOUBLE\")\n",
"features = aiplatform.Feature.search(query=\"value_type=DOUBLE\")\n",
"print(\"By data type\")\n",
"for feature in features:\n",
" print(features)\n",
"\n",
"aip.Feature.search(query=\"feature_id=title\")\n",
"aiplatform.Feature.search(query=\"feature_id=title\")\n",
"print(\"By Name\")\n",
"for feature in features:\n",
" print(features)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "277e9884cf37"
},
"source": [
"Define paths to the feature data."
]
},
{
"cell_type": "code",
"execution_count": null,
@@ -675,15 +772,15 @@
"\n",
"### Data layout\n",
"\n",
"Each imported `EntityType` resource data must have an ID; also, each `EntityType` resource data item can optionally have a timestamp, sepecifying when the feature values were generated.\n",
"Each imported `EntityType` resource data must have an ID. Also, each `EntityType` resource data item can optionally have a timestamp, sepecifying when the feature values were generated.\n",
"\n",
"When importing, specify the following in your request:\n",
"\n",
"- Data source format: BigQuery Table/Avro/CSV\n",
"- Data source format: BigQuery Table/Avro/CSV/Pandas Dataframe\n",
"- Data source URL\n",
"- Destination: featurestore/entity types/features to be imported\n",
"\n",
"The feature values for the movies dataset are in Avro format. The Avro schemas are as follows:\n",
"The feature values for `Movie Recommendations` dataset are in Avro format. The Avro schemas are as follows:\n",
"\n",
"**Users entity**:\n",
"\n",
@@ -747,7 +844,7 @@
"}\n",
"```\n",
"\n",
"### Importing the feature values\n",
"### Importing the feature values from Cloud Storage\n",
"\n",
"You import the feature values for the `EntityType` resources using the `ingest_from_gcs()` method, with the following parameters:\n",
"\n",
@@ -755,7 +852,7 @@
"- `feature_ids`: A list of identifier names for `Feature` resources' data to add to the `EntityType` resource.\n",
"- `feature_time`: The field corresponding to the timestamp for the features being entered.\n",
"- `gcs_source_type`: The format of the imported data. Must be CSV or Avro.\n",
"- `gcs_source_uris=`: A list of one or more Cloud Storage locations of the imported data files."
"- `gcs_source_uris`: A list of one or more Cloud Storage locations of the imported data files."
]
},
{
@@ -787,6 +884,225 @@
"print(response)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "featurestore_delete_entities:movies"
},
"source": [
"#### Delete the entity types and corresponding features and feature values\n",
"\n",
"Now, in preparation to repeat the process of importing feature values but from a dataframe this time, you delete the existing entity types, and the corresponding content."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "featurestore_delete_entities:movies"
},
"outputs": [],
"source": [
"entity_type = featurestore.get_entity_type(\"users\")\n",
"entity_type.delete(force=True)\n",
"entity_type = featurestore.get_entity_type(\"movies\")\n",
"entity_type.delete(force=True)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "featurestore_create:entity_type"
},
"source": [
"## Create entity types for your `Featurestore` resource\n",
"\n",
"Next, you create the `EntityType` resources again for your `Featurestore` resource using the `create_entity_type()` method, with the following parameters:\n",
"\n",
"- `entity_type_id`: The name of the `EntityType` resource.\n",
"- `description`: A description of the entity type."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "featurestore_create:entity_type"
},
"outputs": [],
"source": [
"for name, description in [(\"users\", \"Users descrip\"), (\"movies\", \"Movies descrip\")]:\n",
" entity_type = featurestore.create_entity_type(\n",
" entity_type_id=name, description=description\n",
" )\n",
" print(entity_type)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "featurestore_create:feature"
},
"source": [
"### Add `Feature` resources for your `EntityType` resources\n",
"\n",
"Further, you create the `Feature` resources again for each of the `EntityType` resources in your `Featurestore` resource using the `create_feature()` method, with the following parameters:\n",
"\n",
"- `feature_id`: The name of the `Feature` resource.\n",
"- `description`: A description of the feature.\n",
"- `value_type`: The data type for the feature."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "featurestore_create:feature,movies"
},
"outputs": [],
"source": [
"def create_features(featurestore_name, entity_name, features):\n",
" entity_type = aiplatform.EntityType(\n",
" entity_type_name=entity_name, featurestore_id=featurestore_name\n",
" )\n",
"\n",
" for feature in features:\n",
" feature = entity_type.create_feature(\n",
" feature_id=feature[0], description=feature[1], value_type=feature[2]\n",
" )\n",
" print(feature)\n",
"\n",
"\n",
"create_features(\n",
" FEATURESTORE_NAME,\n",
" \"users\",\n",
" [\n",
" (\"age\", \"Age descrip\", \"INT64\"),\n",
" (\"gender\", \"Gender descrip\", \"STRING\"),\n",
" (\"liked_genres\", \"Genres descrip\", \"STRING_ARRAY\"),\n",
" ],\n",
")\n",
"\n",
"create_features(\n",
" FEATURESTORE_NAME,\n",
" \"movies\",\n",
" [\n",
" (\"title\", \"Title descrip\", \"STRING\"),\n",
" (\"genres\", \"Genres descrip\", \"STRING\"),\n",
" (\"average_rating\", \"Ave descrip\", \"DOUBLE\"),\n",
" ],\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "8715a3f719c8"
},
"source": [
"Now, copy the `users` and `movies` data into avro files."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "import_file:movies,lbn,df"
},
"outputs": [],
"source": [
"GCS_USERS_AVRO_URI = FS_ENTITIES[\"users\"]\n",
"GCS_MOVIES_AVRO_URI = FS_ENTITIES[\"movies\"]\n",
"\n",
"USERS_AVRO_FN = \"users.avro\"\n",
"MOVIES_AVRO_FN = \"movies.avro\"\n",
"\n",
"! gsutil cp $GCS_USERS_AVRO_URI $USERS_AVRO_FN\n",
"! gsutil cp $GCS_MOVIES_AVRO_URI $MOVIES_AVRO_FN"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "load_df_from_avro"
},
"source": [
"#### Load Avro Files into pandas DataFrames"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "load_df_from_avro"
},
"outputs": [],
"source": [
"from avro.datafile import DataFileReader\n",
"from avro.io import DatumReader\n",
"\n",
"\n",
"class AvroReader:\n",
" def __init__(self, data_file):\n",
" self.avro_reader = DataFileReader(open(data_file, \"rb\"), DatumReader())\n",
"\n",
" def to_dataframe(self):\n",
" records = [record for record in self.avro_reader]\n",
" return pd.DataFrame.from_records(data=records)\n",
"\n",
"\n",
"import pandas as pd\n",
"\n",
"users_avro_reader = AvroReader(data_file=USERS_AVRO_FN)\n",
"users_source_df = users_avro_reader.to_dataframe()\n",
"print(users_source_df)\n",
"\n",
"movies_avro_reader = AvroReader(data_file=MOVIES_AVRO_FN)\n",
"movies_source_df = movies_avro_reader.to_dataframe()\n",
"print(movies_source_df)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "featurestore_import:movies,df"
},
"source": [
"### Importing the feature values from DataFrame\n",
"\n",
"You import the feature values for the `EntityType` resources using the `ingest_from_df()` method, with the following parameters:\n",
"\n",
"- `entity_id_field`: The identifier name for the parent `EntityType` resource.\n",
"- `feature_ids`: A list of identifier names for `Feature` resources' data to add to the `EntityType` resource.\n",
"- `feature_time`: The field corresponding to the timestamp for the features being entered.\n",
"- `df_source`: The DataFrame containing the imported feature values."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "featurestore_import:movies,df"
},
"outputs": [],
"source": [
"entity_type = featurestore.get_entity_type(\"users\")\n",
"entity_type.ingest_from_df(\n",
" feature_ids=[\"age\", \"gender\", \"liked_genres\"],\n",
" feature_time=\"update_time\",\n",
" df_source=users_source_df,\n",
" entity_id_field=\"user_id\",\n",
")\n",
"\n",
"entity_type = featurestore.get_entity_type(\"movies\")\n",
"entity_type.ingest_from_df(\n",
" feature_ids=[\"average_rating\", \"title\", \"genres\"],\n",
" feature_time=\"update_time\",\n",
" df_source=movies_source_df,\n",
" entity_id_field=\"movie_id\",\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -829,7 +1145,7 @@
"source": [
"## Batch Serving\n",
"\n",
"The Vertex AI Feature Store batch serving service is optimized for serving large batches of features in real-time with high-throughput, typically for training a model or batch prediction.\n",
"The Vertex AI Feature Store's batch serving service is optimized for serving large batches of features in real-time with high throughput, typically for training a model or batch prediction.\n",
"\n",
"One can batch serve to the following destinations:\n",
"\n",
@@ -881,7 +1197,7 @@
"\n",
"You batch serve entity data items to a BigQuery table using the `read_serve_to_bq()` method, with the following parameters:\n",
"\n",
"- `bq_destination_output_uri`: The destination BigQuery table to serve the features to.\n",
"- `bq_destination_output_uri`: The destination BigQuery table to receive the served features.\n",
"- `serving_feature_ids`: A dictionary of entity type and corresponding features to serve.\n",
"- `read_instances_uri`: A Cloud Storage location to read the entity data items from.\n",
"\n",
@@ -914,6 +1230,7 @@
"id": "delete_bq_dataset"
},
"source": [
"## Cleaning up\n",
"### Delete a BigQuery dataset\n",
"\n",
"Use the method `delete_dataset()` to delete a BigQuery dataset along with all its tables, by setting the parameter `delete_contents` to `True`."
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -8,7 +8,7 @@
},
"outputs": [],
"source": [
"# Copyright 2021 Google LLC\n",
"# Copyright 2022 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",
@@ -29,9 +29,14 @@
"id": "title:generic,gcp"
},
"source": [
"# E2E ML on GCP: MLOps stage 2 : experimentation: get started with Vertex Tensorboard\n",
"# E2E ML on GCP: MLOps stage 2 : experimentation: get started with Vertex AI TensorBoard\n",
"\n",
"<table align=\"left\">\n",
" <td>\n",
" <a href=\"https://colab.research.google.com/github/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/ml_ops/stage2/get_started_vertex_tensorboard.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/ml_ops/stage2/get_started_vertex_tensorboard.ipynb\">\n",
" <img src=\"https://cloud.google.com/ml-engine/images/github-logo-32px.png\" alt=\"GitHub logo\">\n",
@@ -39,8 +44,9 @@
" </a>\n",
" </td>\n",
" <td>\n",
" <a href=\"https://console.cloud.google.com/ai/platform/notebooks/deploy-notebook?download_url=https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/ml_ops/stage2/get_started_vertex_tensorboard.ipynb\">\n",
" Open in Google Cloud Notebooks\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/community/ml_ops/stage2/get_started_vertex_tensorboard.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>\n",
@@ -56,7 +62,7 @@
"## Overview\n",
"\n",
"\n",
"This tutorial demonstrates how to use Vertex AI for E2E MLOps on Google Cloud in production. This tutorial covers stage 2 : experimentation: get started with Vertex Tensorboard."
"This tutorial demonstrates how to use Vertex AI for E2E MLOps on Google Cloud in production. This tutorial covers stage 2 : experimentation: get started with Vertex AI TensorBoard."
]
},
{
@@ -77,7 +83,7 @@
"The steps performed include:\n",
"\n",
"- Create a TensorBoard callback when training a model.\n",
"- Using Tensorboard with locally trained model.\n",
"- Using TensorBoard with locally trained model.\n",
"- Using Vertex AI TensorBoard with Vertex AI Training."
]
},
@@ -89,7 +95,7 @@
"source": [
"### Recommendations\n",
"\n",
"When doing E2E MLOps on Google Cloud, the following best practices for visualizing your training with TensorBoard.\n",
"When doing E2E MLOps on Google Cloud, the following are the best practices for visualizing your training with TensorBoard.\n",
"\n",
"#### Local TensorBoard\n",
"\n",
@@ -97,13 +103,86 @@
"\n",
"#### Cloud TensorBoard\n",
"\n",
"Use the Tensorboard.dev, when doing training on the cloud -- unless you have a privacy issue.\n",
"Use the tensorboard.dev, when doing training on the cloud -- unless you have a privacy issue.\n",
"\n",
"#### Experiments\n",
"\n",
"Use Vertex AI TensorBoard when you have a privacy issue or doing experiments to compare results for different experiment configurations."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "03bfd1274241"
},
"source": [
"### Dataset\n",
"\n",
"In this tutorial you use the MNIST dataset. The version of the dataset is built into the TF.Keras framework. The dataset predicts which digit an image is, between 0 .. 9."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "b132d4ef86d6"
},
"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\n",
"pricing](https://cloud.google.com/vertex-ai/pricing) and [Cloud Storage\n",
"pricing](https://cloud.google.com/storage/pricing), and use the [Pricing\n",
"Calculator](https://cloud.google.com/products/calculator/)\n",
"to generate a cost estimate based on your projected usage."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "56cb7f08a9e8"
},
"source": [
"### Set up your local development environment\n",
"\n",
"**If you are using Colab or Vertex AI Workbench Notebooks**, your environment already meets\n",
"all the requirements to run this notebook. \n",
"\n",
"**Otherwise**, make sure your environment meets this notebook's requirements.\n",
"You need the following:\n",
"\n",
"* The Google Cloud SDK\n",
"* Git\n",
"* Python 3\n",
"* virtualenv\n",
"* Jupyter notebook running in a virtual environment with Python 3\n",
"\n",
"The Google Cloud guide to [Setting up a Python development\n",
"environment](https://cloud.google.com/python/setup) and the [Jupyter\n",
"installation guide](https://jupyter.org/install) provide detailed instructions\n",
"for meeting these requirements. The following steps provide a condensed set of\n",
"instructions:\n",
"\n",
"1. [Install and initialize the Cloud SDK.](https://cloud.google.com/sdk/docs/)\n",
"\n",
"1. [Install Python 3.](https://cloud.google.com/python/setup#installing_python)\n",
"\n",
"1. [Install\n",
" virtualenv](https://cloud.google.com/python/setup#installing_and_using_virtualenv)\n",
" and create a virtual environment that uses Python 3. Activate the virtual environment.\n",
"\n",
"1. To install Jupyter, run `pip3 install jupyter` on the\n",
"command-line in a terminal shell.\n",
"\n",
"1. To launch Jupyter, run `jupyter notebook` on the command-line in a terminal shell.\n",
"\n",
"1. Open this notebook in the Jupyter Notebook Dashboard.\n"
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -112,31 +191,32 @@
"source": [
"## Installations\n",
"\n",
"Install *one time* the packages for executing the MLOps notebooks."
"Install the following packages for executing this notebook."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "install_mlops"
"id": "020040f91150"
},
"outputs": [],
"source": [
"ONCE_ONLY = False\n",
"if ONCE_ONLY:\n",
" ! pip3 install -U tensorflow==2.5 $USER_FLAG\n",
" ! pip3 install -U tensorflow-data-validation==1.2 $USER_FLAG\n",
" ! pip3 install -U tensorflow-transform==1.2 $USER_FLAG\n",
" ! pip3 install -U tensorflow-io==0.18 $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-aiplatform[tensorboard] $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-pipeline-components $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-bigquery $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-logging $USER_FLAG\n",
" ! pip3 install --upgrade apache-beam[gcp] $USER_FLAG\n",
" ! pip3 install --upgrade pyarrow $USER_FLAG\n",
" ! pip3 install --upgrade cloudml-hypertune $USER_FLAG\n",
" ! pip3 install --upgrade kfp $USER_FLAG"
"import os\n",
"\n",
"# The Vertex AI Workbench Notebook product has specific requirements\n",
"IS_WORKBENCH_NOTEBOOK = os.getenv(\"DL_ANACONDA_HOME\") and not os.getenv(\"VIRTUAL_ENV\")\n",
"IS_USER_MANAGED_WORKBENCH_NOTEBOOK = os.path.exists(\n",
" \"/opt/deeplearning/metadata/env_version\"\n",
")\n",
"\n",
"# Vertex AI Notebook requires dependencies to be installed with '--user'\n",
"USER_FLAG = \"\"\n",
"if IS_WORKBENCH_NOTEBOOK:\n",
" USER_FLAG = \"--user\"\n",
"\n",
"! pip3 install -U tensorflow==2.8 $USER_FLAG -q\n",
"! pip3 install --upgrade google-cloud-aiplatform[tensorboard] $USER_FLAG -q"
]
},
{
@@ -168,6 +248,32 @@
" app.kernel.do_shutdown(True)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "2721ef0202d9"
},
"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",
"1. [Make sure that billing is enabled for your project](https://cloud.google.com/billing/docs/how-to/modify-project).\n",
"\n",
"1. [Enable the Vertex AI API](https://console.cloud.google.com/flows/enableapi?apiid=aiplatform.googleapis.com). \n",
"\n",
"1. If you are running this notebook locally, you need to install the [Cloud SDK](https://cloud.google.com/sdk).\n",
"\n",
"1. Enter your project ID in the cell below. Then run the cell to make sure the\n",
"Cloud SDK uses the right project for all the commands in this notebook.\n",
"\n",
"**Note**: Jupyter runs lines prefixed with `!` as shell commands, and it interpolates Python variables prefixed with `$` into these commands."
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -244,7 +350,10 @@
},
"outputs": [],
"source": [
"REGION = \"us-central1\" # @param {type: \"string\"}"
"REGION = \"[your-region]\" # @param {type: \"string\"}\n",
"\n",
"if REGION == \"[your-region]\":\n",
" REGION = \"us-central1\""
]
},
{
@@ -271,6 +380,82 @@
"TIMESTAMP = datetime.now().strftime(\"%Y%m%d%H%M%S\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "2700e693f1b3"
},
"source": [
"### Authenticate your Google Cloud account\n",
"\n",
"**If you are using Vertex AI Workbench Notebooks**, your environment is already\n",
"authenticated. Skip this step."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "885395904904"
},
"source": [
"**If you are using Colab**, run the cell below and follow the instructions\n",
"when prompted to authenticate your account via oAuth.\n",
"\n",
"**Otherwise**, follow these steps:\n",
"\n",
"1. In the Cloud Console, go to the [**Create service account key**\n",
" page](https://console.cloud.google.com/apis/credentials/serviceaccountkey).\n",
"\n",
"2. Click **Create service account**.\n",
"\n",
"3. In the **Service account name** field, enter a name, and\n",
" click **Create**.\n",
"\n",
"4. In the **Grant this service account access to project** section, click the **Role** drop-down list. Type \"Vertex AI\"\n",
"into the filter box, and select\n",
" **Vertex AI Administrator**. Type \"Storage Object Admin\" into the filter box, and select **Storage Object Admin**.\n",
"\n",
"5. Click *Create*. A JSON file that contains your key downloads to your\n",
"local environment.\n",
"\n",
"6. Enter the path to your service account key as the\n",
"`GOOGLE_APPLICATION_CREDENTIALS` variable in the cell below and run the cell."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "eff327d0552b"
},
"outputs": [],
"source": [
"# If you are running this notebook in Colab, run this cell and follow the\n",
"# instructions to authenticate your GCP account. This provides access to your\n",
"# Cloud Storage bucket and lets you submit training jobs and prediction\n",
"# requests.\n",
"\n",
"import os\n",
"import sys\n",
"\n",
"# If on Vertex AI Workbench, then don't execute this code\n",
"IS_COLAB = False\n",
"if not os.path.exists(\"/opt/deeplearning/metadata/env_version\") and not os.getenv(\n",
" \"DL_ANACONDA_HOME\"\n",
"):\n",
" if \"google.colab\" in sys.modules:\n",
" IS_COLAB = True\n",
" from google.colab import auth as google_auth\n",
"\n",
" google_auth.authenticate_user()\n",
"\n",
" # If you are running this notebook locally, replace the string below with the\n",
" # path to your service account key and run this cell to authenticate your GCP\n",
" # account.\n",
" elif not os.getenv(\"IS_TESTING\"):\n",
" %env GOOGLE_APPLICATION_CREDENTIALS ''"
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -294,7 +479,7 @@
},
"outputs": [],
"source": [
"BUCKET_NAME = \"gs://[your-bucket-name]\" # @param {type:\"string\"}"
"BUCKET_URI = \"gs://[your-bucket-name]\" # @param {type:\"string\"}"
]
},
{
@@ -305,8 +490,8 @@
},
"outputs": [],
"source": [
"if BUCKET_NAME == \"\" or BUCKET_NAME is None or BUCKET_NAME == \"gs://[your-bucket-name]\":\n",
" BUCKET_NAME = \"gs://\" + PROJECT_ID + \"aip-\" + TIMESTAMP"
"if BUCKET_URI == \"\" or BUCKET_URI is None or BUCKET_URI == \"gs://[your-bucket-name]\":\n",
" BUCKET_URI = \"gs://\" + PROJECT_ID + \"aip-\" + TIMESTAMP"
]
},
{
@@ -326,7 +511,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l $REGION $BUCKET_NAME"
"! gsutil mb -l $REGION $BUCKET_URI"
]
},
{
@@ -346,7 +531,7 @@
},
"outputs": [],
"source": [
"! gsutil ls -al $BUCKET_NAME"
"! gsutil ls -al $BUCKET_URI"
]
},
{
@@ -384,9 +569,16 @@
" or SERVICE_ACCOUNT is None\n",
" or SERVICE_ACCOUNT == \"[your-service-account]\"\n",
"):\n",
" # Get your GCP project id from gcloud\n",
" shell_output = !gcloud auth list 2>/dev/null\n",
" SERVICE_ACCOUNT = shell_output[2].strip()\n",
" # Get your service account from gcloud\n",
" if not IS_COLAB:\n",
" shell_output = !gcloud auth list 2>/dev/null\n",
" SERVICE_ACCOUNT = shell_output[2].replace(\"*\", \"\").strip()\n",
"\n",
" if IS_COLAB:\n",
" shell_output = ! gcloud projects describe $PROJECT_ID\n",
" project_number = shell_output[-1].split(\":\")[1].strip().replace(\"'\", \"\")\n",
" SERVICE_ACCOUNT = f\"{project_number}-compute@developer.gserviceaccount.com\"\n",
"\n",
" print(\"Service Account:\", SERVICE_ACCOUNT)"
]
},
@@ -410,7 +602,7 @@
},
"outputs": [],
"source": [
"import google.cloud.aiplatform as aip"
"import google.cloud.aiplatform as aiplatform"
]
},
{
@@ -454,7 +646,7 @@
},
"outputs": [],
"source": [
"aip.init(project=PROJECT_ID, staging_bucket=BUCKET_NAME)"
"aiplatform.init(project=PROJECT_ID, staging_bucket=BUCKET_URI)"
]
},
{
@@ -484,13 +676,15 @@
},
"outputs": [],
"source": [
"import os\n",
"\n",
"if os.getenv(\"IS_TESTING_TRAIN_GPU\"):\n",
" TRAIN_GPU, TRAIN_NGPU = (\n",
" aip.gapic.AcceleratorType.NVIDIA_TESLA_K80,\n",
" aiplatform.gapic.AcceleratorType.NVIDIA_TESLA_K80,\n",
" int(os.getenv(\"IS_TESTING_TRAIN_GPU\")),\n",
" )\n",
"else:\n",
" TRAIN_GPU, TRAIN_NGPU = (aip.gapic.AcceleratorType.NVIDIA_TESLA_K80, 1)"
" TRAIN_GPU, TRAIN_NGPU = (aiplatform.gapic.AcceleratorType.NVIDIA_TESLA_K80, 1)"
]
},
{
@@ -591,9 +785,9 @@
"source": [
"## Training with TensorBoard\n",
"\n",
"Tensorboard provides the means to visualize your training in-real time and to visualize the results (metrics).\n",
"TensorBoard provides the means to visualize your training in-real time and to visualize the results (metrics).\n",
"\n",
"You can use Tensorboard in conjunction with local training, cloud training and with `Vertex AI Training`, which is referred to as `Vertex AI TensorBoard`"
"You can use TensorBoard in conjunction with local training, cloud training and with `Vertex AI Training`, which is referred to as `Vertex AI TensorBoard`"
]
},
{
@@ -663,9 +857,9 @@
"\n",
"You can upload your TensorBoard logs and share with others using `tensorboard dev` command. Once uploaded, a URL is returned to open up the TensorBoard instance in a brower for visualizing.\n",
"\n",
"*Note:* Your TensorBoard instance is publicly visable.\n",
"*Note:* Your TensorBoard instance is publicly visible.\n",
"\n",
"*Note:* In this example, while running within a notebook, the command will freeze since it is waiting for an interactive yes/no input. You can kill the command with a Ctrl C or kernel interupt.\n",
"*Note:* This cell is for demonstration purposes and must be ran in a terminal shell. In this example, while running within a notebook, the command will freeze since it is waiting for an interactive yes/no input. You can kill the command with a Ctrl C or kernel interupt.\n",
"\n",
"Learn more about [What is TensorBoard.dev](https://tensorboard.dev/)."
]
@@ -678,7 +872,7 @@
},
"outputs": [],
"source": [
"! tensorboard dev upload --logdir {LOG_DIR} \\\n",
"! tensorboard dev upload --logdir logs \\\n",
" --name \"Simple experiment with MNIST\" \\\n",
" --description \"Training results\" \\\n",
" --one_shot"
@@ -706,7 +900,7 @@
"outputs": [],
"source": [
"TENSORBOARD_DISPLAY_NAME = \"example\"\n",
"tensorboard = aip.Tensorboard.create(display_name=TENSORBOARD_DISPLAY_NAME)\n",
"tensorboard = aiplatform.Tensorboard.create(display_name=TENSORBOARD_DISPLAY_NAME)\n",
"tensorboard_resource_name = tensorboard.gca_resource.name\n",
"print(\"TensorBoard resource name:\", tensorboard_resource_name)"
]
@@ -746,9 +940,9 @@
"\n",
"url = output[1].split(' ')[-1]\n",
"\n",
"print(url)\n",
"#print(url)\n",
"\n",
"from IPython.core.display import display, HTML\n",
"from IPython.display import display, HTML\n",
"display(HTML(\"<a href='\" + url + \"'>click here for TensorBoard instance</a>\"))"
]
},
@@ -953,7 +1147,7 @@
"! rm -f custom.tar custom.tar.gz\n",
"! tar cvf custom.tar custom\n",
"! gzip custom.tar\n",
"! gsutil cp custom.tar.gz $BUCKET_NAME/trainer_example.tar.gz"
"! gsutil cp custom.tar.gz $BUCKET_URI/trainer_example.tar.gz"
]
},
{
@@ -985,7 +1179,7 @@
},
"outputs": [],
"source": [
"job = aip.CustomTrainingJob(\n",
"job = aiplatform.CustomTrainingJob(\n",
" display_name=\"example_\" + TIMESTAMP,\n",
" script_path=\"custom/trainer/task.py\",\n",
" container_uri=TRAIN_IMAGE,\n",
@@ -1021,7 +1215,7 @@
},
"outputs": [],
"source": [
"MODEL_DIR = \"{}/{}\".format(BUCKET_NAME, TIMESTAMP)\n",
"MODEL_DIR = \"{}/{}\".format(BUCKET_URI, TIMESTAMP)\n",
"\n",
"EPOCHS = 20\n",
"STEPS = 100\n",
@@ -1143,14 +1337,8 @@
"\n",
"Otherwise, you can delete the individual resources you created in this tutorial:\n",
"\n",
"- Dataset\n",
"- Pipeline\n",
"- Model\n",
"- Endpoint\n",
"- AutoML Training Job\n",
"- Batch Job\n",
"- Custom Job\n",
"- Hyperparameter Tuning Job\n",
"- Cloud Storage Bucket"
]
},
@@ -1162,61 +1350,14 @@
},
"outputs": [],
"source": [
"delete_all = True\n",
"# Delete the custom training job\n",
"job.delete()\n",
"\n",
"if delete_all:\n",
" # Delete the dataset using the Vertex dataset object\n",
" try:\n",
" if \"dataset\" in globals():\n",
" dataset.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"# Set this to true only if you'd like to delete your bucket\n",
"delete_bucket = False\n",
"\n",
" # Delete the model using the Vertex model object\n",
" try:\n",
" if \"model\" in globals():\n",
" model.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" # Delete the endpoint using the Vertex endpoint object\n",
" try:\n",
" if \"endpoint\" in globals():\n",
" endpoint.undeploy_all()\n",
" endpoint.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" # Delete the AutoML or Pipeline training job\n",
" try:\n",
" if \"dag\" in globals():\n",
" dag.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" # Delete the custom training job\n",
" try:\n",
" if \"job\" in globals():\n",
" job.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" # Delete the batch prediction job using the Vertex batch prediction object\n",
" try:\n",
" if \"batch_predict_job\" in globals():\n",
" batch_predict_job.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" # Delete the hyperparameter tuning job using the Vertex hyperparameter tuning object\n",
" try:\n",
" if \"hpt_job\" in globals():\n",
" hpt_job.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" if \"BUCKET_NAME\" in globals():\n",
" ! gsutil rm -r $BUCKET_NAME"
"if delete_bucket or os.getenv(\"IS_TESTING\"):\n",
" ! gsutil rm -r $BUCKET_URI"
]
}
],
@@ -29,7 +29,7 @@
"id": "title:generic,gcp"
},
"source": [
"# E2E ML on GCP: MLOps stage 2 : experimentation: get started with Vertex Training\n",
"# E2E ML on GCP: MLOps stage 2 : experimentation: get started with Vertex AI Training\n",
"\n",
"<table align=\"left\">\n",
" <td>\n",
@@ -39,8 +39,14 @@
" </a>\n",
" </td>\n",
" <td>\n",
" <a href=\"https://console.cloud.google.com/ai/platform/notebooks/deploy-notebook?download_url=https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/ml_ops/stage2/get_started_vertex_training.ipynb\">\n",
" Open in Google Cloud Notebooks\n",
" <a href=\"https://colab.research.google.com/github/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/ml_ops/stage2/get_started_vertex_training.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://console.cloud.google.com/vertex-ai/workbench/deploy-notebook?download_url=https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/main/notebooks/community/ml_ops/stage2/get_started_vertex_training.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>\n",
@@ -56,18 +62,7 @@
"## Overview\n",
"\n",
"\n",
"This tutorial demonstrates how to use Vertex AI for E2E MLOps on Google Cloud in production. This tutorial covers stage 2 : experimentation: get started with Vertex Training."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "dataset:custom,boston,lrg"
},
"source": [
"### Dataset\n",
"\n",
"The dataset used for this tutorial is the [Boston Housing Prices dataset](https://www.cs.toronto.edu/~delve/data/boston/bostonDetail.html). The version of the dataset you will use in this tutorial is built into TensorFlow. The trained model predicts the median price of a house in units of 1K USD."
"This tutorial demonstrates how to use Vertex AI for E2E MLOps on Google Cloud in production. This tutorial covers stage 2 : experimentation: get started with Vertex AI Training."
]
},
{
@@ -119,6 +114,38 @@
"CustomJob"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "dataset:custom,boston,lrg"
},
"source": [
"### Dataset\n",
"\n",
"The dataset used for this tutorial is the [Boston Housing Prices dataset](https://www.cs.toronto.edu/~delve/data/boston/bostonDetail.html). The version of the dataset this tutorial is built into TensorFlow. The trained model predicts the median price of a house in units of 1K USD."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "c480fc50ec3c"
},
"source": [
"### Costs \n",
"\n",
"This tutorial uses billable components of Google Cloud:\n",
"\n",
"* Vertex AI\n",
"* Cloud Storage\n",
"\n",
"\n",
"Learn about [Vertex AI\n",
"pricing](https://cloud.google.com/vertex-ai/pricing) and [Cloud Storage\n",
"pricing](https://cloud.google.com/storage/pricing), and use the [Pricing\n",
"Calculator](https://cloud.google.com/products/calculator/)\n",
"to generate a cost estimate based on your projected usage."
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -127,7 +154,7 @@
"source": [
"## Installations\n",
"\n",
"Install *one time* the packages for executing the MLOps notebooks."
"Install the packages required for executing this notebook"
]
},
{
@@ -138,20 +165,20 @@
},
"outputs": [],
"source": [
"ONCE_ONLY = False\n",
"if ONCE_ONLY:\n",
" ! pip3 install -U tensorflow==2.5 $USER_FLAG\n",
" ! pip3 install -U tensorflow-data-validation==1.2 $USER_FLAG\n",
" ! pip3 install -U tensorflow-transform==1.2 $USER_FLAG\n",
" ! pip3 install -U tensorflow-io==0.18 $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-aiplatform[tensorboard] $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-pipeline-components $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-bigquery $USER_FLAG\n",
" ! pip3 install --upgrade google-cloud-logging $USER_FLAG\n",
" ! pip3 install --upgrade apache-beam[gcp] $USER_FLAG\n",
" ! pip3 install --upgrade pyarrow $USER_FLAG\n",
" ! pip3 install --upgrade cloudml-hypertune $USER_FLAG\n",
" ! pip3 install --upgrade kfp $USER_FLAG"
"import os\n",
"\n",
"# The Vertex AI Workbench Notebook product has specific requirements\n",
"IS_WORKBENCH_NOTEBOOK = os.getenv(\"DL_ANACONDA_HOME\") and not os.getenv(\"VIRTUAL_ENV\")\n",
"IS_USER_MANAGED_WORKBENCH_NOTEBOOK = os.path.exists(\n",
" \"/opt/deeplearning/metadata/env_version\"\n",
")\n",
"\n",
"# Vertex AI Notebook requires dependencies to be installed with '--user'\n",
"USER_FLAG = \"\"\n",
"if IS_WORKBENCH_NOTEBOOK:\n",
" USER_FLAG = \"--user\"\n",
"\n",
"! pip3 install --upgrade google-cloud-aiplatform $USER_FLAG -q"
]
},
{
@@ -173,8 +200,6 @@
},
"outputs": [],
"source": [
"import os\n",
"\n",
"if not os.getenv(\"IS_TESTING\"):\n",
" # Automatically restart kernel after installs\n",
" import IPython\n",
@@ -183,6 +208,36 @@
" app.kernel.do_shutdown(True)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "before_you_begin"
},
"source": [
"## Before you begin\n",
"\n",
"### GPU runtime\n",
"\n",
"*Make sure you're running this notebook in a GPU runtime if you have that option. In Colab, select* **Runtime > Change Runtime Type > GPU**\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 following APIs: Vertex AI APIs, Compute Engine APIs, and Cloud Storage.](https://console.cloud.google.com/flows/enableapi?apiid=aiplatform.googleapis.com,compute_component,storage-component.googleapis.com)\n",
"\n",
"4. If you are running this notebook locally, you need to install the [Cloud SDK]((https://cloud.google.com/sdk)).\n",
"\n",
"5. Enter your project ID in the cell below. Then run the cell to make sure the\n",
"Cloud SDK uses the right project for all the commands in this notebook.\n",
"\n",
"**Note**: Jupyter runs lines prefixed with `!` as shell commands, and it interpolates Python variables prefixed with `$`."
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -259,7 +314,10 @@
},
"outputs": [],
"source": [
"REGION = \"us-central1\" # @param {type: \"string\"}"
"REGION = \"[your-region]\" # @param {type: \"string\"}\n",
"\n",
"if REGION == \"[your-region]\":\n",
" REGION = \"us-central1\""
]
},
{
@@ -286,6 +344,67 @@
"TIMESTAMP = datetime.now().strftime(\"%Y%m%d%H%M%S\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "gcp_authenticate"
},
"source": [
"### Authenticate your Google Cloud account\n",
"\n",
"**If you are using Vertex AI Workbench Notebooks**, your environment is already authenticated. Skip this step.\n",
"\n",
"**If you are using Colab**, run the cell below and follow the instructions when prompted to authenticate your account via oAuth.\n",
"\n",
"**Otherwise**, follow these steps:\n",
"\n",
"In the Cloud Console, go to the [Create service account key](https://console.cloud.google.com/apis/credentials/serviceaccountkey) page.\n",
"\n",
"**Click Create service account**.\n",
"\n",
"In the **Service account name** field, enter a name, and click **Create**.\n",
"\n",
"In the **Grant this service account access to project** section, click the Role drop-down list. Type \"Vertex\" into the filter box, and select **Vertex Administrator**. Type \"Storage Object Admin\" into the filter box, and select **Storage Object Admin**.\n",
"\n",
"Click Create. A JSON file that contains your key downloads to your local environment.\n",
"\n",
"Enter the path to your service account key as the GOOGLE_APPLICATION_CREDENTIALS variable in the cell below and run the cell."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "gcp_authenticate"
},
"outputs": [],
"source": [
"# If you are running this notebook in Colab, run this cell and follow the\n",
"# instructions to authenticate your GCP account. This provides access to your\n",
"# Cloud Storage bucket and lets you submit training jobs and prediction\n",
"# requests.\n",
"\n",
"import os\n",
"import sys\n",
"\n",
"# If on Vertex AI Workbench, then don't execute this code\n",
"IS_COLAB = False\n",
"if not os.path.exists(\"/opt/deeplearning/metadata/env_version\") and not os.getenv(\n",
" \"DL_ANACONDA_HOME\"\n",
"):\n",
" if \"google.colab\" in sys.modules:\n",
" IS_COLAB = True\n",
" from google.colab import auth as google_auth\n",
"\n",
" google_auth.authenticate_user()\n",
"\n",
" # If you are running this notebook locally, replace the string below with the\n",
" # path to your service account key and run this cell to authenticate your GCP\n",
" # account.\n",
" elif not os.getenv(\"IS_TESTING\"):\n",
" %env GOOGLE_APPLICATION_CREDENTIALS ''"
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -309,7 +428,8 @@
},
"outputs": [],
"source": [
"BUCKET_NAME = \"gs://[your-bucket-name]\" # @param {type:\"string\"}"
"BUCKET_NAME = \"[your-bucket-name]\" # @param {type:\"string\"}\n",
"BUCKET_URI = f\"gs://{BUCKET_NAME}\""
]
},
{
@@ -320,8 +440,9 @@
},
"outputs": [],
"source": [
"if BUCKET_NAME == \"\" or BUCKET_NAME is None or BUCKET_NAME == \"gs://[your-bucket-name]\":\n",
" BUCKET_NAME = \"gs://\" + PROJECT_ID + \"aip-\" + TIMESTAMP"
"if BUCKET_NAME == \"\" or BUCKET_NAME is None or BUCKET_NAME == \"[your-bucket-name]\":\n",
" BUCKET_NAME = PROJECT_ID + \"aip-\" + TIMESTAMP\n",
" BUCKET_URI = \"gs://\" + BUCKET_NAME"
]
},
{
@@ -341,7 +462,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l $REGION $BUCKET_NAME"
"! gsutil mb -l $REGION $BUCKET_URI"
]
},
{
@@ -361,7 +482,7 @@
},
"outputs": [],
"source": [
"! gsutil ls -al $BUCKET_NAME"
"! gsutil ls -al $BUCKET_URI"
]
},
{
@@ -384,7 +505,7 @@
},
"outputs": [],
"source": [
"import google.cloud.aiplatform as aip"
"import google.cloud.aiplatform as aiplatform"
]
},
{
@@ -406,7 +527,7 @@
},
"outputs": [],
"source": [
"aip.init(project=PROJECT_ID, staging_bucket=BUCKET_NAME)"
"aiplatform.init(project=PROJECT_ID, staging_bucket=BUCKET_URI)"
]
},
{
@@ -441,7 +562,7 @@
"source": [
"if os.getenv(\"IS_TESTING_TRAIN_GPU\"):\n",
" TRAIN_GPU, TRAIN_NGPU = (\n",
" aip.gapic.AcceleratorType.NVIDIA_TESLA_K80,\n",
" aiplatform.gapic.AcceleratorType.NVIDIA_TESLA_K80,\n",
" int(os.getenv(\"IS_TESTING_TRAIN_GPU\")),\n",
" )\n",
"else:\n",
@@ -449,7 +570,7 @@
"\n",
"if os.getenv(\"IS_TESTING_DEPLOY_GPU\"):\n",
" DEPLOY_GPU, DEPLOY_NGPU = (\n",
" aip.gapic.AcceleratorType.NVIDIA_TESLA_K80,\n",
" aiplatform.gapic.AcceleratorType.NVIDIA_TESLA_K80,\n",
" int(os.getenv(\"IS_TESTING_DEPLOY_GPU\")),\n",
" )\n",
"else:\n",
@@ -484,7 +605,7 @@
"if os.getenv(\"IS_TESTING_TF\"):\n",
" TF = os.getenv(\"IS_TESTING_TF\")\n",
"else:\n",
" TF = \"2.1\".replace(\".\", \"-\")\n",
" TF = \"2.5\".replace(\".\", \"-\")\n",
"\n",
"if TF[0] == \"2\":\n",
" if TRAIN_GPU:\n",
@@ -602,7 +723,7 @@
"DISPLAY_NAME = \"boston_\" + TIMESTAMP\n",
"REQUIREMENTS = [\"tensorflow==2.3\"]\n",
"\n",
"job = aip.CustomTrainingJob(\n",
"job = aiplatform.CustomTrainingJob(\n",
" display_name=DISPLAY_NAME,\n",
" script_path=\"task.py\",\n",
" requirements=REQUIREMENTS,\n",
@@ -693,12 +814,12 @@
"outputs": [],
"source": [
"CMDARGS = [\n",
" \"--model-dir=\" + BUCKET_NAME,\n",
" \"--model-dir=\" + BUCKET_URI,\n",
"]\n",
"\n",
"job.run(args=CMDARGS, replica_count=1, machine_type=TRAIN_COMPUTE, sync=True)\n",
"\n",
"! gsutil cat {BUCKET_NAME}/test.txt"
"! gsutil cat {BUCKET_URI}/test.txt"
]
},
{
@@ -768,9 +889,9 @@
"source": [
"DISPLAY_NAME = \"boston_\" + TIMESTAMP\n",
"\n",
"job = aip.CustomPythonPackageTrainingJob(\n",
"job = aiplatform.CustomPythonPackageTrainingJob(\n",
" display_name=DISPLAY_NAME,\n",
" python_package_gcs_uri=f\"{BUCKET_NAME}/trainer_boston.tar.gz\",\n",
" python_package_gcs_uri=f\"{BUCKET_URI}/trainer_boston.tar.gz\",\n",
" python_module_name=\"trainer.task\",\n",
" container_uri=TRAIN_IMAGE,\n",
")"
@@ -900,7 +1021,7 @@
"! rm -f custom.tar custom.tar.gz\n",
"! tar cvf custom.tar custom\n",
"! gzip custom.tar\n",
"! gsutil cp custom.tar.gz $BUCKET_NAME/trainer_boston.tar.gz"
"! gsutil cp custom.tar.gz $BUCKET_URI/trainer_boston.tar.gz"
]
},
{
@@ -922,11 +1043,11 @@
},
"outputs": [],
"source": [
"CMDARGS = [\"--model-dir=\" + BUCKET_NAME, \"--epochs=5\"]\n",
"CMDARGS = [\"--model-dir=\" + BUCKET_URI, \"--epochs=5\"]\n",
"\n",
"job.run(args=CMDARGS, replica_count=1, machine_type=TRAIN_COMPUTE, sync=True)\n",
"\n",
"! gsutil cat {BUCKET_NAME}/test.txt"
"! gsutil cat {BUCKET_URI}/test.txt"
]
},
{
@@ -1151,7 +1272,11 @@
},
"outputs": [],
"source": [
"! docker build custom -t $TRAIN_IMAGE"
"if not IS_COLAB:\n",
" ! docker build custom -t $TRAIN_IMAGE\n",
"else:\n",
" # install docker daemon\n",
" ! apt-get -qq install docker.io"
]
},
{
@@ -1173,7 +1298,8 @@
},
"outputs": [],
"source": [
"! docker run $TRAIN_IMAGE --epochs=5 --model-dir=./"
"if not IS_COLAB:\n",
" ! docker run $TRAIN_IMAGE --epochs=5 --model-dir=./"
]
},
{
@@ -1195,7 +1321,38 @@
},
"outputs": [],
"source": [
"! docker push $TRAIN_IMAGE"
"if not IS_COLAB:\n",
" ! docker push $TRAIN_IMAGE"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "f50e9c553fb7"
},
"source": [
"*Executes in Colab*"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "a7e8c98f1e56"
},
"outputs": [],
"source": [
"%%bash -s $IS_COLAB $TRAIN_IMAGE\n",
"if [ $1 == \"False\" ]; then\n",
" exit 0\n",
"fi\n",
"set -x\n",
"dockerd -b none --iptables=0 -l warn &\n",
"for i in $(seq 5); do [ ! -S \"/var/run/docker.sock\" ] && sleep 2 || break; done\n",
"docker build custom -t $2\n",
"docker run $2 --epochs=5 --model-dir=./\n",
"docker push $2\n",
"kill $(jobs -p)"
]
},
{
@@ -1229,7 +1386,7 @@
},
"outputs": [],
"source": [
"job = aip.CustomContainerTrainingJob(\n",
"job = aiplatform.CustomContainerTrainingJob(\n",
" display_name=\"boston_\" + TIMESTAMP,\n",
" container_uri=TRAIN_IMAGE,\n",
" command=[\"python3\", \"trainer/task.py\"],\n",
@@ -1257,11 +1414,11 @@
},
"outputs": [],
"source": [
"CMDARGS = [\"--model-dir=\" + BUCKET_NAME, \"--epochs=5\"]\n",
"CMDARGS = [\"--model-dir=\" + BUCKET_URI, \"--epochs=5\"]\n",
"\n",
"job.run(args=CMDARGS, replica_count=1, machine_type=TRAIN_COMPUTE, sync=True)\n",
"\n",
"! gsutil cat {BUCKET_NAME}/test.txt"
"! gsutil cat {BUCKET_URI}/test.txt"
]
},
{
@@ -1466,7 +1623,7 @@
"! rm -f custom.tar custom.tar.gz\n",
"! tar cvf custom.tar custom\n",
"! gzip custom.tar\n",
"! gsutil cp custom.tar.gz $BUCKET_NAME/trainer_boston.tar.gz"
"! gsutil cp custom.tar.gz $BUCKET_URI/trainer_boston.tar.gz"
]
},
{
@@ -1496,7 +1653,7 @@
"if os.getenv(\"IS_TESTING_TF\"):\n",
" TF = os.getenv(\"IS_TESTING_TF\")\n",
"else:\n",
" TF = \"2.1\".replace(\".\", \"-\")\n",
" TF = \"2.5\".replace(\".\", \"-\")\n",
"\n",
"if TF[0] == \"2\":\n",
" if TRAIN_GPU:\n",
@@ -1551,9 +1708,9 @@
"source": [
"DISPLAY_NAME = \"boston_\" + TIMESTAMP\n",
"\n",
"job = aip.CustomPythonPackageTrainingJob(\n",
"job = aiplatform.CustomPythonPackageTrainingJob(\n",
" display_name=DISPLAY_NAME,\n",
" python_package_gcs_uri=f\"{BUCKET_NAME}/trainer_boston.tar.gz\",\n",
" python_package_gcs_uri=f\"{BUCKET_URI}/trainer_boston.tar.gz\",\n",
" python_module_name=\"trainer.task\",\n",
" container_uri=TRAIN_IMAGE,\n",
" model_serving_container_image_uri=DEPLOY_IMAGE,\n",
@@ -1587,12 +1744,12 @@
},
"outputs": [],
"source": [
"MODEL_DIR = \"{}/{}\".format(BUCKET_NAME, TIMESTAMP)\n",
"MODEL_DIR = \"{}/{}\".format(BUCKET_URI, TIMESTAMP)\n",
"\n",
"EPOCHS = 20\n",
"STEPS = 100\n",
"\n",
"DIRECT = True\n",
"DIRECT = False\n",
"if DIRECT:\n",
" CMDARGS = [\n",
" \"--model-dir=\" + MODEL_DIR,\n",
@@ -1758,17 +1915,7 @@
"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",
"\n",
"- Dataset\n",
"- Pipeline\n",
"- Model\n",
"- Endpoint\n",
"- AutoML Training Job\n",
"- Batch Job\n",
"- Custom Job\n",
"- Hyperparameter Tuning Job\n",
"- Cloud Storage Bucket"
"Otherwise, you can delete the individual resources you created in this tutorial."
]
},
{
@@ -1779,61 +1926,24 @@
},
"outputs": [],
"source": [
"delete_all = True\n",
"delete_bucket = False\n",
"delete_model = True\n",
"delete_job = True\n",
"\n",
"if delete_all:\n",
" # Delete the dataset using the Vertex dataset object\n",
"if delete_model:\n",
" try:\n",
" if \"dataset\" in globals():\n",
" dataset.delete()\n",
" model.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" # Delete the model using the Vertex model object\n",
"if delete_job:\n",
" try:\n",
" if \"model\" in globals():\n",
" model.delete()\n",
" job.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" # Delete the endpoint using the Vertex endpoint object\n",
" try:\n",
" if \"endpoint\" in globals():\n",
" endpoint.undeploy_all()\n",
" endpoint.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" # Delete the AutoML or Pipeline training job\n",
" try:\n",
" if \"dag\" in globals():\n",
" dag.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" # Delete the custom training job\n",
" try:\n",
" if \"job\" in globals():\n",
" job.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" # Delete the batch prediction job using the Vertex batch prediction object\n",
" try:\n",
" if \"batch_predict_job\" in globals():\n",
" batch_predict_job.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" # Delete the hyperparameter tuning job using the Vertex hyperparameter tuning object\n",
" try:\n",
" if \"hpt_job\" in globals():\n",
" hpt_job.delete()\n",
" except Exception as e:\n",
" print(e)\n",
"\n",
" if \"BUCKET_NAME\" in globals():\n",
" ! gsutil rm -r $BUCKET_NAME"
"if delete_bucket or os.getenv(\"IS_TESTING\"):\n",
" ! gsutil rm -rf {BUCKET_URI}"
]
}
],
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More