Compare commits

...
Author SHA1 Message Date
KCFindstrandGitHub b94d774e1d Update the server port in model_garden_keras_stable_diffusion.ipynb 2024-06-21 10:49:11 -07:00
8eb2aa93d5 Add new model Claude 3.5 Sonnet and update regions for other models (#3112)
* add new model and update region for others

* fix minor error

---------

Co-authored-by: Huy Ngo <huyngo@google.com>
2024-06-20 18:22:34 +00:00
sefgsefgandGitHub 3947a8bc24 Upload torch transformers predictor sample (#3087)
This sample uses the aiplatform SDK and torch library to implement transformers predictor.
2024-06-20 12:39:50 +00:00
Eric DongandGitHub 022e1c8ee7 Update README.md 4 (#3104)
Add Get started section
2024-06-18 21:47:37 +00:00
cec3f9dd55 refactor: refactor llama3 deployment nb (#3100)
Co-authored-by: Rayan Dasoriya <dasoriya@google.com>
2024-06-18 12:36:46 +00:00
70ebb04f06 Update llama3 finetuning notebook to use 4 A100s instead of 8 (#3105)
Co-authored-by: minwoopark <minwoopark@google.com>
2024-06-18 12:31:42 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
fd21267d70 chore(deps): bump scikit-learn (#3106)
Bumps [scikit-learn](https://github.com/scikit-learn/scikit-learn) from 1.3.2 to 1.5.0.
- [Release notes](https://github.com/scikit-learn/scikit-learn/releases)
- [Commits](https://github.com/scikit-learn/scikit-learn/compare/1.3.2...1.5.0)

---
updated-dependencies:
- dependency-name: scikit-learn
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-18 12:31:00 +00:00
Eric DongandGitHub 77e0230eb8 Update README.md 3 (#3103)
Add usage section
2024-06-17 14:51:12 +00:00
8895075d28 chore: renames 'matching_engine' to 'vector_search' and 'Matching Engine' to 'Vector Search' (#3096)
Co-authored-by: krishr2d2 <krishna.movva@egen.ai>
2024-06-17 12:40:24 +00:00
Katie NguyenandGitHub f381ae9817 feat: add colab enterprise link format to script (#3097) 2024-06-17 12:37:28 +00:00
Mend RenovateandGitHub 0b623038fa chore(deps): update dependency flake8 to v7.1.0 (#3099) 2024-06-17 12:36:41 +00:00
7cd354436e chore, refactor, fix, feat(egen): template structure+K80GPU+contract words+clean up (#3085)
* chore, refactor, fix, feat: template structure, removes redundant code, contracts content, replaces K80 with T4, cleans up local files

* chore,chore, fix: addresses review comments+ sets replica=1,accelerator_count=4

* fix, chore: reduces the GPU count to 1, rewords the title

---------

Co-authored-by: krishr2d2 <krishna.movva@egen.ai>
2024-06-14 21:12:17 +00:00
Eric DongandGitHub d7c334353c Update README.md 2 (#3091)
Continued to update README.
2024-06-14 17:10:37 +00:00
kittyabsandGitHub ba80e59b1e Update tensorboard_vertex_ai_pipelines_integration.ipynb (#3036)
* Update tensorboard_vertex_ai_pipelines_integration.ipynb

added colab enterprise link and icon. Deleted <br> line, too

* Update tensorboard_vertex_ai_pipelines_integration.ipynb

fixed - added missing .ipynb
2024-06-14 14:23:43 +00:00
62b3f0af1b Update llama3 finetuning notebook (#3090)
* Update llama3 finetuning notebook

* Update model_garden_pytorch_llama3_finetuning.ipynb

fix linter issue

* Update model_garden_pytorch_llama3_finetuning.ipynb

Remove unnecessary metadata

---------

Co-authored-by: minwoopark <minwoopark@google.com>
2024-06-13 23:54:58 +00:00
bd10dede25 refactor(egen): follows new template+sentence and other minor corrections (#3073)
* chore: restructures according to template, contracts text and cells, organizes headings

* refactor: removes the IS_TESTING conditions for steps involving redis instance

* chore: addresses review comments

* fix: adds back the IS_TESTING conditions for redis commands to skip in the test environment

* chore: removes duplicate comment

---------

Co-authored-by: krishr2d2 <krishna.movva@egen.ai>
2024-06-13 20:52:43 +00:00
7e8bf8a126 fix, refactor, chore(egen): follows new template, adds dataflow enable step, refactor (#3089)
* Updated template of notebook

* fix, refactor, chore: follows new template, adds dataflow enable step, cleanup steps for files, removes IS_TESTING in cleanup, REGION==>LOCATION

* chore: addresses the review comments

---------

Co-authored-by: nileshspringml <nilesh.mahajan@egen.ai>
Co-authored-by: krishr2d2 <krishna.movva@egen.ai>
2024-06-13 20:36:50 +00:00
nileshspringmlandGitHub 847d38642c refactor, chore(egen): Removes boilerplate, heading fixes, and other corrections from template (#3086)
* Did required changes in notebook template

* Service account permission changed as we don't need admin level access for this notebook

* Fixed issue based on PR feedback
2024-06-13 20:31:07 +00:00
Gary WeiandGitHub 697a4c6e88 Add dreambooth-lora-sdxl task for SDXL base model in the dreambooth finetune Gradio notebook. (#3082)
* Add controlnet-canny to the Gradio playground, and some additional UX enhancement.

* Minor fixes.

* Minor fixes

* Add additional document regarding the list of supported models, and some UI enhancement.

* Minor update to the hyperlink.

* Rewrite the SD2.1 dreambooth finetune notebook.

* Add code owners.

* Some minor changes to the stable diffusion 2.1 and sd-xl notebooks.

* some additional minor fixes.

* additional fixes.

* Create a notebook to demonstrate dreambooth LoRA finetune for SD-XL model.

* minor updates

* add to the codeowner list.

* merge conflict.

* minor fix to the Gradio UI workshop notebook.

* Some minor updates to the SD2.1 deployment notebook.

* Minor update the `sd-xl` deployment notebook, based on the QA feedback.

* Add a few community models to the Gradio workshop.

* Switch `mediapipe-train` docker container from `vertex-ai-restricted` to `vertex-ai`, in the `mediapipe-train` notebooks.

* Create a notebook for model `instantx/instantid`.

* Update Gradio notebook to use the latest Gradio version and fix some bugs.

1. Update Gradio version to 4.29.0, as it complains 3.50.0 is too old.
2. Uninstall nest-asyncio and uvloop as a workaround to b/339301920 and https://github.com/gradio-app/gradio/issues/8238#issuecomment-2101066984.

* Resolve merge conflict.

* minor updates.

* minor updates.

* Merge some SD notebook in g3 and github.

* Remove the unused variable in the controlnet notebook.

* minor updates.

* include the SD1.5 dreambooth notebook.

* Include the sd1.5 dreambooth notebook.

* Improve the stable diffusion dreambooth tuning CUJ in the Gradio notebook.

* minor update.

* Add dreambooth-lora-sdxl task for SDXL base model in the dreambooth finetune Gradio notebook.
2024-06-13 14:01:39 +00:00
f5c17c0700 refactor, chore, feat(egen): contracts content, steps & template based fixes (#3075)
* refactor, chore, feat: removes/contracts long explanations, template based fixes, adds step to remove locally generated files

* fix: adds the missing import, replaces code markdown with bold style at some places

* fix: replaces REGION with LOCATION

* chore: addresses review comments

---------

Co-authored-by: krishr2d2 <krishna.movva@egen.ai>
2024-06-12 22:37:30 +00:00
0e662eca2b refactor, chore(egen): Uses gcloud builds for building and pushing image to artifact registry, Removes boilerplate, heading fixes, and other corrections from template (#3074)
* <refactor>: refactored code according to notebook template

* <refactor>: refactored code according to notebook template

* <refactor>: refactored code according to notebook template

* <refactor,chore> refactored notebook according to template

* <refactor,chore> refactored notebook according to template

* fix for  docker repository creation in PR test environment

* <included IS_TESTING condition for docker repository

* lint fix

* Apply suggested edits from @kittyabs review

---------

Co-authored-by: SumanthKasula99 <sumanth.kasula@egen.ai>
2024-06-12 17:28:01 +00:00
Eric DongandGitHub d339690a4b Update README.md (#3088)
Update the overview with link to generative-ai repo
2024-06-12 17:08:54 +00:00
Mend RenovateandGitHub 134a6221e6 chore(deps): update dependency pyupgrade to v3.16.0 (#3066) 2024-06-11 19:14:25 +00:00
kittyabsandGitHub e79c4b5caa Update get_started_with_pytorch_rov.ipynb (#3034)
Update colab enterprise logo
2024-06-11 19:13:18 +00:00
Kathy YuandGitHub 535a6232d3 Remove legacy Llama 2 notebook. (#3083) 2024-06-11 19:11:11 +00:00
KCFindstrandGitHub f49e09698e Fix broken links in model garden notebooks (#3077)
* Fix broken links in notebooks

PiperOrigin-RevId: 641077957

* Revert llama3 deployment notebook change
2024-06-11 19:10:16 +00:00
Gary WeiandGitHub 792e3b16a5 Update the diffusers serving docker image to 20240605_1400_RC00 to resolve vulnerabilities. (#3079)
* Create a Gradio notebook for the new InstantId model.

* Add dreambooth finetune to the stable diffusion Gradio workshop notebook.

* Update the image generation Gradio notebook to support Dreambooth finetuning.

* linter update

* linter update

* minor fix to the instant-id notebook.

* Minor fix to the stable diffusion gradio notebook.

* Split the 'instant-id' deployment notebook prediction into two sections.

* add `deployment_source` to the notebook.

* Switch to `pytorch-diffusers-serve-opt` container to for diffusion lora serving.

* add the dreambooth_lora notebook.

* minor update.

* Parameterize the "show_debug_logs" to facilitate automatic test of the Gradio notebooks.

* Lint format.

* minor updates

* Delete the two deprecated SD1.5 and 2.1 notebooks, as they were no longer referenced on any model cards.

* Sync Colab notebooks between g3 and github.

* format changes

* format update.

* Improve the SDXL-dreambooth-lora finetune notebook CUJ.

* Update the diffusers serving docker image version to `20240605_1400_RC00` to resolve vulnerabilities.

* Add dreambooth-lora-sdxl task for SDXL base model in the dreambooth finetune Gradio notebook.

* Add dreambooth-lora-sdxl task for SDXL base model in the dreambooth finetune Gradio notebook.

* Add dreambooth-lora-sdxl task for SDXL base model in the dreambooth finetune Gradio notebook.
2024-06-11 19:09:30 +00:00
Kaushik KoiladaandGitHub fbcf3b4cc8 chore, refactor(Egen): restructure from template, remove boilerplate, and fix notebook (#3068)
* chore: updates copyright text, adds colab enterprise and for

* chore: removes boilerplate and changes colab authentication and get started section

* refactor: removes IS_TESTING and other test code

* refactor: removes IS_TESTING and other test code

* chore: clear all outputs and linter reformatting

* chore: removes code added for testing and other fixes

* chore: runs lint

* fix: fixes testing induced bug

* chore: review comments with header and copyright changes addressed
2024-06-11 18:27:36 +00:00
ac8f7ad196 chore, fix, feat(egen): follows template + fix docker run + adds clean up (#3072)
* chore, fix: restructures as per template, rewords some sentences, removes sudo in the option docker run

* feat: adds clean up step for local files

* chore: reverts lowercase to camelcase for artifact registry and other review comments

---------

Co-authored-by: krishr2d2 <krishna.movva@egen.ai>
2024-06-11 18:06:50 +00:00
Kaushik KoiladaandGitHub 4e21510eeb refactor, chore, fix (Egen) : removes boilerplate and fixes notebook pytorch_train_deploy_models_with_prebuilt_containers.ipynotebook (#3070)
* chore: updates the license

* chore: formats run in buttons and adds colab enterprise link

* chore: removes code font for names of products

* refactor: removes boilerplate and edits aiplatform initialization cell order

* fix: changes naming of app to deal with setup changing tar.gz file to canonical name and gsutil command not able to find it

* chore: linter run

* chore: edit all the future tense sentences

* chore: updates review comments
2024-06-11 18:01:11 +00:00
Rohith AllaandGitHub 04059ebadb refactor(egen): Refactored the Custom tabular bq managed dataset code as per template guidelines (#3053)
* refactor: Refactored custom-tabular-bq-managed-dataset code according to the template notebook

* refactor: Included markdown code in the beginning of the license cell to make it collapsible

* chore: linter test

* refactor, chore: Updated markdown according to the updated notebook template and performed linter test

* chore: Grouped all the imports present in the notebook

* chore: linter test

* refactor, chore(egen): REGION is replaced with LOCATION, linter test
2024-06-11 17:53:12 +00:00
Kaushik KoiladaandGitHub acb4fbb684 refactor, fix, chore(Egen): changes and refactors the get_started_vertex_training_xgboost.ipynb notebook (#3069)
* chore: updates license information, adds colab enterprise, and reformats run buttons

* chore: 'will' replaced appropriately

* chore: updates region and removes boilerplate

* fix: corrects the argument at pip install

* refactor: refactoring the cells for end to end functionality

* chore: changes verbiage in bucket creation

* chore: linter test done

* refactor: rearrage cell order for aiplatform initialization

* chore: review comments addressed

* chore: review comments addressed
2024-06-11 17:48:44 +00:00
Rohith AllaandGitHub 32934925f6 refactor(egen): Refactored custom batch prediction feature filter code according to template guidelines (#3052)
* refactor: Refactored custom_batch_prediction_feature_filter code according to the template notebook

* refactor: Updated markdown according to the updated notebook template and did linter test

* chore: Modified code according to updated template

* chore: linter test

* refactor, chore(egen): REGION is replaced with LOCATION, linter test
2024-06-11 17:40:16 +00:00
Rohith AllaandGitHub daab623cac refactor, chore: Updated markdown according to the updated notebook template and performed linter test (#3063) 2024-06-07 23:12:01 +00:00
Rohith AllaandGitHub dad35742de fix, refactor(egen): Replaced tf2-gpu.2-5 with tf2-gpu.2-6, Refactored the code as per template guidelines (#3064)
* refactor: Updated markdown according to the updated notebook template

* refactor, chore: Added colab enterprise logo url and performed  linter test

* refactor, chore: Reverted back the max trail count and parallel trail count values, performed linter test
2024-06-07 21:30:06 +00:00
Rohith AllaandGitHub f7b49ebb40 refactor(egen): Refactored the Autosxs check alignment against human preference data code as per template guidelines (#3062)
* refactor, chore: Updated markdown according to the updated notebook template and performed linter test

* Revert "refactor, chore: Updated markdown according to the updated notebook template and performed linter test"

This reverts commit c91fa09431.

* refactor, chore: Updated markdown according to the updated notebook template and performed linter test
2024-06-07 21:24:53 +00:00
nileshspringmlandGitHub 95ffea1915 refactor, chore(egen): Removes boilerplate, heading fixes, and other corrections from template (#3058)
* Did all the required changes in notebook

* Added below comments:
# @title Copyright & License (click to expand)

* Upadated the template of notebook

* Fixed issue based on the feedback given on PR
2024-06-07 21:20:07 +00:00
nileshspringmlandGitHub 7e6122a50d refactor, chore(egen): Removes boilerplate, heading fixes, and other corrections from template (#3046)
* refactor, chore(egen): Removes boilerplate, heading fixes, and other corrections from template

* Added Below line in comments:
# @title Copyright & License (click to expand)

* Fixed issue in notebook based on feedback given by reviewer in PR

* Fixed issue based on feedback given on PR
2024-06-07 21:15:20 +00:00
7afdeb05f5 chore, fix(egen): corrections from template, guidelines, & fixes docker tag command (#3031)
* chore: replaces K80 with T4, Cloud ML with Vertex AI, REGION with LOCATION, restructures from template, & removes future tense

* fix: fixes the docker tag command for colab

* chore, fix: addresses the review comments, tf is pinned to 2.15.1 as the latest tf causes issues

* chore: replaces of with or

* chore: removes the collapsed license comment

* fix: removes the test env specific package update step and contracts the installations into one step to keep tf as 2.15

---------

Co-authored-by: krishr2d2 <krishna.movva@egen.ai>
2024-06-07 21:10:09 +00:00
2df29ec118 chore, fix(egen): restructuring from template, markdown corrections & dataset object fix (#3028)
* chore: restructures according to the template, removes future tense, removes IS_TESTING, unused imports

* chore, fix: addresses the review comments, converts npy array to list for running in py-3.9

* chore: adds --it's-- in the sentence

* chore: Getting started -->  Get started

* chore: removes the collapsed license comment

* fix: extracts list from numpy objects instead of Dataset object

---------

Co-authored-by: krishr2d2 <krishna.movva@egen.ai>
2024-06-07 20:58:54 +00:00
nileshspringmlandGitHub c2cd389201 refactor, chore(egen): Removes boilerplate, heading fixes, and other corrections from template (#3020)
* Completed code fixing for file prediction/pytorch_image_classification_with_prebuilt_serving_containers.ipynb. Please note that we need to execute file end to end.

* Added Colab Enterprice link and testead once again with different environment as previously it was throwing an expecption of  libraries

* Added below comment:
# @title Copyright & License (click to expand)

* Fixed issue in notebook based on feedback given by reviewer in PR

* Fixed issue based on feedback give on PR
2024-06-07 20:54:10 +00:00
nileshspringmlandGitHub b30a230d1d refactor, chore(egen): Removes boilerplate, heading fixes, and other corrections from template (#3019)
* Fix code of file prediction/get_started_with_raw_predict.ipynb

* Added link of Colab Enterprise

* Updated create bucket command because it requried those changes to execute in google colab notebook

* Removed IS_TESTING environment variable

* Added below comment in notebook:
# @title Copyright & License (click to expand)

* Fixed issue in notebook based on feedback given by reviewer in PR

* Fixed issue based on the feedback given on PR
2024-06-07 20:51:24 +00:00
Aiden010200andGitHub c5be708d45 Update func of computing resources recycling (#3043)
* Upload examples of kfp v2

* Upload run experiment example.

* Upload batch prediction job sample.

* Update recycling of computing resources

Recycling computing resources after predictions.

* Upload missing file

Add delete endpoint func to recycle resources.
2024-06-07 12:39:33 +00:00
Gary WeiandGitHub bc577d9f79 Improve the SDXL-dreambooth-lora finetune notebook CUJ. (#3055)
* Create a Gradio notebook for the new InstantId model.

* Add dreambooth finetune to the stable diffusion Gradio workshop notebook.

* Update the image generation Gradio notebook to support Dreambooth finetuning.

* linter update

* linter update

* minor fix to the instant-id notebook.

* Minor fix to the stable diffusion gradio notebook.

* Split the 'instant-id' deployment notebook prediction into two sections.

* add `deployment_source` to the notebook.

* Switch to `pytorch-diffusers-serve-opt` container to for diffusion lora serving.

* add the dreambooth_lora notebook.

* minor update.

* Parameterize the "show_debug_logs" to facilitate automatic test of the Gradio notebooks.

* Lint format.

* minor updates

* Delete the two deprecated SD1.5 and 2.1 notebooks, as they were no longer referenced on any model cards.

* Sync Colab notebooks between g3 and github.

* format changes

* format update.

* Improve the SDXL-dreambooth-lora finetune notebook CUJ.
2024-06-07 12:36:14 +00:00
KCFindstrandGitHub 1fcafd3364 Fix accelerator_type variable name case in quota checks (#3061)
PiperOrigin-RevId: 640634353
2024-06-07 12:34:21 +00:00
be31756dac refactor, chore(egen): Claude documentation link update, Text explanations for required cells and other corrections from template (#3027)
* <refactor> refactored notebook according to template

* <refactor> refactored notebook according to template

* <refactor> refactored notebook according to template

* <refactor>: refactored notebook according to new notebook template

* <refactor>: refactored notebook according to new notebook template

* <refactor>: refactored notebook according to new notebook template

---------

Co-authored-by: SumanthKasula99 <sumanth.kasula@egen.ai>
2024-06-06 23:03:34 +00:00
868e49224b refactor(egen): Removes boilerplate, heading fixes, and other corrections from template (#3026)
* <refactor>: refactored code according to notebook template

* <refactor>: refactored code according to notebook template

* <refactor>: refactored code according to notebook template

* <refactor>: refactored code according to notebook template

* <refactor>: refactored code according to new notebook template

* <refactor>: refactored code according to new notebook template

* <refactor>: refactored code according to new notebook template

* <refactor>: refactored notebook according to new notebook template

* <refactor>: refactored notebook according to new notebook template

---------

Co-authored-by: SumanthKasula99 <sumanth.kasula@egen.ai>
2024-06-06 23:01:07 +00:00
nileshspringmlandGitHub 32caaaa7d9 Updated notebook template (#3059)
* Updated notebook template based on google team comment on PR

* Removed unwated comment line from notebook
2024-06-06 13:12:57 +00:00
Rohith AllaandGitHub 521f58b7e6 refactor(egen): Refactored Text embedding api semantic search with scann code according to template guidelines (#3024)
* <refactor>: Refactored text_embedding_api_semantic_search_with_scann code according to the notebook template

* chore: linter test

* refactor: Modified colab enterprise logo url and made necessary changes according to the updated notebook template

* chore: linter test
2024-06-05 20:59:54 +00:00
030024cc51 refactor, chore, fix(egen): GPU usage fixes, template & markdown fixes (#3050)
* refactor, chore, fix: replaces K80 with T4, fixes to follow the template, fixes to utilize the defined accelerators while training

* chore: addresses the review comments

---------

Co-authored-by: krishr2d2 <krishna.movva@egen.ai>
2024-06-05 20:51:27 +00:00
Rohith AllaandGitHub dc38b9e0f9 refactor(egen): Refactored text embedding new api code according to the template guidelines (#3051)
* refactor: Refactored text_embedding_new_api code according to the template notebook

* refactor: Modified colab enterprise logo url and made necessary changes according to the updated notebook template
2024-06-05 20:12:57 +00:00
Amy WuandGitHub cd95c35cc2 remove data science package samples since they are deprecated (#3056) 2024-06-04 23:49:20 +00:00
4e04f7d166 Template vertex ai (#3054)
* Update build_model_experimentation_lineage_with_prebuild_code.ipynb

added colab enterprise logo and link

* Update build_model_experimentation_lineage_with_prebuild_code.ipynb

hope I fixed the JSON issue

* Update notebook_template.ipynb

- changed "Getting Started" to "Get started" to be in compliance with style guide
- added "for Python" to "Vertex AI SDK" to be in compliance with product guidelines

* fix: reset changes

---------

Co-authored-by: Katie Nguyen <21978337+katiemn@users.noreply.github.com>
2024-06-04 18:02:17 +00:00
bc14b3fa05 refactor, chore(egen): Removes boilerplate, heading fixes, and other corrections from template (#3045)
* <refactor>: refactored code according to notebook template

* <refactor> refactored notebook according to template

---------

Co-authored-by: SumanthKasula99 <sumanth.kasula@egen.ai>
2024-06-04 08:20:36 +00:00
db9c182716 refactor, chore(egen): Removes boilerplate, heading fixes, and other corrections from template (#3021)
* refactor: removes boilerplate code, future tenses, and fixes heading styles

* chore: replaces REGION with LOCATION to match the notebook template

* chore: markdown heading fixes according to guidelines

---------

Co-authored-by: rohith-egen <rohith.alla@egen.ai>
Co-authored-by: krishr2d2 <krishna.movva@egen.ai>
2024-06-03 23:48:13 +00:00
Rohith AllaandGitHub c240cf6a34 refactor(egen): Refactored the code as per template guidelines (#3015)
* refactored code according to template notebook

* refactored code according to template notebook
2024-06-03 23:46:29 +00:00
lee1premiumandGitHub 78d2d46f80 fix: Comment on Vertex AI workbench. (#3049)
* fix: Comment on Vertex AI workbench.

* fix: Comment on Vertex AI workbench.
2024-06-03 20:04:53 +00:00
54ae9a17b2 chore(egen): removes future tense, adds colab enterprise link, and colab only steps (#3025)
* chore: updates the notebook according to the latest template

* chore: linter test

* refactor: removes IS_TESTING, and os import

* ran linter test using linter.sh

---------

Co-authored-by: rohith-egen <rohith.alla@egen.ai>
Co-authored-by: krishr2d2 <krishna.movva@egen.ai>
2024-06-03 18:24:18 +00:00
kittyabsandGitHub 9251100d25 Update get_started_with_model_registry.ipynb (#3047)
updated icon url: https://cloud.google.com/ml-engine/images/colab-enterprise-logo-32px.png
2024-06-03 18:05:06 +00:00
eccecc8e2b Update ray_cluster_management.ipynb (#3033)
* Update ray_cluster_management.ipynb

Updated logo for Colab Enterprise

* fix: change accelerator type

* fix: alter accelerator type

---------

Co-authored-by: Katie Nguyen <21978337+katiemn@users.noreply.github.com>
2024-06-01 20:48:18 +00:00
263dba54bc fix, refactor(egen): Replaces K80 with T4 GPUs, corrections from template (#3013)
* fix: n1-standard-8 changed to n1-standard-16 and Tesla K80 changed to Tesla T4 + refactored code according to the template

* refactor: keeping the machine types same. Original issue with the K80 accelerators as they're no longer supported

---------

Co-authored-by: rohith-egen <rohith.alla@egen.ai>
Co-authored-by: krishr2d2 <krishna.movva@egen.ai>
2024-06-01 00:15:24 +00:00
86243a1cb7 chore: Refactor the instructions in model_monitoring_v2 notebooks (#3023)
Co-authored-by: SereniCode <binbinf@google.com>
2024-05-31 23:40:23 +00:00
kittyabsandGitHub dd7c60acff Update tensorboard_hyperparameter_tuning_with_hparams.ipynb (#3037)
Add colab enterprise link and logo
2024-05-31 23:24:01 +00:00
kittyabsandGitHub 6901cd24e5 Update tensorboard_profiler_custom_training_with_prebuilt_container.ipynb (#3038)
added colab enterprise link and logo
2024-05-31 23:21:50 +00:00
kittyabsandGitHub 3dae9238f5 Update notebook_template.ipynb (#3029)
update enterprise logo
2024-05-31 23:15:54 +00:00
kittyabsandGitHub 4e8bfb88b3 Update model_garden_gemma_fine_tuning_batch_deployment_on_rov.ipynb (#3032)
update colab enterprise icon
2024-05-31 23:14:54 +00:00
kittyabsandGitHub b6b921ef68 Experiments delete outdated experiments (#3041)
* Update tensorboard_custom_training_with_custom_container.ipynb

added colab enterprise link and logo

* Update comparing_local_trained_models.ipynb

Added colab enterprise logo and link. Also made some edits.

* Update delete_outdated_tensorboard_experiments.ipynb

Updated Colab Enterprise logo
2024-05-31 23:01:12 +00:00
kittyabsandGitHub faf68b59bb Update delete_outdated_tensorboard_experiments.ipynb (#3042)
updated colab enterprise logo
2024-05-31 22:57:11 +00:00
f9351c0e0b Update get_started_with_model_registry.ipynb (#3030)
* Update get_started_with_model_registry.ipynb

add colabe enterprise link

* fix: remove extra line break elements

---------

Co-authored-by: Katie Nguyen <21978337+katiemn@users.noreply.github.com>
2024-05-31 22:51:24 +00:00
kittyabsandGitHub 921b1be406 Update get_started_with_model_registry.ipynb (#3022)
small edits.
2024-05-30 20:01:30 +00:00
Yichen ZhouandGitHub a0ed217801 Create TimesFM notebook for Vertex Model Garden (#3017)
* feat: Create TimesFM notebook.

* fix: updated CODEOWNER of TimesFM notebook

* fix: remove empty line in CODEOWNERS

* Removed unused import inside TimesFM notebook.

* fix: remove unused import and re-format
2024-05-30 18:50:16 +00:00
Tianrui YangandGitHub 8bed394caf fea: upgrade to v1 API in feature store llm grounding tutorial. (#3009)
* Upgrade to v1 API in feature store llm grounding tutorial.

* Sleep for 5min before starting serving to wait for DNS to be ready.

* use data_key in fetch request
2024-05-30 12:44:30 +00:00
c306cfaae1 Add common util functions for notebooks. (#3014)
Co-authored-by: minwoopark <minwoopark@google.com>
2024-05-29 15:23:59 +00:00
fe97c65ea4 Update Gemma and PaliGemma notebooks (#3007)
Co-authored-by: minwoopark <minwoopark@google.com>
2024-05-28 19:35:32 +00:00
Katie NguyenandGitHub 9d0ec7cc62 fix: update colab enterprise link (#3012) 2024-05-28 19:33:43 +00:00
de5146905c fix declare -x AUTO_PROXY="https://proxyconfig.corp.google.com/proxy.pac" (#3011)
declare -x CHROME_REMOTE_DESKTOP_DEFAULT_DESKTOP_SIZES="1600x1200,3840x2160,3840x2560,5120x1440,2160x3840"
declare -x COLORTERM="truecolor"
declare -x CVS_RSH="ssh"
declare -x DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/809963/bus"
declare -x GOOGLE_CLOUD_DISABLE_DIRECT_PATH="truen"
declare -x HISTCONTROL="ignoredups"
declare -x HOME="/usr/local/google/home/minwoopark"
declare -x LANG="en_US.UTF-8"
declare -x LESSCLOSE="/usr/bin/lesspipe %s %s"
declare -x LESSOPEN="| /usr/bin/lesspipe %s"
declare -x LOGNAME="minwoopark"
declare -x LS_COLORS="rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.crdownload=00;90:*.dpkg-dist=00;90:*.dpkg-new=00;90:*.dpkg-old=00;90:*.dpkg-tmp=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:*.swp=00;90:*.tmp=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:"
declare -x MOTD_SHOWN="pam"
declare -x OLDPWD="/tmp/vertex-ai-samples"
declare -x P4CONFIG=".p4config"
declare -x P4MERGE="/google/src/files/head/depot/eng/perforce/mergep4.tcl"
declare -x PARINIT="rTbgqR B=.?_A_a Q=_s>|:"
declare -x PATH="/usr/local/google/home/minwoopark/.local/bin:/usr/lib/google-golang/bin:/usr/local/buildtools/java/jdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
declare -x PWD="/tmp/vertex-ai-samples/notebooks/community/model_garden"
declare -x PYTHONPATH="/usr/local/buildtools/current/sitecustomize"
declare -x RSYNC_RSH="ssh"
declare -x SHELL="/bin/bash"
declare -x SHLVL="1"
declare -x SK_SIGNING_PLUGIN="gnubbyagent"
declare -x SSH_AUTH_KEY=$'ecdsa-sha2-nistp256-cert-v01@openssh.com AAAAKGVjZHNhLXNoYTItbmlzdHAyNTYtY2VydC12MDFAb3BlbnNzaC5jb20AAAAgazEAFZ2eo797Q/VO6uG2HkkShArEPHLKfyjKs/qYq0cAAAAIbmlzdHAyNTYAAABBBJQ0tXAyF9ZYMb4PE8Ev0Qsmg94oZ0skXvnuEHewktkb5R0Iq/01UbI5EC+g4ivkVsT1BEWkfEvK5mkVBYQkKpcZAAAADCmtRAAAAAEAAAAabWlud29vcGFya0Bjb3JwLmdvb2dsZS5jb20AAAAjAAAACm1pbndvb3BhcmsAAAARZ29vZ2xlXG1pbndvb3BhcmsAAAAAZlX9cQAAAABmVxfdAAAAAAAAAMwAAAAYY2VydC1tZXRhZGF0YUBnb29nbGUuY29tAAAAKgAAACYIARIgB1wlRexvZHwhV2JNrjQ1fgtUHfbXqyGq0FjDNs8V9lUgBgAAABVwZXJtaXQtWDExLWZvcndhcmRpbmcAAAAAAAAAF3Blcm1pdC1hZ2VudC1mb3J3YXJkaW5nAAAAAAAAABZwZXJtaXQtcG9ydC1mb3J3YXJkaW5nAAAAAAAAAApwZXJtaXQtcHR5AAAAAAAAAA5wZXJtaXQtdXNlci1yYwAAAAAAAAAAAAABFwAAAAdzc2gtcnNhAAAAAwEAAQAAAQEAvN0ZS5b1OZYtoJ1PSKY4GIwjis1i4zZZ2MBdN/TEYqJIOVsfAtkDrhC9YGSVuyai/kOXwLLnFc5dVDRWHLDSBzoXEgl4QKCmNu9nneV/cMLEq4d03o1DPOSPQGJDq+wep4K9HuRwvzog6wTDA5Kp0loCnWY8MHTbt4S/O2Ro5mvF0x0ec9vccwW1KOtc/CydQiGmevBZOQOyXt8ZCZKEtSOTIPhAE55WK8agtMEsJlHRtcswSg2BJNJMSeUKgL1An/oCE9bKAME/zXVYVK5Fuv4epqccnd3sQW2T8qniOIcEDI4oybDejm6G8VPw/pxieSPbaFGftuLyR/rHS52OhwAAARQAAAAMcnNhLXNoYTItMjU2AAABAB6848edrFMkVv7srR+12gWCcYsAXadttaF9VBNSK7AojCKPQC5axHjdfmGQHkc6FDj5x76wFhW2QoBWF6EEullMA/BBYtUeOYYrRwIQxvG2EshSl6Qyx1JW9RmClgEQa13JDNS+sHaGih0TK/+h1Cll3WcGYL5bSlTjyI4QX9gcoTA12Ctd01xKiMuXTscx+IMw8nyl9hQQ4eucc4FW130gRglHBdqH9VNjPgFXnoffXfC8P7kBKhPfVk9CjNWl3VN7LwEvFXAT40EBqFeK/b+2pKTL9lDEeUkXxDCz39GHWBu8BYd186GVjjjF8hgK01I90/xGldt/cORgorzziko=\n'
declare -x SSH_AUTH_SOCK="/tmp/ssh-XXXXFPQFEs/agent.634059"
declare -x SSH_CLIENT="172.253.30.128 55315 22"
declare -x SSH_CONNECTION="172.253.30.128 55315 192.168.3.61 22"
declare -x SSH_TTY="/dev/pts/1"
declare -x TERM="xterm-256color"
declare -x USER="minwoopark"
declare -x X20_HOME="/google/data/rw/users/mi/minwoopark"
declare -x XDG_DATA_DIRS="/usr/share/gnome:/usr/local/share/:/usr/share/"
declare -x XDG_RUNTIME_DIR="/run/user/809963"
declare -x XDG_SESSION_CLASS="user"
declare -x XDG_SESSION_ID="c45"
declare -x XDG_SESSION_TYPE="tty"
declare -x service_endpoint="aiplatform.googleapis.com" error

Co-authored-by: minwoopark <minwoopark@google.com>
2024-05-28 16:41:55 +00:00
kittyabsandGitHub dd8d7946c4 Tensorboard-intro-4 (#2999)
* Update get_started_with_pytorch_rov.ipynb

This is a test

* update url to /tensorboard-introduction
2024-05-24 14:14:45 +00:00
kittyabsandGitHub 37c0c2c373 Tensorboard-intro-3 (#2997)
* Update get_started_with_pytorch_rov.ipynb

This is a test

* Update URL to point to /tensorboard-introduction
2024-05-24 14:14:13 +00:00
Tianrui YangandGitHub 974c3e866c Update embedding column type to float (#3006) 2024-05-24 14:13:20 +00:00
Kathy YuandGitHub d5b6b42615 Fix GCS bucket handling code in Mixtral deployment notebook. (#3008) 2024-05-24 14:12:49 +00:00
186e886edf feat: add model_monitoring_v2 notebooks (#2988)
Co-authored-by: SereniCode <binbinf@google.com>
2024-05-23 17:28:19 +00:00
Gary WeiandGitHub f597680d44 Improve the stable diffusion dreambooth tuning CUJ in the Gradio notebook: (#3004)
* Add controlnet-canny to the Gradio playground, and some additional UX enhancement.

* Minor fixes.

* Minor fixes

* Add additional document regarding the list of supported models, and some UI enhancement.

* Minor update to the hyperlink.

* Rewrite the SD2.1 dreambooth finetune notebook.

* Add code owners.

* Some minor changes to the stable diffusion 2.1 and sd-xl notebooks.

* some additional minor fixes.

* additional fixes.

* Create a notebook to demonstrate dreambooth LoRA finetune for SD-XL model.

* minor updates

* add to the codeowner list.

* merge conflict.

* minor fix to the Gradio UI workshop notebook.

* Some minor updates to the SD2.1 deployment notebook.

* Minor update the `sd-xl` deployment notebook, based on the QA feedback.

* Add a few community models to the Gradio workshop.

* Switch `mediapipe-train` docker container from `vertex-ai-restricted` to `vertex-ai`, in the `mediapipe-train` notebooks.

* Create a notebook for model `instantx/instantid`.

* Update Gradio notebook to use the latest Gradio version and fix some bugs.

1. Update Gradio version to 4.29.0, as it complains 3.50.0 is too old.
2. Uninstall nest-asyncio and uvloop as a workaround to b/339301920 and https://github.com/gradio-app/gradio/issues/8238#issuecomment-2101066984.

* Resolve merge conflict.

* minor updates.

* minor updates.

* Merge some SD notebook in g3 and github.

* Remove the unused variable in the controlnet notebook.

* minor updates.

* include the SD1.5 dreambooth notebook.

* Include the sd1.5 dreambooth notebook.

* Improve the stable diffusion dreambooth tuning CUJ in the Gradio notebook.

* minor update.
2024-05-23 17:10:40 +00:00
Gary WeiandGitHub 51315ecb2f sync the colab notebooks between g3 and github. (#3003)
* Create a Gradio notebook for the new InstantId model.

* Add dreambooth finetune to the stable diffusion Gradio workshop notebook.

* Update the image generation Gradio notebook to support Dreambooth finetuning.

* linter update

* linter update

* minor fix to the instant-id notebook.

* Minor fix to the stable diffusion gradio notebook.

* Split the 'instant-id' deployment notebook prediction into two sections.

* add `deployment_source` to the notebook.

* Switch to `pytorch-diffusers-serve-opt` container to for diffusion lora serving.

* add the dreambooth_lora notebook.

* minor update.

* Parameterize the "show_debug_logs" to facilitate automatic test of the Gradio notebooks.

* Lint format.

* minor updates

* Delete the two deprecated SD1.5 and 2.1 notebooks, as they were no longer referenced on any model cards.

* Sync Colab notebooks between g3 and github.

* format changes

* format update.
2024-05-23 17:08:23 +00:00
KCFindstrandGitHub 4a16d19cec Reformat llama3 deployment notebook and add quota check (#3001) 2024-05-23 17:07:50 +00:00
kittyabsandGitHub 452c77adb8 Ray-on-vertex-ai-public-access (#3002)
* Update get_started_with_pytorch_rov.ipynb

This is a test

* Addresses a feature request regarding the "warning" when using public access
2024-05-22 22:40:37 +00:00
lee1premiumandGitHub 558e6eed88 feat: Getting Tuned Text-Embeddings tutorial. (#3000)
* feat: Getting Tuned Text-Embeddings tutorial.

* feat: Getting Tuned Text-Embeddings tutorial.

* feat: Getting Tuned Text-Embeddings tutorial.
2024-05-22 21:03:44 +00:00
kittyabsandGitHub 82f32efc30 Tensorboard-intro-2 (#2996)
* Update get_started_with_pytorch_rov.ipynb

This is a test

* updated URL to point to tensorboard-introduction (and not "overview")

* change URL to /tensorboard-introduction
2024-05-21 23:38:53 +00:00
kittyabsandGitHub 4d2ea0d50f Tensorboard-introduction (#2994)
* Update get_started_with_pytorch_rov.ipynb

This is a test

* updated URL to point to tensorboard-introduction (and not "overview")
2024-05-21 20:45:18 +00:00
Manu KumarandGitHub c81c195d46 fix: use renamed create_feature_view() function in embedding notebook (#2993)
Increase sleep for DNS propagation to pass CI.
2024-05-21 20:43:19 +00:00
11d7c6dd7e Add checks to ensure the artifacts are copied to user bucket. (#2992)
Co-authored-by: minwoopark <minwoopark@google.com>
2024-05-21 12:30:21 +00:00
Gary WeiandGitHub 8bb6aa592a Merge a few SD notebooks in g3 and github (#2989)
* Add controlnet-canny to the Gradio playground, and some additional UX enhancement.

* Minor fixes.

* Minor fixes

* Add additional document regarding the list of supported models, and some UI enhancement.

* Minor update to the hyperlink.

* Rewrite the SD2.1 dreambooth finetune notebook.

* Add code owners.

* Some minor changes to the stable diffusion 2.1 and sd-xl notebooks.

* some additional minor fixes.

* additional fixes.

* Create a notebook to demonstrate dreambooth LoRA finetune for SD-XL model.

* minor updates

* add to the codeowner list.

* merge conflict.

* minor fix to the Gradio UI workshop notebook.

* Some minor updates to the SD2.1 deployment notebook.

* Minor update the `sd-xl` deployment notebook, based on the QA feedback.

* Add a few community models to the Gradio workshop.

* Switch `mediapipe-train` docker container from `vertex-ai-restricted` to `vertex-ai`, in the `mediapipe-train` notebooks.

* Create a notebook for model `instantx/instantid`.

* Update Gradio notebook to use the latest Gradio version and fix some bugs.

1. Update Gradio version to 4.29.0, as it complains 3.50.0 is too old.
2. Uninstall nest-asyncio and uvloop as a workaround to b/339301920 and https://github.com/gradio-app/gradio/issues/8238#issuecomment-2101066984.

* Resolve merge conflict.

* minor updates.

* minor updates.

* Merge some SD notebook in g3 and github.

* Remove the unused variable in the controlnet notebook.

* minor updates.

* include the SD1.5 dreambooth notebook.

* Include the sd1.5 dreambooth notebook.
2024-05-21 12:29:32 +00:00
Gary WeiandGitHub f5409efb30 Delete the two deprecated SD1.5 and 2.1 notebooks, as they were no longer referenced on any model cards. (#2986)
* Create a Gradio notebook for the new InstantId model.

* Add dreambooth finetune to the stable diffusion Gradio workshop notebook.

* Update the image generation Gradio notebook to support Dreambooth finetuning.

* linter update

* linter update

* minor fix to the instant-id notebook.

* Minor fix to the stable diffusion gradio notebook.

* Split the 'instant-id' deployment notebook prediction into two sections.

* add `deployment_source` to the notebook.

* Switch to `pytorch-diffusers-serve-opt` container to for diffusion lora serving.

* add the dreambooth_lora notebook.

* minor update.

* Parameterize the "show_debug_logs" to facilitate automatic test of the Gradio notebooks.

* Lint format.

* minor updates

* Delete the two deprecated SD1.5 and 2.1 notebooks, as they were no longer referenced on any model cards.
2024-05-21 12:27:59 +00:00
Manu KumarandGitHub 9fed51d88a fix: use renamed create_feature_view() function in optimized notebook (#2944)
Fx colab parameter usage - the linting/auto-format placed some variables
across multiple lines which doesn't work in colab. Make the FOS ID names
shorter to avoid this issue.

Also fix some usage for getting FOS - this can be done directly using
SDK constructor.

Set PSC allow list project to current project.

Increase sleep for DNS propagation to pass CI.
2024-05-16 19:41:07 +00:00
Huguens JeanandGitHub 5005b580d6 [Model Garden Team] Fix Gemma linter issue. (#2983)
* [Model Garden Team] Fix Gemma linter issue.

* [Model Garden Team] Fix Gemma linter issue.

* Update model_garden_gemma_evaluation.ipynb

* Update model_garden_gemma_evaluation.ipynb
2024-05-15 22:25:54 +00:00
dstnluong-googleandGitHub 80707d319d Fix Gemma finetuning notebook typo again. (#2984)
PiperOrigin-RevId: 634030805
2024-05-15 19:34:01 +00:00
Gary WeiandGitHub b630f8d5f0 Parameterize the "show_debug_logs" to facilitate automatic test of the Gradio notebooks. (#2975)
* Create a Gradio notebook for the new InstantId model.

* Add dreambooth finetune to the stable diffusion Gradio workshop notebook.

* Update the image generation Gradio notebook to support Dreambooth finetuning.

* linter update

* linter update

* minor fix to the instant-id notebook.

* Minor fix to the stable diffusion gradio notebook.

* Split the 'instant-id' deployment notebook prediction into two sections.

* add `deployment_source` to the notebook.

* Switch to `pytorch-diffusers-serve-opt` container to for diffusion lora serving.

* add the dreambooth_lora notebook.

* minor update.

* Parameterize the "show_debug_logs" to facilitate automatic test of the Gradio notebooks.

* Lint format.

* minor updates
2024-05-15 16:34:58 +00:00
Michael HuandGitHub 4fc807c570 Import AutoSxS pipeline from v1 directory (#2973) 2024-05-15 16:33:19 +00:00
chrisheechoandGitHub e1aef2f241 Update model_garden_gemma_fine_tuning_batch_deployment_on_rov.ipynb (#2982)
Need to update this headnode size per product requirement to not cause errors
2024-05-15 16:30:31 +00:00
dstnluong-googleandGitHub d5312bec5d Fix typo in Gemma finetuning notebook. (#2980)
PiperOrigin-RevId: 633712168
2024-05-15 00:32:24 +00:00
Louis LinandGitHub 5f86e65e6d fix: Broken 'processor' param due to linter (#2972)
* feat: Add notebook for E5 text embedding models

* feat: Add notebook for E5 text embedding models

* fix: Broken 'processor' param due to linter

* fix: Update the dev TEI docker images to the public ones
2024-05-14 22:08:53 +00:00
chrisheechoandGitHub f51d6c8e06 Update ray_cluster_management.ipynb (#2974)
Need to change the head node default to 16 to avoid error - i'm the PM for this product
2024-05-14 19:07:15 +00:00
84012f0e22 Add PaliGemma notebooks (#2971)
Co-authored-by: minwoopark <minwoopark@google.com>
2024-05-13 23:34:41 +00:00
dstnluong-googleandGitHub bec5a1f61a Sync GitHub repo (#2966)
PiperOrigin-RevId: 629577775
2024-05-13 21:33:53 +00:00
Louis LinandGitHub 67d14b1e91 feat: Add notebook for E5 text embedding models (#2961)
* feat: Add notebook for E5 text embedding models

* feat: Add notebook for E5 text embedding models
2024-05-11 13:01:26 +00:00
Gary WeiandGitHub 1d720eba33 Switch from pytorch-peft-serve to pytorch-diffusers-serve-opt container for diffusion model serving with lora. (#2950)
* Create a Gradio notebook for the new InstantId model.

* Add dreambooth finetune to the stable diffusion Gradio workshop notebook.

* Update the image generation Gradio notebook to support Dreambooth finetuning.

* linter update

* linter update

* minor fix to the instant-id notebook.

* Minor fix to the stable diffusion gradio notebook.

* Split the 'instant-id' deployment notebook prediction into two sections.

* add `deployment_source` to the notebook.

* Switch to `pytorch-diffusers-serve-opt` container to for diffusion lora serving.

* add the dreambooth_lora notebook.

* minor update.
2024-05-09 23:56:08 +00:00
Gary WeiandGitHub 246dc04784 Update the instant-id Gradio notebook to use the latest Gradio version and fix some bugs. (#2959)
* Add controlnet-canny to the Gradio playground, and some additional UX enhancement.

* Minor fixes.

* Minor fixes

* Add additional document regarding the list of supported models, and some UI enhancement.

* Minor update to the hyperlink.

* Rewrite the SD2.1 dreambooth finetune notebook.

* Add code owners.

* Some minor changes to the stable diffusion 2.1 and sd-xl notebooks.

* some additional minor fixes.

* additional fixes.

* Create a notebook to demonstrate dreambooth LoRA finetune for SD-XL model.

* minor updates

* add to the codeowner list.

* merge conflict.

* minor fix to the Gradio UI workshop notebook.

* Some minor updates to the SD2.1 deployment notebook.

* Minor update the `sd-xl` deployment notebook, based on the QA feedback.

* Add a few community models to the Gradio workshop.

* Switch `mediapipe-train` docker container from `vertex-ai-restricted` to `vertex-ai`, in the `mediapipe-train` notebooks.

* Create a notebook for model `instantx/instantid`.

* Create a Gradio notebook for the new InstantId model.

* Add dreambooth finetune to the stable diffusion Gradio workshop notebook.

* Update the image generation Gradio notebook to support Dreambooth finetuning.

* linter update

* linter update

* minor fix to the instant-id notebook.

* Minor fix to the stable diffusion gradio notebook.

* Update Gradio notebook to use the latest Gradio version and fix some bugs.

1. Update Gradio version to 4.29.0, as it complains 3.50.0 is too old.
2. Uninstall nest-asyncio and uvloop as a workaround to b/339301920 and https://github.com/gradio-app/gradio/issues/8238#issuecomment-2101066984.

* Resolve merge conflict.

* minor updates.

* minor updates.

* Update the instant-id Gradio notebook to use the latest Gradio version and fix some bugs.
2024-05-09 23:54:56 +00:00
Gary WeiandGitHub e08d445e17 Update Gradio notebook to use the latest Gradio version and fix some bugs. (#2958)
* Add controlnet-canny to the Gradio playground, and some additional UX enhancement.

* Minor fixes.

* Minor fixes

* Add additional document regarding the list of supported models, and some UI enhancement.

* Minor update to the hyperlink.

* Rewrite the SD2.1 dreambooth finetune notebook.

* Add code owners.

* Some minor changes to the stable diffusion 2.1 and sd-xl notebooks.

* some additional minor fixes.

* additional fixes.

* Create a notebook to demonstrate dreambooth LoRA finetune for SD-XL model.

* minor updates

* add to the codeowner list.

* merge conflict.

* minor fix to the Gradio UI workshop notebook.

* Some minor updates to the SD2.1 deployment notebook.

* Minor update the `sd-xl` deployment notebook, based on the QA feedback.

* Add a few community models to the Gradio workshop.

* Switch `mediapipe-train` docker container from `vertex-ai-restricted` to `vertex-ai`, in the `mediapipe-train` notebooks.

* Create a notebook for model `instantx/instantid`.

* Update Gradio notebook to use the latest Gradio version and fix some bugs.

1. Update Gradio version to 4.29.0, as it complains 3.50.0 is too old.
2. Uninstall nest-asyncio and uvloop as a workaround to b/339301920 and https://github.com/gradio-app/gradio/issues/8238#issuecomment-2101066984.

* Resolve merge conflict.

* minor updates.

* minor updates.
2024-05-09 23:54:11 +00:00
kewentandGitHub 859ed6a55d remove preview models in description (#2948) 2024-05-08 19:16:13 +00:00
dstnluong-googleandGitHub 44d11bee00 Set DEPLOY_SOURCE to MG notebooks. (#2947) 2024-05-08 18:53:13 +00:00
Gary WeiandGitHub 7c0213dfff Split the 'instant-id' deployment notebook prediction into two sections: (#2946)
* Create a Gradio notebook for the new InstantId model.

* Add dreambooth finetune to the stable diffusion Gradio workshop notebook.

* Update the image generation Gradio notebook to support Dreambooth finetuning.

* linter update

* linter update

* minor fix to the instant-id notebook.

* Minor fix to the stable diffusion gradio notebook.

* Split the 'instant-id' deployment notebook prediction into two sections.

* add `deployment_source` to the notebook.
2024-05-08 13:29:29 +00:00
JennieandGitHub 2cdc45b7b0 Information is outdated. Feature Store API is now available in more regions. (#2923) 2024-05-04 01:22:33 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
413bd6e7c1 Bump tqdm in /community-content/vertex_model_garden/model_oss/cloudnerf (#2927)
Bumps [tqdm](https://github.com/tqdm/tqdm) from 4.66.1 to 4.66.3.
- [Release notes](https://github.com/tqdm/tqdm/releases)
- [Commits](https://github.com/tqdm/tqdm/compare/v4.66.1...v4.66.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-04 01:03:53 +00:00
Gary WeiandGitHub 34a68990b2 Some minor updates to the stable-diffusion-gradio notebook. (#2926)
* Create a Gradio notebook for the new InstantId model.

* Add dreambooth finetune to the stable diffusion Gradio workshop notebook.

* Update the image generation Gradio notebook to support Dreambooth finetuning.

* linter update

* linter update

* minor fix to the instant-id notebook.

* Minor fix to the stable diffusion gradio notebook.
2024-05-03 19:04:15 +00:00
Gary WeiandGitHub 08561d91c0 Update the image generation Gradio notebook to support Dreambooth finetuning. (#2921)
* Create a Gradio notebook for the new InstantId model.

* Add dreambooth finetune to the stable diffusion Gradio workshop notebook.

* Update the image generation Gradio notebook to support Dreambooth finetuning.

* linter update

* linter update

* minor fix to the instant-id notebook.
2024-05-03 18:02:52 +00:00
Huguens JeanandGitHub 2d280216ec Revert "[MG Model Team] Add environment var of DEPLOY_SOURCE with value 'note…" (#2925)
This reverts commit 056d909e3e.
2024-05-03 16:46:04 +00:00
Ivan NardiniandGitHub 662f7b1440 feat: tuning and serving Gemma on Ray on Vertex AI in Model Garden (#2920)
* adding gemma on rov in model garden

* linter passed
2024-05-02 19:11:01 +00:00
Huguens JeanandGitHub 056d909e3e [MG Model Team] Add environment var of DEPLOY_SOURCE with value 'notebook' for all mg notebooks. (#2917) 2024-05-02 16:47:39 +00:00
Gary WeiandGitHub f164335054 [InstantID] Update the link of the two reference images. (#2914)
* Add controlnet-canny to the Gradio playground, and some additional UX enhancement.

* Minor fixes.

* Minor fixes

* Add additional document regarding the list of supported models, and some UI enhancement.

* Minor update to the hyperlink.

* Rewrite the SD2.1 dreambooth finetune notebook.

* Add code owners.

* Some minor changes to the stable diffusion 2.1 and sd-xl notebooks.

* some additional minor fixes.

* additional fixes.

* Create a notebook to demonstrate dreambooth LoRA finetune for SD-XL model.

* minor updates

* add to the codeowner list.

* merge conflict.

* minor fix to the Gradio UI workshop notebook.

* Some minor updates to the SD2.1 deployment notebook.

* Update the link of the reference images.
2024-05-02 12:54:08 +00:00
xcchen1andGitHub a05724d0d6 Create ByteDance/SDXL-Lightning notebook (#2912)
* Add ByteDance/SDXL-Lightning notebook

* Add ByteDance/SDXL-Lightning to gradio notebook
2024-05-02 12:53:24 +00:00
Gary WeiandGitHub 7f4e3f2afa Create a Gradio notebook for the new InstantId model. (#2911) 2024-05-02 12:52:43 +00:00
Tianrui YangandGitHub cc981bcd2c refactor: update feature store vector search notebook use latest features. (#2909)
* Update feature store vector search notebook to use latest vertex SDK.

* Run lint to fix format issue

* Sleep for a few minutes to wait for DNS to be ready
2024-04-30 21:02:17 +00:00
0fd7db5602 Fix link URL typo (#2910)
Co-authored-by: minwoopark <minwoopark@google.com>
2024-04-30 18:58:56 +00:00
Huguens JeanandGitHub 6f4bb601d9 Update falcon instruct notebook to lowcode/nocode (#2905)
* Update falcon instruct notebook to lowcode/nocode

* Fix imported unused in falcon instruct deployment noteboook.
2024-04-30 18:52:50 +00:00
Kathy YuandGitHub 4b25631e53 Fix GCS path in Llama 3 finetuning notebook. (#2908)
* Fix GCS path in Llama 3 finetuning notebook.

* Fix bucket name for permission granting.
2024-04-30 18:49:50 +00:00
dstnluong-googleandGitHub d212b2fdc9 Fix Mixtral model id naming (#2904) 2024-04-30 18:49:03 +00:00
Gary WeiandGitHub e5cfffd44f Create a notebook for model instantx/instantid. (#2898)
* Add controlnet-canny to the Gradio playground, and some additional UX enhancement.

* Minor fixes.

* Minor fixes

* Add additional document regarding the list of supported models, and some UI enhancement.

* Minor update to the hyperlink.

* Rewrite the SD2.1 dreambooth finetune notebook.

* Add code owners.

* Some minor changes to the stable diffusion 2.1 and sd-xl notebooks.

* some additional minor fixes.

* additional fixes.

* Create a notebook to demonstrate dreambooth LoRA finetune for SD-XL model.

* minor updates

* add to the codeowner list.

* merge conflict.

* minor fix to the Gradio UI workshop notebook.

* Some minor updates to the SD2.1 deployment notebook.

* Minor update the `sd-xl` deployment notebook, based on the QA feedback.

* Add a few community models to the Gradio workshop.

* Switch `mediapipe-train` docker container from `vertex-ai-restricted` to `vertex-ai`, in the `mediapipe-train` notebooks.

* Create a notebook for model `instantx/instantid`.
2024-04-29 15:40:01 +00:00
Mend RenovateandGitHub 85a46165bc chore(deps): update dependency black to v24.4.2 (#2900) 2024-04-26 14:47:23 +00:00
Kathy YuandGitHub dcd26245c7 Add Llama 3 finetuning notebook. (#2897) 2024-04-24 23:07:29 +00:00
Mend RenovateandGitHub 3c10aba391 chore(deps): update dependency black to v24.4.1 (#2895) 2024-04-24 15:46:23 +00:00
dstnluong-googleandGitHub 6c3bd0e042 Add uuid to reduce bucket name crashing (#2894)
* Add uuid to notebooks.

* Lint
2024-04-23 21:22:17 +00:00
dstnluong-googleandGitHub cff2942b20 Load mistral and mixtral models from GCS (#2893)
* Load Mistral and Mixtral models from GCS.

* Lint

* Fix lint

* add -r to mixtral

* Try to automatically set region
2024-04-23 14:31:19 +00:00
xcchen1andGitHub bf3f96caf6 No-code/low-code notebook: fix sd 1.5 dreambooth model deployment section (#2892) 2024-04-23 14:29:23 +00:00
Aaron DietzandGitHub 3dac000915 Update automl_image_classification_batch_prediction.ipynb (#2891)
This notebook was throwing "invalid JSON" errors when users were opening it in Colab, etc.

The problem was introduced in https://github.com/GoogleCloudPlatform/vertex-ai-samples/pull/2866 when I didn't close a text cell line properly.
2024-04-22 17:37:50 +00:00
Kathy YuandGitHub 00d8f83630 Update embedded model card link for Llama 3 deployment notebook. (#2890) 2024-04-20 23:42:24 +00:00
eliasecchigandGitHub 03efaadb87 Update README.md (#2888) 2024-04-19 15:45:07 +00:00
qijing93andGitHub b70be17865 chore: Splitting legacy Feature Store colabs to a separate folder. (#2887) 2024-04-19 12:41:34 +00:00
Huguens JeanandGitHub badf6f4a61 Update codellamma nclc deployment and evaluation notebooks. (#2886) 2024-04-19 12:40:10 +00:00
weigaryandGitHub f5e3bfa727 Switch mediapipe-train docker container from vertex-ai-restricted to vertex-ai, in the mediapipe-train notebooks. (#2885)
* Add controlnet-canny to the Gradio playground, and some additional UX enhancement.

* Minor fixes.

* Minor fixes

* Add additional document regarding the list of supported models, and some UI enhancement.

* Minor update to the hyperlink.

* Rewrite the SD2.1 dreambooth finetune notebook.

* Add code owners.

* Some minor changes to the stable diffusion 2.1 and sd-xl notebooks.

* some additional minor fixes.

* additional fixes.

* Create a notebook to demonstrate dreambooth LoRA finetune for SD-XL model.

* minor updates

* add to the codeowner list.

* merge conflict.

* minor fix to the Gradio UI workshop notebook.

* Some minor updates to the SD2.1 deployment notebook.

* Minor update the `sd-xl` deployment notebook, based on the QA feedback.

* Add a few community models to the Gradio workshop.

* Switch `mediapipe-train` docker container from `vertex-ai-restricted` to `vertex-ai`, in the `mediapipe-train` notebooks.
2024-04-18 17:24:01 +00:00
Kathy YuandGitHub 998ca068a7 Add Llama3 deployment notebook. (#2884)
* Add Llama3 deployment notebook.

* Add to codeowners.
2024-04-18 16:35:28 +00:00
weigaryandGitHub 89c040bc24 Add a few community models to the Gradio workshop. (#2883)
* Add controlnet-canny to the Gradio playground, and some additional UX enhancement.

* Minor fixes.

* Minor fixes

* Add additional document regarding the list of supported models, and some UI enhancement.

* Minor update to the hyperlink.

* Rewrite the SD2.1 dreambooth finetune notebook.

* Add code owners.

* Some minor changes to the stable diffusion 2.1 and sd-xl notebooks.

* some additional minor fixes.

* additional fixes.

* Create a notebook to demonstrate dreambooth LoRA finetune for SD-XL model.

* minor updates

* add to the codeowner list.

* merge conflict.

* minor fix to the Gradio UI workshop notebook.

* Some minor updates to the SD2.1 deployment notebook.

* Minor update the `sd-xl` deployment notebook, based on the QA feedback.

* Add a few community models to the Gradio workshop.
2024-04-18 12:48:16 +00:00
e072753032 Rov-open-colab-enterprise (#2879)
* Update get_started_with_pytorch_rov.ipynb

This is a test

* Added "Open in Colab Enterprise" link and made other edits

* Update ray_cluster_management.ipynb

---------

Co-authored-by: Katie Nguyen <21978337+katiemn@users.noreply.github.com>
2024-04-17 14:53:36 +00:00
dstnluong-googleandGitHub b9147f6dfe Collapse last cell (#2882)
* Collapse last cell

* Lint
2024-04-16 20:42:14 +00:00
Mend RenovateandGitHub 0d8482f17f Update dependency black to v24.4.0 (#2881) 2024-04-15 17:45:11 +00:00
e4abe986b1 Fix region for sdk streaming (#2878)
* add Claude 3 Opus model

* fix lint

* fix vertexai bug

* update region for streaming sdk call

---------

Co-authored-by: Huy Ngo <huyngo@google.com>
2024-04-11 20:28:18 +00:00
92804a7fac Fix vertexai bug on Claude 3 Opus (#2877)
* add Claude 3 Opus model

* fix lint

* fix vertexai bug

---------

Co-authored-by: Huy Ngo <huyngo@google.com>
2024-04-11 19:14:54 +00:00
513fef82dc Add Claude 3 Opus model (#2871)
* add Claude 3 Opus model

* fix lint

---------

Co-authored-by: Huy Ngo <huyngo@google.com>
2024-04-11 18:17:51 +00:00
Tianrui YangandGitHub 3f94a50a7d Update FeatureStore embedding notebook to use vertex SDK preview. (#2854)
* Update FeatureStore embedding notebook to use vertex SDK preview.

* Fix format issue.

* Comment deleting transfer config code

* Add                   Credentialed Accounts
ACTIVE  ACCOUNT
*       141951627079-compute@developer.gserviceaccount.com to debug permission issue

* Fix bigquery transfer run issue.
2024-04-11 03:55:14 +00:00
dstnluong-googleandGitHub db83e3f2d2 Fix typos in quantization notebook (#2875) 2024-04-10 21:28:16 +00:00
xcchen1andGitHub 9f896a2138 Update notebooks to no-code/low-code (#2874) 2024-04-10 03:46:16 +00:00
Aaron DietzandGitHub 15546cc1c0 Remove inaccurate description about length of training time automl_image_classification_batch_prediction.ipynb (#2866) 2024-04-10 03:45:46 +00:00
ee88765444 Tpuv5e llama2 briankang robv (#2853)
* Initial commit of a Llama2 TPUv5e LoRA example

* Addressing issue of job failing at the end by adding sys.exit(0) after all steps complete

* Adding Llama2 LoRA tuning on TPUv5e notebook

* Create /tmp/modelfiles folder for downloading model files during training

* Updated to use gcloud storage instead of gsutil

* Removed step to clear folder in bucket, since that causes failure

* Added serving/deployment section.

* Fixed linting errors

* Default to 8 chip tuning for quota issue on automated tests

* Defaulting back to 16 chip fine-tuning and epochs to 200

* Set Accelerate library to 0.28.0, as newer version break TPU support

* Updated upload of tuned model files to happen for all workers - to avoid timeout errors

* Temp remove active endpoint, then retest

* Updating docker container to python 3.10

* Added wait to prevent job delete step happening too early

* Lint issue and remove temporary endpoint delete

* Lint issue

* Add 15 minute wait while model is setup on the endpoint, and readd temp delete of endpoint

* Make 15 minute wait optional and remove temporary endpoint delete

* Remove GCS path to model garden model for final commit

---------

Co-authored-by: Rob Vogelbacher <robv@google.com>
2024-04-10 03:45:10 +00:00
fbb27557e8 Fix CodeGemma model ID (#2873)
Co-authored-by: minwoopark <minwoopark@google.com>
2024-04-09 15:23:17 +00:00
6980995572 Fix CodeGemma notebook (#2872)
Co-authored-by: minwoopark <minwoopark@google.com>
2024-04-09 12:31:10 +00:00
Aaron DietzandGitHub 217a774182 Fixed formatting of the "open in" table (#2870) 2024-04-09 03:49:05 +00:00
Huy NgoandGitHub de9350d695 Revert "add Claude 3 Opus model (#2855)" (#2869)
This reverts commit 106e34781c.
2024-04-09 02:32:21 +00:00
106e34781c add Claude 3 Opus model (#2855)
* add Claude 3 Opus model

* fix lint

---------

Co-authored-by: Huy Ngo <huyngo@google.com>
2024-04-09 00:36:17 +00:00
xcchen1andGitHub 692d4adc5d No-code/low-code notebooks: update notebook links (#2867) 2024-04-09 00:20:01 +00:00
2f243ddc54 Add CodeGemma (#2868)
Co-authored-by: minwoopark <minwoopark@google.com>
2024-04-09 00:18:33 +00:00
yexing111andGitHub 9bdeed5c4a Update FS optimized serving GA colab (#2859)
* Update FS optimized serving GA colab

* Fix import order

* Fix import format

* Fix format

* Fix test issue

* Fix format

* Add way to getFOS&FV for FR/FG
2024-04-08 21:04:08 +00:00
Huguens JeanandGitHub ea2f4bbe3a Gemma eval fix (#2865)
* Fix minor typo in accelerator selection.

* Fix minor typo in accelerator selection.

* Update eval dataset to hellaswag.

* Update eval dataset to hellaswag.
2024-04-08 18:50:11 +00:00
geetaarora-googleandGitHub 76b7ef1c5e Added RLHF recommended best practices. (#2863) 2024-04-08 18:49:29 +00:00
dstnluong-googleandGitHub 69f2b0a900 Minor fix for llama2 quantization. (#2864)
* Minor fix for llama2 quantization.

* Lint
2024-04-08 17:09:41 +00:00
kittyabsandGitHub a1035554c7 Fix-table-3 (#2862)
* Update get_started_with_pytorch_rov.ipynb

This is a test

* Still trying to fix table - so sorry about this.
2024-04-08 17:08:54 +00:00
xcchen1andGitHub fc45d4b114 Update notebooks to no-code/low-code (#2860) 2024-04-06 14:05:37 +00:00
kittyabsandGitHub 97bff66011 Fix-table (#2856)
* Update get_started_with_pytorch_rov.ipynb

This is a test

* fix table containing links to notebook samples.
2024-04-05 19:30:29 +00:00
dstnluong-googleandGitHub 4f98b604c3 Rewrite Gemma deployment notebook to be LC/NC (#2850)
* Rewrite Gemma deployment to be LC/NC

* Lint

* Lint
2024-04-05 19:29:24 +00:00
Huy NgoandGitHub 848cecb1b0 Revert "Add Claude 3 Opus model (#2847)" (#2849)
This reverts commit 19e95b90c7.
2024-04-04 20:22:49 +00:00
4b20f9a25b feat: Update supported models table in RLHF notebooks. (#2841)
* feat: Update supported models table in RLHF notebooks.

* feat: Update image that shows how to locate output_model_path.

* feat: Update name of deploy model component.

---------

Co-authored-by: Ryan Latture <latture@google.com>
2024-04-04 19:58:51 +00:00
19e95b90c7 Add Claude 3 Opus model (#2847)
* Add Colab on how to use Claude 3 models on Vertex AI

* Add Colab on how to use Claude 3 models on Vertex AI

* add codeowner

* lint

* update model version

* update stream sdk to have more readable response

* add colab for claude 3

* lint

* update CODEOWNERS and file name

* remove claude 3 colab from model_garden folder

* update CODEOWNERS

* format

* fix intergration test failed

* fix markdown not showing up

* fix markdown not showing up

* update pip command

* update install command

* update restart kernel command

* fix restart kernel command

* clear cell output

* update select region command

* raise error if user doesn't update project_id

* update ordering and add preview image section

* update ordering and add preview image section

* fix httpx package not install

* fix httpx package not install

* fix httpx package not install

* fix lint

* add claude 3 opus model

* fix lint

---------

Co-authored-by: Huy Ngo <huyngo@google.com>
2024-04-04 19:56:03 +00:00
c565eb9f4b Update colab order and add preview image section (#2789)
* Add Colab on how to use Claude 3 models on Vertex AI

* Add Colab on how to use Claude 3 models on Vertex AI

* add codeowner

* lint

* update model version

* update stream sdk to have more readable response

* add colab for claude 3

* lint

* update CODEOWNERS and file name

* remove claude 3 colab from model_garden folder

* update CODEOWNERS

* format

* fix intergration test failed

* fix markdown not showing up

* fix markdown not showing up

* update pip command

* update install command

* update restart kernel command

* fix restart kernel command

* clear cell output

* update select region command

* raise error if user doesn't update project_id

* update ordering and add preview image section

* update ordering and add preview image section

* fix httpx package not install

* fix httpx package not install

* fix httpx package not install

* fix lint

---------

Co-authored-by: Huy Ngo <huyngo@google.com>
2024-04-04 12:50:18 +00:00
dstnluong-googleandGitHub 2f5eef2c17 Add region check for llama2 deployment notebook. (#2843)
* Add region check for LLaMA2 deployment notebook.

* Lint
2024-04-04 12:48:48 +00:00
dstnluong-googleandGitHub d5b1b83d9a Remove text moderation from llama2 quantization notebook (#2844)
* Remove text moderation for LLaMA2 quantization notebook.

* Lint
2024-04-04 12:48:07 +00:00
weigaryandGitHub 4bcdc034bb Update all the diffusion-serve containder URI to 20240403_0836_RC00 which includes the latest optimizations to the diffusion models. (#2845)
* Some minor updates to the SD-XL model deployment notebook, based on the QA feedback.

* Updates to the `sd-xl-dreambooth-lora-finetune` notebook based on feedback.

* [Stable diffusion gradio] Add a few pre defined styles to the workshop, also some minor UX improvement.

* Update all the diffusion-serve containder URI to 20240403_0836_RC00 which includes the latest optimizations to the diffusion models.
2024-04-04 12:47:24 +00:00
xcchen1andGitHub 03ec89d3d4 Update notebooks to no-code/low-code (#2842) 2024-04-03 20:54:48 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
f3d8051df4 Bump pillow (#2839)
Bumps [pillow](https://github.com/python-pillow/Pillow) from 10.2.0 to 10.3.0.
- [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/10.2.0...10.3.0)

---
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>
2024-04-03 20:53:42 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
4292d97dc6 Bump pillow (#2840)
Bumps [pillow](https://github.com/python-pillow/Pillow) from 10.2.0 to 10.3.0.
- [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/10.2.0...10.3.0)

---
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>
2024-04-03 20:52:57 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
e557dcd3df Bump pillow (#2838)
Bumps [pillow](https://github.com/python-pillow/Pillow) from 10.2.0 to 10.3.0.
- [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/10.2.0...10.3.0)

---
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>
2024-04-03 20:52:12 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
27e5b007be Bump pillow (#2837)
Bumps [pillow](https://github.com/python-pillow/Pillow) from 10.2.0 to 10.3.0.
- [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/10.2.0...10.3.0)

---
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>
2024-04-03 20:51:21 +00:00
siping-huandGitHub 72ebccd341 Update autosxs_llm_evaluation_for_summarization_task.ipynb (#2836)
* Update autosxs_llm_evaluation_for_summarization_task.ipynb

Quick fix for the xsum dataset description and citation.

* fix lint error
2024-04-03 13:46:56 +00:00
kittyabsandGitHub 09e44f8661 Ray on vertex ai (#2827)
* Made numerous edits. Code not impacted

* removed empty cell

* delete empty cell
2024-04-03 02:28:07 +00:00
weigaryandGitHub 1c12789805 [Stable diffusion gradio] Add a few pre defined styles to the workshop, also some minor UX improvement. (#2835)
* Some minor updates to the SD-XL model deployment notebook, based on the QA feedback.

* Updates to the `sd-xl-dreambooth-lora-finetune` notebook based on feedback.

* [Stable diffusion gradio] Add a few pre defined styles to the workshop, also some minor UX improvement.
2024-04-03 02:27:00 +00:00
Michael HuandGitHub 55323b74da Update AutoSxS notebooks to use latest package release (#2832)
* Update AutoSxS notebooks to use latest package release

* apply elijah's review comments

* remove force reinstall to avoid errors
2024-04-03 02:24:17 +00:00
14c927400a feat: Tune llama-2-7b with RLHF. (#2834)
Co-authored-by: Ryan Latture <latture@google.com>
2024-04-03 02:23:26 +00:00
lee1premiumandGitHub fff3ac1838 feat: Elastic Text-Embedding Model demo. (#2829)
* feat: Elastic Text-Embedding Model demo.

* feat: Elastic Text-Embedding Model demo.
2024-04-03 02:22:24 +00:00
xcchen1andGitHub f5eab96c13 Update notebooks to no-code/low-code (#2831) 2024-04-02 20:01:32 +00:00
KCFindstrandGitHub fde0abd9f6 Fix malformed Colab URLs in model garden notebooks (#2830)
* Fix malformed Colab URL in llama2 peft finetuning and HPT notebooks

* Fix Gemma PEFT finetuning notebook URL
2024-04-02 19:59:03 +00:00
32a75b15fe feat: Update RLHF parameter documentation. Document how to access real-time TB metrics. (#2819)
Co-authored-by: Ryan Latture <latture@google.com>
2024-04-01 20:14:44 +00:00
lee1premiumandGitHub eb8ae3d01b feat: Elastic Text-Embedding Model demo. (#2824)
* feat: Elastic Text-Embedding Model demo.

* feat: Elastic Text-Embedding Model demo.
2024-04-01 13:12:34 +00:00
KCFindstrandGitHub 6110aa2b13 Update Llama2 PEFT finetuning notebook to low-code version and minor fixes to HPT notebook (#2825) 2024-03-29 23:28:32 +00:00
Eric DongandGitHub 22435976d9 chore: Update template (#2821) 2024-03-29 21:41:07 +00:00
xcchen1andGitHub f279973cb7 Update notebooks to no-code/low-code (#2823) 2024-03-29 19:50:01 +00:00
weigaryandGitHub eace0e9884 Some minor updates to the SD-XL model deployment notebook, based on the QA feedback. (#2820)
* Some minor updates to the SD-XL model deployment notebook, based on the QA feedback.

* Updates to the `sd-xl-dreambooth-lora-finetune` notebook based on feedback.
2024-03-29 19:48:44 +00:00
Lav RaiandGitHub ed16b60537 Add low-code notebooks. (#2818) 2024-03-28 17:00:25 +00:00
KCFindstrandGitHub 5d5bbd072e Update Model Garden Llama2 HPT notebook to low-code version (#2817)
* Update Model Garden Llama2 HPT notebook to low-code version.

* Update resource clean up section
2024-03-28 12:43:44 +00:00
weigaryandGitHub 5587d41f08 Some minor updates to the SD2.1 deployment notebook. (#2816)
* Add controlnet-canny to the Gradio playground, and some additional UX enhancement.

* Minor fixes.

* Minor fixes

* Add additional document regarding the list of supported models, and some UI enhancement.

* Minor update to the hyperlink.

* Rewrite the SD2.1 dreambooth finetune notebook.

* Add code owners.

* Some minor changes to the stable diffusion 2.1 and sd-xl notebooks.

* some additional minor fixes.

* additional fixes.

* Create a notebook to demonstrate dreambooth LoRA finetune for SD-XL model.

* minor updates

* add to the codeowner list.

* merge conflict.

* minor fix to the Gradio UI workshop notebook.

* Some minor updates to the SD2.1 deployment notebook.
2024-03-28 12:42:06 +00:00
weigaryandGitHub 54114468fd some minor updates to the sd-gradio notebook. (#2815)
* Add controlnet-canny to the Gradio playground, and some additional UX enhancement.

* Minor fixes.

* Minor fixes

* Add additional document regarding the list of supported models, and some UI enhancement.

* Minor update to the hyperlink.

* Rewrite the SD2.1 dreambooth finetune notebook.

* Add code owners.

* Some minor changes to the stable diffusion 2.1 and sd-xl notebooks.

* some additional minor fixes.

* additional fixes.

* Create a notebook to demonstrate dreambooth LoRA finetune for SD-XL model.

* minor updates

* add to the codeowner list.

* merge conflict.

* minor fix to the Gradio UI workshop notebook.
2024-03-27 20:49:14 +00:00
Eric DongandGitHub 8a38619827 feat: update notebook template (#2801)
* feat: update notebook template

* address linter errors

* Change a few TODOs

* Add Colab link

* Update the open links

* Address review comments

* Address review comments
2024-03-27 14:02:54 +00:00
kittyabsandGitHub 9b3f4f07db added link to Colab Enteriprise. (#2812) 2024-03-27 00:50:11 +00:00
lee1premiumandGitHub beb53f6ce8 feat: Elastic Text-Embedding demo. (#2811)
* feat: Elastic Text-Embedding demo.

* feat: Elastic Text-Embedding demo.
2024-03-27 00:49:42 +00:00
Huguens JeanandGitHub 0ef5bee2ce Add Falcon Instruct evaluation notebook. (#2808) 2024-03-26 18:46:35 +00:00
Huguens JeanandGitHub 3d21fc16e1 Add Falcon Instruct finetuning notebook. (#2807) 2024-03-26 18:46:11 +00:00
Huguens JeanandGitHub 84ee7fd53c Add Gemma evaluation notebook. (#2806) 2024-03-26 18:45:24 +00:00
Huguens JeanandGitHub 15ddb011d2 Add Falcon Instruct quantization notebook. (#2805) 2024-03-26 18:44:32 +00:00
Huguens JeanandGitHub 4a8e69f8c8 Add Falcon Instruct deployment notebook. (#2804) 2024-03-26 18:43:36 +00:00
Mend RenovateandGitHub 5590037281 chore(deps): update dependency nbqa to v1.8.5 (#2810) 2024-03-26 14:54:10 +00:00
Huguens JeanandGitHub e911c8e098 Add CodeLLama evaluation notebook. (#2803) 2024-03-26 14:53:49 +00:00
Huguens JeanandGitHub ab5d97607d Update CodeLLama notebook to low-code/no-code without evaluation section. (#2802) 2024-03-26 14:52:49 +00:00
Mend RenovateandGitHub 5124590d5f chore(deps): update dependency pyupgrade to v3.15.2 (#2798) 2024-03-25 20:25:09 +00:00
Kathy YuandGitHub b37ed6e53c Update docker link for pic2word serving. (#2797) 2024-03-22 20:42:55 +00:00
AmyandGitHub 2bb39a0e10 moving some data from personal bucket to 'cloud-samples-data' bucket (#2794) 2024-03-22 20:42:25 +00:00
weigaryandGitHub 17369c223f Some minor changes to the sd2.1 and sdxl notebooks. (#2795)
* Add controlnet-canny to the Gradio playground, and some additional UX enhancement.

* Minor fixes.

* Minor fixes

* Add additional document regarding the list of supported models, and some UI enhancement.

* Minor update to the hyperlink.

* Rewrite the SD2.1 dreambooth finetune notebook.

* Add code owners.

* Some minor changes to the stable diffusion 2.1 and sd-xl notebooks.

* some additional minor fixes.

* additional fixes.

* Fix the minor bug associated with "bucket_name".

* Minor fixes for "BUCKET_NAME" for sd2_1 and sdxl deployment notebooks.
2024-03-22 20:41:50 +00:00
zhangxiaotianandGitHub d76246d39b feat: add curl colab for video warehouse (#2793) 2024-03-21 20:58:46 +00:00
weigaryandGitHub 0a48635251 Rewrite the SD2.1 dreambooth finetune notebook. (#2792)
* Add controlnet-canny to the Gradio playground, and some additional UX enhancement.

* Minor fixes.

* Minor fixes

* Add additional document regarding the list of supported models, and some UI enhancement.

* Minor update to the hyperlink.

* Rewrite the SD2.1 dreambooth finetune notebook.

* Add code owners.
2024-03-21 17:07:00 +00:00
weigaryandGitHub 5976895d8d Update the serving docker image to include the latest changes. (#2791)
* Update the serving docker image to include the latest changes.

* Update the image version to 20240320_0836_RC00
2024-03-21 17:05:12 +00:00
Huguens JeanandGitHub cb75558e68 Update CamP ZipNeRF notebook with low-code/no-code version. (#2790)
* Update CamP ZipNeRF notebook with low-code/no-code version.

* Update CamP ZipNeRF notebook with low-code/no-code version.

* Update CamP ZipNeRF notebook with low-code/no-code version.
2024-03-21 15:17:09 +00:00
weigaryandGitHub 7b06a04e19 Rewrite the stable diffusion 2.1 notebook: step #1 deployment. (#2788)
* Add controlnet-canny to the Gradio playground, and some additional UX enhancement.

* Minor fixes.

* Minor fixes

* Add additional document regarding the list of supported models, and some UI enhancement.

* Rewrite the stable diffusion 2.1 notebook: step #1 deployment.
2024-03-21 15:15:38 +00:00
weigaryandGitHub e2e78c9613 Add additional document regarding the list of supported models, and some UI enhancement. (#2787)
* Add controlnet-canny to the Gradio playground, and some additional UX enhancement.

* Minor fixes.

* Minor fixes

* Add additional document regarding the list of supported models, and some UI enhancement.

* Minor update to the hyperlink.
2024-03-21 15:13:49 +00:00
Kathy YuandGitHub 3574f8877a Update config and add Mistral v0.2 in Mistral/Mixtral notebook. (#2786) 2024-03-19 18:39:02 +00:00
Durian YogurtandGitHub 63b77e57aa Fix filename bug by appending suffix directly when a video doesn't have an extension (#2785)
* Append suffix directly when video doesn't have an extension

* retrigger checks
2024-03-19 18:38:13 +00:00
cc8aac7220 Add Claude 3 models colab (#2777)
* Add Colab on how to use Claude 3 models on Vertex AI

* Add Colab on how to use Claude 3 models on Vertex AI

* add codeowner

* lint

* update model version

* update stream sdk to have more readable response

* add colab for claude 3

* lint

* update CODEOWNERS and file name

* remove claude 3 colab from model_garden folder

* update CODEOWNERS

* format

* fix intergration test failed

* fix markdown not showing up

* fix markdown not showing up

* update pip command

* update install command

* update restart kernel command

* fix restart kernel command

* clear cell output

* update select region command

---------

Co-authored-by: Huy Ngo <huyngo@google.com>
2024-03-19 16:25:35 +00:00
Brian KangandGitHub c7e2818829 Briankang tpuv5e gemma2b training (#2775)
* Publishing fine-tuning Gemma on TPUv5e notebook

* Update codeowners to add new TPUv5e notebook

* Fixed log link formatting, and added note to require Colab pro for converting to HF format

* Reran local pylint

* Updated python version to 3.10.13

* Pylint reran

* Remove python version note and run linter

* Add gcloud components update for automated tests

* Revert 'Add gcloud components update for automated tests'

This reverts commit a3e79d299b

* Added gcloud components update for automated testing

* Rerun linter

* Updates per nb review

* Changed default region to one where TPUv5e exists

* Update match case to if else for python 3.9
2024-03-18 19:42:51 +00:00
Mend RenovateandGitHub 58bfebfabc chore(deps): update dependency black to v24.3.0 (#2784) 2024-03-15 23:22:33 +00:00
weigaryandGitHub 9130766757 Add controlnet-canny to the Gradio playground, and some additional UX enhancements. (#2783)
* Add controlnet-canny to the Gradio playground, and some additional UX enhancement.

* Minor fixes.

* Minor fixes
2024-03-15 23:21:30 +00:00
Eric DongandGitHub c5d48c80d8 fix: properly handle python versions (#2779) 2024-03-15 17:19:25 +00:00
weigaryandGitHub 39466fe5cb Update the logic of cleaning up the GCS bucket_uri in the sdxl notebook. (#2778)
* Some minor fixed to the `stable-diffusion-gradio` notebook.

* Fix the deployment error of the `SDXL-REFINER` model in the notebook.

* Removed two unnecessary comments.

* Update the logic of cleaning up the `bucket-uri` in the SDXL deployment notebook.
2024-03-15 12:55:07 +00:00
weigaryandGitHub a40675a7ec Fix the deployment error of the SDXL-REFINER model in the notebook. (#2774)
* Some minor fixed to the `stable-diffusion-gradio` notebook.

* Fix the deployment error of the `SDXL-REFINER` model in the notebook.
2024-03-14 18:05:25 +00:00
KCFindstrandGitHub ffb31f9397 Update the CODEOWNER of Gemma GKE deployment notebook (#2770) 2024-03-14 14:10:31 +00:00
xcchen1andGitHub 42d2878c2f Update notebooks to no-code/low-code (#2772)
* Update notebooks to no-code/low-code

* Update notebooks to no-code/low-code
2024-03-14 14:09:43 +00:00
dstnluong-googleandGitHub da46f8aab0 Convert LLaMA2 quantization notebook to low/no code (#2760)
* low/no code llama2 quantization notebook

* Lint

* lint

* Fix link

* Reduce to 1 section

* Lint

* fix

* Fix
2024-03-11 13:40:02 +00:00
weigaryandGitHub dcc2e916af Update the serving docker image to include the latest fixes for image-inpainting. (#2766)
* Add a stable diffusion playground based on Gradio UI.

* Add codeowner.

* Update the serving docker image to include the latest fixes for image-inpainting.
2024-03-11 13:38:57 +00:00
weigaryandGitHub b5f4ddf577 Some minor fixed to the stable-diffusion-gradio notebook. (#2767) 2024-03-11 13:38:19 +00:00
Mend RenovateandGitHub f29b1d785b chore(deps): update dependency nbqa to v1.8.4 (#2764) 2024-03-11 13:36:59 +00:00
ethan-gordonandGitHub ae01b4c85f Vertex AI Feature Store Notebook, Feature View Service Agent (#2752)
* Add files via upload

* Update vertex_ai_feature_store_feature_view_service_agents.ipynb
Update CODEOWNERS
2024-03-09 14:25:41 +00:00
Katie NguyenandGitHub eefda026b1 Fix: edit branding errors in variable names (#2765)
* fix: edit branding errors in variable names

* fix: add model registry variable names
2024-03-08 01:33:54 +00:00
weigaryandGitHub f9608b8ac0 Add a stable diffusion playground based on Gradio UI. (#2763)
* Add a stable diffusion playground based on Gradio UI.

* Add codeowner.
2024-03-07 16:14:42 +00:00
KCFindstrandGitHub 4dd5bfa621 Fix corrupted vllm.patch file due to merge conflicts not be resolved correctly (#2761)
* Fix corrupted vllm.patch file due to merge conflicts not be resolved correctly

* Update CODEOWNERS of vllm
2024-03-07 16:13:46 +00:00
KCFindstrandGitHub 5b72579e51 Update Gemma low-code finetuning notebooks (#2762)
* Update Gemma low-code finetuning notebooks

* Fix invalid params due to the formatter
2024-03-07 16:13:04 +00:00
KCFindstrandGitHub 73122731a9 Update Model Garden vllm serving docker script and dockerfile (#2758)
* Update vllm serving docker script and dockerfile

* Add vllm to community content CODEOWNERS

* Update vllm serving docker script and dockerfile

* Update vllm serving docker script and dockerfile
2024-03-06 20:47:56 +00:00
dstnluong-googleandGitHub 986aaa408f Set max model len (#2757)
* switch llama2 deploymente notebook to lowcode version

* add moderate text link and lint

* lint

* Set gpu utilization

* Add --max-num-batched-tokens=4096

* Set max model len

* move prints in function

* lint

* Remove comment

* Fix link
2024-03-06 19:52:01 +00:00
Kathy YuandGitHub 60810269ad Update vLLM dockerfile. (#2759) 2024-03-06 19:50:50 +00:00
dstnluong-googleandGitHub fedde5da76 Create separate deployment only notebook for SD1.5 (#2750)
* SD notebook

* lintlint

* codeowners

* number to integer
2024-03-06 19:27:45 +00:00
Mend RenovateandGitHub 613258940e chore(deps): update dependency nbqa to v1.8.3 (#2756) 2024-03-04 15:34:44 +00:00
weigaryandGitHub 59a337e3cb Rewrite the SDXL - vertex serving notebook for the low-code user experience. (#2753) 2024-03-01 02:09:42 +00:00
Huguens JeanandGitHub ea2068bc00 Add camp zipnerf jax implementation to model garden. (#2754) 2024-03-01 02:08:28 +00:00
dstnluong-googleandGitHub 4e13f317e8 Modify llama2 deployment notebook to be lowcode (#2755)
* switch llama2 deploymente notebook to lowcode version

* add moderate text link and lint

* lint
2024-03-01 02:07:22 +00:00
jismailyan-googleandGitHub 9db64f74a2 refactor: Simplify Pic2Word notebook steps (#2751)
* refactor: Simplify Pic2Word notebook steps

* fix: linter

* fix: Fix inference issue
2024-02-28 22:05:33 +00:00
Michael HuandGitHub b4b20c3995 Make optional section ending more obvious in AutoSxS notebooks (#2748)
* Make it clear when optional section ends in AutoSxS

* run formatter and linter

* fix component names

* update xsum sample
2024-02-28 22:04:11 +00:00
kittyabsandGitHub d7a9ea8eed Edited "Vertex AI: Track artifacts and metrics across Vertex AI Pipelines runs using Vertex ML Metadata. No impact to code (#2749) 2024-02-27 21:23:48 +00:00
3fb37b5f35 Fix fvlm dockerfiles. (#2747)
Co-authored-by: minwoopark <minwoopark@google.com>
2024-02-26 21:46:48 +00:00
kittyabsandGitHub 92c1e27c50 Edited "Tabular Workflow for Forecasting". No impact on code. (#2726) 2024-02-26 21:46:15 +00:00
weigaryandGitHub a1695d47d9 Update the docker image version to 20240223_1230_RC00 to fix the image quality issue associated with DPMSolverMultistepScheduler. (#2744)
* Pin the `pytorch-diffusers-serve-opt` docker image to `20231213_0836_RC00`.

* Update 4 stable diffusion notebooks to use the optimized serving container, including controlnet, instruct-pix2pix, text-to-video, text-to-video-zero-shot.

* Fix linter error.

* Update the docker image version to 20240223_1230_RC00 to fix the image quality issue associated with DPMSolverMultistepScheduler.
2024-02-26 20:29:26 +00:00
Alok PattaniandGitHub df3e2d4889 Adding EDA with R and BigQuery notebook for update to Cloud Architecture Center guide (#2745)
* Create test

* Adding updated notebook for EDA with R & BigQuery

* Delete notebooks/community/exploratory_data_analysis/test

* Update CODEOWNERS
2024-02-24 14:07:00 +00:00
kittyabsandGitHub c1d1e23cd0 Added missing link and made other edits to "Custom training with pre-built Google Cloud Pipeline Components". No impact on code (#2710)
* Added missing link and made other edits to "Custom training with pre-built Google Cloud Pipeline Components". No impact on code

* Update custom_model_training_and_batch_prediction.ipynb

fixed typo
2024-02-23 20:16:58 +00:00
kittyabsandGitHub c837c4367d Vertex-ai-training-typo-3 (#2742)
* Changed "Vertex AI training" to "Vertex AI Training

* changed "Vertex AI training" to "Vertex AI Training"
2024-02-23 20:13:13 +00:00
kittyabsandGitHub d4a422da2d Edit "Using Vertex AI Multimodal Embeddings and Vector Search". Updated links to point to new directory /vector-search/. No impact on code (#2728) 2024-02-23 20:11:24 +00:00
weigaryandGitHub 78dacd7652 Update 4 stable diffusion notebooks to start using the optimized serving dock image. (#2727)
* Pin the `pytorch-diffusers-serve-opt` docker image to `20231213_0836_RC00`.

* Update 4 stable diffusion notebooks to use the optimized serving container, including controlnet, instruct-pix2pix, text-to-video, text-to-video-zero-shot.

* Fix linter error.
2024-02-23 18:50:43 +00:00
KCFindstrandGitHub d558e7d101 Allow selecting accelerator in the #Gemma Vertex finetuning notebook and update the predict section (#2743) 2024-02-23 02:03:36 +00:00
Huguens JeanandGitHub 8394c2317d Update Bytetrack video object tracking notebook with AutoML IOD deployment. (#2721) 2024-02-22 22:28:03 +00:00
kittyabsandGitHub 485648c0b1 Edited "Get started with Vertex AI Experiments". Changed "Vertex AP training" to "Vertex AI "Training," and remove back ticks from "Vertex AI Training" in one case where it shouldn't have been. (#2741) 2024-02-22 22:25:01 +00:00
kittyabsandGitHub 3d0a0e23e2 Changed "Vertex AI training" to "Vertex AI Training" (#2740) 2024-02-22 22:24:37 +00:00
Bo zhengandGitHub 00028dee95 feat: Replace evaluation pipeline with Vertex SDK evaluate function on automl_text_classification_model_evaluation.ipynb (#2719)
* feat: Replace evaluation pipeline with Vertex SDK evaluate function on automl_text_classification_model_evaluation.ipynb

* Add automl-text-classification-evaluation-image

* Manually change notebook to test lint locally

* Format lint
2024-02-22 21:27:50 +00:00
kittyabsandGitHub afb501a116 Changed "Vertex AI training" to "Vertex AI Training (#2739) 2024-02-22 21:25:39 +00:00
KCFindstrandGitHub 56924aa804 Update ModelGarden Gemma finetuning and delpoyment notebooks on Vertex (#2738) 2024-02-22 18:34:53 +00:00
dstnluong-googleandGitHub 839cc67a5a Add 3 SD 1.5 finetuning notebooks. (#2724)
* Add 3 SD 1.5 finetuning notebooks.

* Lint
2024-02-22 18:24:40 +00:00
kittyabsandGitHub 3eb9c4af53 Edited "Vertex AI: Create, train, and deploy an AutoML text classification model" Updated URLS. (#2725) 2024-02-22 17:53:51 +00:00
kittyabsandGitHub 34d941c52c Made edits to "Vertex AI SDK for Python: AutoML Tabular training and prediction". No impact on code (#2722) 2024-02-22 17:53:20 +00:00
kittyabsandGitHub 1da787a325 Edited "Using Vertex AI Vector Search for StackOverflow Questions." Updated links to avoid redirects. Fixed one link that was due to a failed redirect and yielded a 404. No impact on code (#2729) 2024-02-22 17:52:55 +00:00
kittyabsandGitHub 55dcba8883 Edited "Using Vertex AI Vector Search and Vertex AI embeddings for text for StackOverflow Questions" Fixed one URL to remove redirect. (#2734) 2024-02-22 17:52:37 +00:00
kittyabsandGitHub 5b3492f3ab Edited "Create Vertex AI Vector Search index". Updated a URL to avoid a redirect. No impact on code (#2735) 2024-02-22 17:52:08 +00:00
kittyabsandGitHub 452a270a4e Changed "Vertex AI training" to "Vertex AI Training" (#2737) 2024-02-22 17:51:18 +00:00
Kathy YuandGitHub 97a677c08d Update Gemma deployment and finetuning notebook descriptions. (#2733) 2024-02-21 14:11:52 +00:00
Laurent PicardandGitHub 8e7e5138a7 Add Gemma KerasNLP finetuning Vertex AI deployment notebook (#2732) 2024-02-21 13:49:04 +00:00
kittyabsandGitHub 6cd96394f7 Made edits to "Get started with Vertex AI Experiments. Updated URL to point to new location of doc. Code not impacted. (#2697) 2024-02-21 13:19:22 +00:00
KCFindstrandGitHub dd75908741 Add #ModelGarden Gemma finetuning and deployment notebooks (#2730) 2024-02-21 04:11:51 +00:00
KCFindstrandGitHub 9b72294cf1 Add mistral and mixtral model fine-tuning notebooks (#2716) 2024-02-20 15:18:57 +00:00
Huguens JeanandGitHub 1439a364e0 Unify the model name as MODEL_ID in related containers and notebooks. (#2720) 2024-02-20 15:17:32 +00:00
Mend RenovateandGitHub 4b2724ccbe chore(deps): update dependency pyupgrade to v3.15.1 (#2718) 2024-02-20 15:15:49 +00:00
Kelsi LakeyandGitHub ddf3d1c73b Fix errors in get_started_with_vertex_experiments.ipynb (#2717)
* Update get_started_with_vertex_experiments.ipynb

Fix several errors preventing notebook from being run out of the box, namely the custom job container image.

* Update get_started_with_vertex_experiments.ipynb

* Update get_started_with_vertex_experiments.ipynb

* Update get_started_with_vertex_experiments.ipynb

* Update get_started_with_vertex_experiments.ipynb

* Update CODEOWNERS

* Update get_started_with_vertex_experiments.ipynb
2024-02-20 15:15:12 +00:00
weigaryandGitHub 8d9e2cecf9 Update the stable-diffusion-upscaler notebook to use the optimized serving containder. (#2714)
* Update the link of how to request TPU v5e quota in the notebook.

* Create a notebook to demonstrate how to load a thrid-party stable diffusion model, on Vertex AI for online prediction.

* Add codeowner.

* add code owner.

* Make stable_diffusion_xl_turbo a separate notebook.

* Update the `stable-diffusion-upscaler` notebook to use the optimized serving containder.
2024-02-20 15:14:00 +00:00
Kavitha RajendranandGitHub 1ad4c0331f Detect anomalies in Cloud Audit Logs using BQML models (#2709)
* Adding a notebook to detect anomalies in Cloud Audit Logs with BQML models

* cleaned up version

* incorporated review comments
2024-02-17 15:14:43 +00:00
Ivan NardiniandGitHub cb2b1a19c3 feat: ray on vertex - torch sample (#2711)
* add rov torch sample

* update codeowners

* add gericdong review

* linter passed
2024-02-17 15:07:22 +00:00
weigaryandGitHub 6fb5c2ea04 Make stable_diffusion_xl_turbo a separate notebook. (#2713)
* Update the link of how to request TPU v5e quota in the notebook.

* Create a notebook to demonstrate how to load a thrid-party stable diffusion model, on Vertex AI for online prediction.

* Add codeowner.

* add code owner.

* Make stable_diffusion_xl_turbo a separate notebook.
2024-02-16 21:04:49 +00:00
weigaryandGitHub ddcd08fb0b Create a notebook to demonstrate how to load a thrid-party stable diffusion model, on Vertex AI for online prediction. (#2708)
* Update the link of how to request TPU v5e quota in the notebook.

* Create a notebook to demonstrate how to load a thrid-party stable diffusion model, on Vertex AI for online prediction.

* Add codeowner.

* add code owner.
2024-02-16 14:53:41 +00:00
dstnluong-googleandGitHub f272ca4796 Update quantization docker for LLaMA2 (#2707) 2024-02-16 01:21:17 +00:00
Aiden010200andGitHub df9192d0c2 Upload batch prediction job sample (#2705)
* Upload examples of kfp v2

* Upload run experiment example.

* Upload batch prediction job sample.
2024-02-16 01:20:36 +00:00
kittyabsandGitHub 23b90796ea Made edits to "Vertex AI Pipelines: pipeline control structures using the KFP SDK," which includes updated the KFP URL and adding a missing URL to "Enable the Vertex AI API". No impact to code. (#2706) 2024-02-14 16:55:02 +00:00
Mend RenovateandGitHub c03b43b79b chore(deps): update dependency black to v24.2.0 (#2702) 2024-02-14 16:54:07 +00:00
kittyabsandGitHub 731b456c2f Edited "Vertex AI TensorBoard custom training with prebuilt container" No impact on code. (#2704) 2024-02-14 16:53:33 +00:00
weigaryandGitHub 130c621df7 Update the link of how to request TPU v5e quota in the notebook. (#2703)
* Update the link of how to request TPU v5e quota in the notebook.

* Create a notebook to demonstrate how to load a thrid-party stable diffusion model, on Vertex AI for online prediction.

* Delete notebooks/community/model_garden/model_garden_pytorch_stable_diffusion_custom.ipynb

move it to a separate commit
2024-02-14 16:52:51 +00:00
kittyabsandGitHub 87c43c0231 Made edits to "Vertex AI TensorBoard custom training with custom container". Fixed typos and cleaned up content. No impact on code (#2701)
* Made edits to "Vertex AI TensorBoard custom training with custom container". Fixed typos and cleaned up content. No impact on code

* Update tensorboard_custom_training_with_custom_container.ipynb

Deleted empty cell.
2024-02-14 16:52:13 +00:00
2e8dc70079 Remove eval_dataset from RLHF tuning parameters. (#2700)
We temporarily disabled this parameter for first-party models, so this will avoid validation errors when running the RLHF tuning notebook in the meantime.

Co-authored-by: Ryan Latture <latture@google.com>
2024-02-14 16:50:48 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
e712fe3503 chore(deps): bump pillow (#2699)
Bumps [pillow](https://github.com/python-pillow/Pillow) from 10.0.1 to 10.2.0.
- [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/10.0.1...10.2.0)

---
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>
2024-02-14 16:50:02 +00:00
Huguens JeanandGitHub 39da99a8bb Open source pytorch zipnerf model garden dockers. (#2696) 2024-02-12 15:14:01 +00:00
weigaryandGitHub 13de238a84 Add a notebook for SDXL - lora serving (#2691)
* Add a notebook with example on deploying SDXL model on TPU v5e

* Add a notebook for SDXL - lora serving

* Add code owners
2024-02-12 15:12:48 +00:00
kittyabsandGitHub 080674024b Made edits to "Vertex AI Experiments: Custom training autologging - Local script" and added link to relevant documentation. No impact on code (#2698) 2024-02-12 15:06:47 +00:00
kittyabsandGitHub f348edb56e Made edits to "Delete Outdated Experiments in Vertex AI TensorBoard". Updated URL(s). (#2695) 2024-02-12 15:05:21 +00:00
dstnluong-googleandGitHub 5c4bfa0979 Fix upscaler notebook (#2694) 2024-02-12 15:04:05 +00:00
cac8896a80 Increase default max-num-batched-tokens to 16385 for larger models. (#2689)
Co-authored-by: minwoopark <minwoopark@google.com>
2024-02-12 15:03:09 +00:00
kittyabsandGitHub 5ca8adca08 Numerous edits to "Vertex AI SDK: AutoML training video classification model for batch prediction". Does not impact code. (#2688)
* Numerous edits to "Vertex AI SDK: AutoML training video classification model for batch prediction". Does not impact code.

* Update sdk_automl_video_classification_batch.ipynb

deleted "a"
2024-02-09 18:53:29 +00:00
weigaryandGitHub a9e2d4e7c4 Pin the pytorch-diffusers-serve-opt docker image to 20231213_0836_RC00. (#2692) 2024-02-09 14:31:37 +00:00
kittyabsandGitHub aa9ce6a6fb Made edits to "Vertex AI TensorBoard hyperparameter tuning with the HParams Dashboard" and updated URL to go to more relevant document. (#2690) 2024-02-09 14:09:04 +00:00
kittyabsandGitHub c51c52c03f Change url for viewing TensorBoard data. (#2687) 2024-02-09 14:07:58 +00:00
Michael HuandGitHub 163b66d3e7 Update Prophet and ARIMA notebook GCPC versions (#2658)
* Update Prophet and ARIMA notebook GCPC versions

Also, move ARIMA notebook back into official.

* Delete comparison with Vertex Forecasting

* Disable caching

* Rename
2024-02-08 21:41:58 +00:00
Thomas Le moullecandGitHub 2d960509f6 Mistral 7B Finetuning with QLora (#2645)
* Mistral 7B Finetuning with QLora

Need to fix the PEFT Train docker image for the finetuning step. 
Merging works correctly with the docker image, You might face an error when merging if the peft version used for merging is different from the one used for finetuning (new field added in the config_adapter file)

* Update peft docker train image to 20240126_0936_RC00

* Linter OK

* updated the notebook with pull requests comments

* Remove HPT and updated the bucket URI

* Linter update
2024-02-08 18:19:40 +00:00
Lav RaiandGitHub 2bf37e86fb Autogluon source (#2685)
* Add AutoGluon source files.

* Add AutoGluon source files.
2024-02-08 15:25:38 +00:00
bb274e4040 Support DITO training (#2683)
Co-authored-by: minwoopark <minwoopark@google.com>
2024-02-08 15:23:34 +00:00
kittyabsandGitHub 34abfec74c Made edits to "Vertex AI TensorBoard integration with Vertex AI Pipelines". I also updated the section on viewing and comparing pipeline runs to point to new documentation. (#2684)
* Made edits to "Vertex AI TensorBoard integration with Vertex AI Pipelines". I also updated the section on viewing and comparing pipeline runs to point to new documentation.

* Update tensorboard_vertex_ai_pipelines_integration.ipynb

A few more small fixes. Trying to find source of lint error

* Update tensorboard_vertex_ai_pipelines_integration.ipynb

removed empty cells
2024-02-08 14:29:53 +00:00
kittyabsandGitHub 49f2f12ea2 Fixed typos and rewrote some sentences to make them clearer. Be sure to check that I didn't change the meaning or intent. No code impacted (#2680) 2024-02-07 15:17:35 +00:00
Huguens JeanandGitHub 306c4fa8f4 Update model deployment function with serving_container_environment_variables. (#2675) 2024-02-06 22:03:02 +00:00
kittyabsandGitHub 0964e7f0da Updated link to Vertex AI TensorBoard profiler page, which had been moved. Other edits to align with guidelines (#2676) 2024-02-06 22:01:30 +00:00
dstnluong-googleandGitHub 8e1d91e2c2 Fix URI (#2677) 2024-02-06 22:01:06 +00:00
Bo zhengandGitHub 26001062b7 feat: Replace evaluation pipeline with Vertex SDK evaluate function on model evaluation notebooks (#2610)
* Replace evaluation pipeline with evaluate function

* Replace evaluation pipeline with evaluate function on automl_tabular_regression_model_evaluation.ipynb

* Replace evaluation pipeline with evaluate function on custom_tabular_classification_model_evaluation.ipynb

* Replace evaluation pipeline with evaluate function on custom_tabular_regression_model_evaluation.ipynb

* Replace evaluation pipeline with evaluate function on automl_video_classification_model_evaluation.ipynb

* Format automl_tabular_classification_model_evaluation.ipynb

* Format automl_tabular_regression_model_evaluation.ipynb

* Format automl_video_classification_model_evaluation.ipynb

* Format custom_tabular_classification_model_evaluation.ipynb

* Format custom_tabular_regression_model_evaluation.ipynb

* Add files via upload

* Update screenshot for notebooks with evaluate function usage

* Revert custom_tabular_classification_model_evaluation.ipynb

* Format lint

* manual fix lint
2024-02-06 00:25:15 +00:00
siping-huandGitHub 56656f2225 Add notebooks for autosxs (model based llm evaluation) (#2659)
* Create model_based_llm_evaluation folder

* Add autosxs sample notebooks.

* Update autosxs sample notebooks.

* Update CODEOWNERS for autosxs

* Fix lint and format.

* Resolve Michael's comments.

* Fix test failures.

* Fix test errors and resolve Eric's comments.

* Update autosxs_llm_evaluation_for_summarization_task.ipynb

* Update autosxs_llm_evaluation_for_summarization_task.ipynb

* Update autosxs_llm_evaluation_for_summarization_task.ipynb

* Update autosxs_llm_evaluation_for_summarization_task.ipynb

* Update autosxs_llm_evaluation_for_summarization_task.ipynb

* Fix isort.

* Fix nbfmt
2024-02-06 00:22:16 +00:00
kittyabsandGitHub 684285d4f1 Update URL to go directly to /training/... (#2674) 2024-02-06 00:19:20 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
a898bf8aad chore(deps): bump fastapi (#2673)
Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.75.2 to 0.109.1.
- [Release notes](https://github.com/tiangolo/fastapi/releases)
- [Commits](https://github.com/tiangolo/fastapi/compare/0.75.2...0.109.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-05 18:11:03 +00:00
weigaryandGitHub 60b49d8419 Add a notebook with example on deploying SDXL model on TPU v5e (#2672) 2024-02-05 17:42:31 +00:00
8b55dada76 Dealing with numerous text edits. Does not impact code (#2670)
* Update get_started_with_vertex_experiments_autologging.ipynb

Added link in "Learn more about..." to the Vertex AI Experiments intro page. Currently, this notebook is not showing up properly in the Jupyter SDK Tutorial page.

* Update get_started_with_vertex_experiments_autologging.ipynb

* Update notebook_template_review.py

Missing left curly bracket/brace 2xs 
(Note, commented out, but still fixing)
 #'AutoML Vision': '{automl_vision_name}}',
 #'AutoML Image': '{automl_vision_name}}',

* Update get_started_with_vertex_experiments_autologging.ipynb

Needed to add a period.

* fix: update spacing

---------

Co-authored-by: Katie Nguyen <katiemn@gmail.com>
2024-02-02 17:05:24 +00:00
dstnluong-googleandGitHub f18c851428 Fix Lama URI (#2671)
* LaMa notebook

* lint

* codeowners

* update

* lint

* Fix indentation issue

* fix URI
2024-02-02 14:23:57 +00:00
Huguens JeanandGitHub a78b5ce878 Search for the MODEL_ID env and set it in the deployment function for… (#2669)
* Search for the MODEL_ID env and set it in the deployment function for all model garden notebooks for pre-trained and tuned models.

* Fix model_garden_pytorch_stable_video_diffusion_img2vid_xt notebook linter issue with load_image and HTML.

* Fix model_garden_pytorch_stable_video_diffusion_img2vid_xt notebook linter issue with load_image and HTML.

* Fix missing MODEL_ID in model_garden_mediapipe_image_generation.ipynb.
2024-02-02 14:21:29 +00:00
kittyabsandGitHub a9aea28b37 Update get_started_with_bqml_training.ipynb (#2666)
Remove "back ticks" around product/service names. Fix typos.
2024-02-02 14:12:31 +00:00
kittyabsandGitHub 0cb84572ba Update tensorboard_profiler_custom_training.ipynb (#2665)
Text edits: Removed `...` from product names and made other edits. Code not impacted
2024-02-02 14:11:18 +00:00
kittyabsandGitHub 764b7a5cc8 Update comparing_pipeline_runs.ipynb (#2664)
* Update comparing_pipeline_runs.ipynb

Needed edits for the page. Does not impact code.

* Update comparing_pipeline_runs.ipynb

responded to katie's feedback.
2024-02-02 14:10:18 +00:00
zbl94andGitHub 94294de17c feat: Vertex AI Feature Store Based LLM Grounding Tutorial (#2652)
* feat: Vertex AI Feature Store Based LLM Grounding Tutorial

* fix: fix the feature store based llm grounding tutorial based on a few comments

* fix: fix the feature store based llm grounding tutorial based on a few comments

* fix: move the fs grounding notebook to official

* fix: comment colab only code

* fix: fix pipeline prefix

* fix: resolve several comments

* fix: resolve several comments

* fix: a quick fix for type

* fix: a quick fix for import

* fix: a quick fix for colab
2024-02-01 22:06:34 +00:00
d9d3be36f9 Support CodeLlama 70B models. (#2667)
Co-authored-by: minwoopark <minwoopark@google.com>
2024-02-01 18:10:12 +00:00
kittyabsandGitHub 48f1a43efc Update sdk-custom-image-classification-batch.ipynb (#2662)
Removed tick marks from product names so they don't render as code.
2024-01-31 21:55:26 +00:00
kittyabsandGitHub 64417df16a Update tensorboard_vertex_ai_pipelines_integration.ipynb (#2663)
Fixing typo: "monitorning" -> "monitoring"
2024-01-31 21:53:59 +00:00
dstnluong-googleandGitHub 165d58f328 Fix indentation in LaMa notebook (#2661)
* LaMa notebook

* lint

* codeowners

* update

* lint

* Fix indentation issue
2024-01-31 19:42:43 +00:00
Shikanime DevaandGitHub bb2085a95d Add Peft additional parameters (#2657) 2024-01-31 16:12:34 +00:00
kittyabsandGitHub 5cd844f2dd Small edit - first time making a change to a github sample. (#2660) 2024-01-30 21:00:18 +00:00
Lehui LiuandGitHub 4b455390f6 feat: add sample notebook for vertex distillation (#2656) 2024-01-30 01:29:29 +00:00
Mend RenovateandGitHub d5f90ce6de chore(deps): update dependency black to v24.1.1 (#2654) 2024-01-30 01:17:16 +00:00
Aiden010200andGitHub 4ede21cccd Upload run experiment example (#2653)
* Upload examples of kfp v2

* Upload run experiment example.
2024-01-29 15:36:10 +00:00
weigaryandGitHub 16bf0a8813 Update/optimize the serving efficiency of the image-inpainting model. (#2650) 2024-01-26 19:04:55 +00:00
Mend RenovateandGitHub c7fb10d374 chore(deps): update dependency black to v24 (#2651) 2024-01-26 19:03:13 +00:00
dstnluong-googleandGitHub e700dbbad3 Add LaMa Notebook to Vertex MG (#2648)
* LaMa notebook

* lint

* codeowners

* update

* lint
2024-01-25 17:40:59 +00:00
Katie NguyenandGitHub 0a082b4c07 fix: update links to official notebook (#2647) 2024-01-25 17:39:03 +00:00
Lav RaiandGitHub ad947ea952 Add AutoGluon notebook. (#2649) 2024-01-25 17:38:17 +00:00
dstnluong-googleandGitHub 7d7db7d2d7 Separate hp tuning from llama notebook. (#2641)
* Separate notebook

* lint

* add codeowners

* Remove unused import

* Merge with pipeline addition.

* Remove prediction from hptuning nb.
2024-01-24 22:27:05 +00:00
Erick De Santiago AnayaandGitHub 884d649434 Update model_garden_video_object_tracking_serve.ipynb (#2646)
The model it's expecting a number instead of a boolean value
2024-01-24 20:52:40 +00:00
61789574c0 feat: Document how to get predictions from tuned 1P and 3P models. (#2642)
1P models should use Online or Batch Prediction. 3P models should use the Bulk Inference pipeline.

Co-authored-by: Ryan Latture <latture@google.com>
2024-01-24 20:51:02 +00:00
Matthew TangandGitHub 0ea0c04195 [Vertex AI SDK] Add custom serializer args for bigframes tensorflow (#2633)
* Add custom serializer args for bigframes tensorflow

* Add custom serializer args for remote prediction
2024-01-24 20:47:02 +00:00
Katie NguyenandGitHub 556cbe7049 fix: update API call in triton client (#2644) 2024-01-24 20:45:48 +00:00
jismailyan-googleandGitHub b695dc7631 Move and update pipeline finetuning section. (#2640)
* Add a section documenting the one-click finetuning
button in the Model Card UI.

The section explains how to use the button,
what the pipeline does and some troubleshooting
tips.

* Edit one-click finetuning instructions for clarity
and syntax.

* Correct 'Tensorboard' to 'TensorBoard'

* Updated finetuning pipeline instructions to
include steps on launching the pipeline via the
Vertex SDK.

* Added more parameters to the pipeline command
example. Moved the section down.

* Remove unintentional character interpolation

* Removed changes

* Undo formatting

* Remove old version of finetuning pipeline section

* Only allow huggingface datasets with the
finetuning pipeline.

* Fix linter issues
2024-01-23 18:43:35 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
f8f2f35920 chore(deps): bump pillow (#2639)
Bumps [pillow](https://github.com/python-pillow/Pillow) from 10.0.1 to 10.2.0.
- [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/10.0.1...10.2.0)

---
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>
2024-01-23 18:42:07 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
3c6198f8bc chore(deps): bump pillow (#2638)
Bumps [pillow](https://github.com/python-pillow/Pillow) from 10.0.1 to 10.2.0.
- [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/10.0.1...10.2.0)

---
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>
2024-01-23 18:41:39 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
3ed1f26dab chore(deps): bump pillow (#2637)
Bumps [pillow](https://github.com/python-pillow/Pillow) from 10.0.1 to 10.2.0.
- [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/10.0.1...10.2.0)

---
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>
2024-01-23 18:41:09 +00:00
3507602da1 feat: add llava 1.5 docker and notebook. (#2636)
Co-authored-by: Pooya Moradi <pooyam@google.com>
2024-01-23 18:40:22 +00:00
Amy WuandGitHub 0cae18cfba feat: Add Ray on Vertex AI cluster management sample (#2634)
* feat: Add Ray on Vertex cluster management sample

* fix: lint

* fix: vpc

* fix: python version

* fix: scale up

* fix: lint

* fix: clean up

* fix: update notebook

* fix: docs

* fix: docs

* fix: links
2024-01-23 18:25:25 +00:00
Aiden010200andGitHub e735195230 Upload examples of kfp v2 (#2627) 2024-01-18 19:08:49 +00:00
Kathy YuandGitHub c8f95d2121 Update Mixtral vLLM container and support OpenAI vLLM server. (#2630) 2024-01-18 19:06:48 +00:00
Huguens JeanandGitHub b679b3d72d Added individual download links for mipnerf360 dataset. (#2631) 2024-01-18 19:06:04 +00:00
joiceyeandGitHub c52ce038f6 notebook for stable video diffusion img2vid xt (#2626) 2024-01-15 15:15:18 +00:00
35f42fd9fc fix: Update RLHF large_model_reference to match text. (#2625)
Co-authored-by: Ryan Latture <latture@google.com>
2024-01-15 15:13:09 +00:00
jismailyan-googleandGitHub 252093ddf3 Add Fine-tuning Pipeline button instructions to Llama2 PEFT notebook (#2621)
* Add a section documenting the one-click finetuning
button in the Model Card UI.

The section explains how to use the button,
what the pipeline does and some troubleshooting
tips.

* Edit one-click finetuning instructions for clarity
and syntax.

* Correct 'Tensorboard' to 'TensorBoard'
2024-01-12 18:23:03 +00:00
Alicia WilliamsandGitHub 722a8cfe4c Update bq_ml_with_vision_translation_nlp.ipynb (#2624)
Update dataset links
2024-01-11 21:07:21 +00:00
weigaryandGitHub c9d4a27cff Update the SD notebooks using the new pytorch-diffusers-serve-opt container. (#2597)
* Update staable-diffusion 1.5 and XL notebooks to deploy with default GPU as L4, instead of A100.

* Update the SD notebooks using the new  container.

* Delete notebooks/community/model_garden/model_garden_pytorch_stable_diffusion_xl_1_0.ipynb

Resolve the merge conflict.

* Resolve the merge conflict.
2024-01-10 19:57:25 +00:00
Mend RenovateandGitHub 97de848e13 chore(deps): update dependency flake8 to v7 (#2612) 2024-01-10 15:33:50 +00:00
Mend RenovateandGitHub dea762c54a chore(deps): update dependency black to v23.12.1 (#2608) 2024-01-10 15:33:04 +00:00
Mend RenovateandGitHub e8ed4c3fd9 chore(deps): update actions/setup-python action to v5 (#2569) 2024-01-10 15:21:37 +00:00
Katie NguyenandGitHub 00b4598734 fix: lowercase hyperparameter tuning (#2616) 2024-01-10 15:06:00 +00:00
Katie NguyenandGitHub f5ccb578f4 fix: lowercase custom training (#2617) 2024-01-10 15:05:20 +00:00
Katie NguyenandGitHub cacbdbcf93 fix: lowercase maintenance (#2618) 2024-01-10 15:04:33 +00:00
Katie NguyenandGitHub 7737a98ec9 fix: lowercase hyperparameter tuning within text cells (#2619) 2024-01-10 15:03:51 +00:00
Ivan NardiniandGitHub 745bd03644 feat: adding Vertex AI Deployer notebook (#2613)
* adding vertexai deployer notebook

* linter test passed

* adding codeowners

* eric review

* linter test passed
2024-01-10 15:02:36 +00:00
Huguens JeanandGitHub c502dee709 Adding Pytorch-ZipNeRF notebook to Vertex AI samples model garden. (#2615)
* Adding Pytorch-ZipNeRF notebook to Vertex AI samples model garden.

* Format and lint Pytorch-ZipNeRF notebook.
2024-01-08 18:56:16 +00:00
KCFindstrandGitHub a1e0012df0 Add #ModelGarden Wizard LM notebook (#2614) 2024-01-08 18:54:46 +00:00
Douglass ChenandGitHub 9f6f46d56e Fix ready_to_go text classification pipeline notebook (#2609)
* Code fix, specify that old version of components library must be used

* reformat

* fix workbench url
2024-01-08 18:52:54 +00:00
Katie NguyenandGitHub f90d4f59c0 fix: lowercase distributed training (#2606) 2023-12-22 02:25:43 +00:00
Katie NguyenandGitHub 3e31d830c6 fix: lowercase batch prediction (#2605) 2023-12-21 23:36:18 +00:00
Katie NguyenandGitHub c0607f46ba fix: update name to cloud profiler (#2604) 2023-12-21 21:39:09 +00:00
Katie NguyenandGitHub b67cccb91a fix: update video workbook title (#2602) 2023-12-21 13:15:14 +00:00
Katie NguyenandGitHub 70db60129a fix: update workbook title (#2601) 2023-12-20 22:23:48 +00:00
Kathy YuandGitHub a185e106e0 Switch API for launching evaluation jobs and make bug fixes. (#2598)
* Switch API for launching evaluation jobs and make bug fixes.

* Fix linter issues.
2023-12-19 14:15:54 +00:00
dstnluong-googleandGitHub 38a1367fb8 Fix typos in Vicuna and Openllam Notebook. (#2594) 2023-12-15 19:50:53 +00:00
KCFindstrandGitHub f991f868d2 Add #ModelGarden wizard coder notebook. (#2595) 2023-12-15 19:49:56 +00:00
Eric DongandGitHub 813547b8fd fix: bad link to PaLM (#2596) 2023-12-15 16:06:41 +00:00
Kathy YuandGitHub 6cac1b2456 Add Mixtral 8x7B to Mistral notebook. (#2584) 2023-12-14 19:49:24 +00:00
Mend RenovateandGitHub f23cade8a6 chore(deps): update dependency isort to v5.13.2 (#2576) 2023-12-14 15:33:40 +00:00
Mend RenovateandGitHub 45520e9c06 chore(deps): update dependency nbqa to v1.7.1 (#2549) 2023-12-14 15:32:58 +00:00
Mend RenovateandGitHub 903c964487 chore(deps): update dependency black to v23.12.0 (#2470) 2023-12-14 15:32:16 +00:00
Mend RenovateandGitHub a3bb4afe06 chore(deps): update python docker tag to v3.12 (#2315) 2023-12-14 15:14:09 +00:00
f242e348c4 Document RLHF and inference pipelines support chat-bison@001. (#2577)
This adds `chat-bison@001` to the table of supported models and documents chat dataset formats for relevant input parameters.

Co-authored-by: Ryan Latture <latture@google.com>
2023-12-13 21:54:45 +00:00
weigaryandGitHub 8d47ab03c7 Add a new notebook for sdxl LCM (#2582)
* Add SDXL-turbo as a separate section in the SDXL notebook.

* Add SDXL-turbo as a separate section in the SDXL notebook.

* Add a new notebook for sdxl LCM
2023-12-13 21:50:35 +00:00
e8b86f503f Use open source detectron2 docker. (#2583)
Co-authored-by: minwoopark <minwoopark@google.com>
2023-12-13 21:48:35 +00:00
dstnluong-googleandGitHub 9449785b20 Switch TFvisio docker URIs to use vertex-ai (#2280) 2023-12-13 21:47:41 +00:00
genquan9andGitHub ac4f63b4e0 remove old vertex_vision_model_garden folder (#2570) 2023-12-13 19:56:38 +00:00
weigaryandGitHub 65ee5cdf52 Sd turbo (#2572)
* Add SDXL-turbo as a separate section in the SDXL notebook.

* Add SDXL-turbo as a separate section in the SDXL notebook.
2023-12-13 19:52:24 +00:00
dstnluong-googleandGitHub 90219e0a76 Add GPTQ to Falcon Instruct (#2574)
* Add local inference for Falcon Instruct

* Lint

* Add memory necessary for falcon 7b

* nit: Typo

* add gptq quantization to falcon

* lint

* typo

* Comment out one setting.
2023-12-13 19:49:39 +00:00
dstnluong-googleandGitHub d2ad1dd763 Add cache_examples_on_gpu flag to GPTQ. (#2579)
* Add cache_examples_on_gpu flag to GPTQ.

* Lower GPU suggestions for 70b model.

* Lower GPU suggestions for 70b.

* Typo
2023-12-13 19:47:07 +00:00
Kathy YuandGitHub b2ec0e956e Update timm notebook to use vertex-ai docker link. (#2580) 2023-12-13 19:45:01 +00:00
dstnluong-googleandGitHub 7fb60acf89 Create 5 separate notebooks from LLaMA2 notebook sections (#2568)
* add deployment notebook

* lint

* add finetune notebook

* lint

* lint

* add evaluation notebook

* lint

* add rlhf notebook

* lint

* lint rlhf notebook?

* add notebooks to codeowners
2023-12-05 20:50:46 +00:00
genquan9andGitHub 4f2408ce9e use the vertex_model_garden links instead of vertex_vision_model_garden (#2567) 2023-12-05 20:50:13 +00:00
Kathy YuandGitHub ef9a176c75 Add evaluation for CodeLLaMA and fix typos in CodeLLaMA and Mistral notebooks. (#2566) 2023-12-04 15:11:41 +00:00
genquan9andGitHub e72fffd682 copy vertex_vision_model_garden as vertex_model_garden (#2565) 2023-12-04 15:11:07 +00:00
KCFindstrandGitHub a9301eeb64 Add hyperparameter tuning examples to #PEFT Llama2 and OpenLlama notebooks (#2564) 2023-12-04 15:10:04 +00:00
weigaryandGitHub 9e2dcd494a Add charts to the benchmark report. (#2563)
* Add charts to the benchmark report.

* Add charts to the benchmark report.
2023-12-02 00:09:06 +00:00
KCFindstrandGitHub 2ae33b5b12 Add OpenLLaMA hyperparameter tuning benchmark report (#2562) 2023-12-01 22:47:03 +00:00
weigaryandGitHub d85a1e9c0c Update the SD XL notebook for refiner to use the default GPU as L4 (instead of A100). (#2561) 2023-12-01 22:46:30 +00:00
dstnluong-googleandGitHub fff9673703 Add SD benchmarking report (#2560)
* Add SD benchmarking report

* Fix images

* remove old table

* grammar

* lint

* typo
2023-12-01 22:45:50 +00:00
dstnluong-googleandGitHub 55fbb89a95 Update Docker URIs. (#2554)
* Update Docker URIs.

* lint

* update docker URI

* typo

* add comma

* lint

* fix parameters

* Add quantization method to gptq
2023-12-01 22:45:12 +00:00
dstnluong-googleandGitHub 007610f4f2 Add quantization section for Openllama (#2551)
* Add quantization section for Openllama

* use peft serving for 3b quantized

* missing comma

* lint

* add quantization_method to gptq

* add quantization_method to gptq
2023-12-01 22:44:36 +00:00
weigaryandGitHub 1354c74058 Move the openllama 7b benchmark report to the centralized place. (#2559) 2023-12-01 22:43:34 +00:00
Andrew FerlitschandGitHub f36ab8ef40 fix: online FS (#2558) 2023-11-30 17:08:43 +00:00
Andrew FerlitschandGitHub 33793dbb78 fix: backticks (#2557) 2023-11-30 15:05:18 +00:00
Lav RaiandGitHub d3bdf63115 Vit report (#2556)
* Add ViT benchmarking report.

* Add ViT benchmarking report.

* Add ViT benchmarking report.

* Add ViT benchmarking report.

* Add ViT benchmarking report.

* Add ViT benchmarking report.
2023-11-30 14:20:04 +00:00
weigaryandGitHub f3395041e4 Add openllama-7b fine tuning benchmark report. (#2555) 2023-11-30 14:19:29 +00:00
Andrew FerlitschandGitHub 5dfc87cbab fix: FS legacy delete (#2553) 2023-11-29 18:17:40 +00:00
Andrew FerlitschandGitHub a162066c94 in-progress: SDK whl replacement (#2552)
* in-progress: SDK whl replacement

* add: cmd param
2023-11-29 18:17:07 +00:00
dstnluong-googleandGitHub a4940cc2ba Add quantization to llama2 notebook (#2550) 2023-11-29 03:20:21 +00:00
Andrew FerlitschandGitHub d1dfe04ff0 2nd part of deprecate (#2542)
* 2nd part of deprecate

* fix links
2023-11-22 23:55:33 +00:00
fca8a0f9f5 Support DITO custom categories (#2543)
Co-authored-by: minwoopark <minwoopark@google.com>
2023-11-20 21:27:39 +00:00
Andrew FerlitschandGitHub ea3a5d3d79 deprecate flaky notebook (#2541) 2023-11-20 19:25:19 +00:00
Andrew FerlitschandGitHub 013bd9b78b fine tuning: auto error detection (#2539) 2023-11-20 18:42:28 +00:00
Andrew FerlitschandGitHub 1ca46e450d update: notebook status (#2535) 2023-11-20 16:52:16 +00:00
Xiang XuandGitHub 6c4f09fd43 increase max_num_batched_tokens for vllm and remove streaming (#2536) 2023-11-17 20:46:26 +00:00
Andrew FerlitschandGitHub 66427bd244 fix: detecting internal (#2534) 2023-11-17 20:37:13 +00:00
weigaryandGitHub d49bae8d29 Update staable-diffusion 1.5 and XL notebooks to deploy with default GPU as L4, instead of A100. (#2533) 2023-11-17 19:40:17 +00:00
Andrew FerlitschandGitHub 66c05c8217 fix: typo in results vs result (#2532) 2023-11-17 18:46:51 +00:00
Andrew FerlitschandGitHub 79473f0b88 fix: cleanup for FS 2.x (#2526) 2023-11-17 14:35:47 +00:00
Andrew FerlitschandGitHub 2568e012f9 fix: detect other types of quota and internal errors (#2525) 2023-11-16 23:50:25 +00:00
Kathy YuandGitHub 97fa323aca Fix typo in LLaMA 2 instructions. (#2524) 2023-11-16 22:04:52 +00:00
Kelsi LakeyandGitHub 20a9ff65e0 Update IMAGE_URI in tensorboard_custom_training_with_custom_container.ipynb (#2522)
Add variable in IMAGE_URI to set region. Right now it is hard-coded to us-central1.
2023-11-16 22:04:11 +00:00
Andrew FerlitschandGitHub ed6de9fde5 feat: stub and document reaper support for FS 2.x (#2521) 2023-11-15 22:04:01 +00:00
zhangxiaotianandGitHub dbaa3d098c fix clean up (#2520)
* improve to make it more aligned with the template

* fix:fix clean up section
2023-11-15 21:53:44 +00:00
Andrew FerlitschandGitHub 7e77de2800 CI/CD fix (#2514)
* CI/CD fix

* pin 1.34
2023-11-15 17:59:11 +00:00
Andrew FerlitschandGitHub ef8b70db32 Update CI/CD fix (#2513) 2023-11-15 00:09:33 +00:00
578adab3b0 revert how sdk is downloaded (#2518)
Co-authored-by: Kamal Gurala <gkamal@google.com>
2023-11-15 00:08:22 +00:00
KCFindstrandGitHub 3ef187ecc3 Update Llama2 PEFT notebook train docker version (#2519) 2023-11-15 00:05:45 +00:00
23dc370602 Updates optimized to remove known issues (#2512)
Co-authored-by: Kamal Gurala <gkamal@google.com>
2023-11-15 00:05:17 +00:00
Andrew FerlitschandGitHub d1835e98af feat: auto find latest build results (#2517) 2023-11-15 00:00:31 +00:00
823c10315a Update vector notebook to remove disclaimer (#2515)
* Update vector notebook to disclaimer

* Update region used for vector case

---------

Co-authored-by: Kamal Gurala <gkamal@google.com>
2023-11-14 22:51:17 +00:00
Kathy YuandGitHub 497297007c Update serving container version for sequence classification models. (#2509) 2023-11-14 22:17:31 +00:00
87ddc8ec00 Update for GA relase, use v1 sdk, and remove known issues (#2510)
* Updates Bigtable serving noteebok for GA release

* Removes preview disclaimer

* Updates from linter

---------

Co-authored-by: Kamal Gurala <gkamal@google.com>
2023-11-14 22:17:01 +00:00
Andrew FerlitschandGitHub eb104d4d92 fix: capture log on fail (#2508) 2023-11-14 20:59:49 +00:00
zhangxiaotianandGitHub ba335b250b improve to make it more aligned with the template (#2506) 2023-11-14 20:41:57 +00:00
Andrew FerlitschandGitHub 5f014bcf34 CI/CD debug (#2503) 2023-11-14 20:30:29 +00:00
Andrew FerlitschandGitHub 0d453b7e01 documented what to do for FS 2.x cleanup (#2507) 2023-11-14 18:27:23 +00:00
Andrew FerlitschandGitHub 379644e115 Update CI/CD debug (#2504) 2023-11-14 16:43:53 +00:00
Andrew FerlitschandGitHub 72ab1484b7 deprecate to community (#2502) 2023-11-14 16:32:54 +00:00
zhangxiaotianandGitHub 885a62489e fix: fix image rending for running in Jupyter (#2501) 2023-11-14 15:45:47 +00:00
Andrew FerlitschandGitHub 9591e8db4d fix CI/CD (#2498) 2023-11-14 00:27:39 +00:00
Andrew FerlitschandGitHub 9757e14644 feat: filter for notebooks under investigation (#2497) 2023-11-13 23:53:33 +00:00
Kathy YuandGitHub 959c56a4c7 Add documentation for building chat applications using LLaMA 2. (#2494) 2023-11-13 19:17:29 +00:00
Andrew FerlitschandGitHub ea1afda39d fix: internal and log url (#2492) 2023-11-13 19:06:41 +00:00
weigaryandGitHub e8539218e4 Temporarily pin the docker to 20231112_0948_RC00. (#2493) 2023-11-13 18:49:32 +00:00
Andrew FerlitschandGitHub 4fb0761fb8 add log url (#2490)
* add log url

* fix: syntax error

* fix: syntax error
2023-11-13 17:39:16 +00:00
Andrew FerlitschandGitHub 6a61010225 feat: finish round1 of dirty dashboard (#2489)
* feat: finish round1 of dirty dashboard

* debug: CICD issue
2023-11-13 17:38:04 +00:00
838e72087f refactor: explicitly prepare featch_Feature_values request (#2485)
* refactor: explicitly prepare featch_Feature_values request

* Fix unintednded metadata updates

* Fixes from linter

* add unique to resource ids

* add unique to resource ids for public optimized

---------

Co-authored-by: Kamal Gurala <gkamal@google.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2023-11-11 01:15:29 +00:00
zhangxiaotianandGitHub c633231e07 Warehouse (#2484)
* add warehouse sdk colab

* update owner

* update colab and github link

* resolve comments

* resolve comments

* resolve comments

* fix format

* remove unused code

* resolve lint
2023-11-10 23:03:37 +00:00
zhangxiaotianandGitHub 5f73c9e445 create a notebook for image warehouse (#2488)
* create a notebook for image warehouse

* update

* resolve comments

* resolve comments
2023-11-10 22:41:14 +00:00
Andrew FerlitschandGitHub 4d77391672 fix: bad link (#2486) 2023-11-10 21:18:32 +00:00
Matthew TangandGitHub 289db671b8 [Vertex AI SDK] Remove sdk2 wording from bigframes notebooks (#2487)
* Remove sdk2 wording

* don't override class
2023-11-10 21:15:29 +00:00
weigaryandGitHub c725d85433 Update stable diffusion 2.1 notebook to use the optimized serving docker (#2483)
* Update stable diffusion 2.1 notebook to use the optimized serving docker.

* Update model_garden_pytorch_stable_diffusion_2_1.ipynb

* Update model_garden_pytorch_stable_diffusion_2_1.ipynb
2023-11-10 21:13:22 +00:00
Andrew FerlitschandGitHub 6f48419a31 pin to fix CI/CD failure (#2480) 2023-11-10 18:02:30 +00:00
Andrew FerlitschandGitHub 3c83824d02 fix syntax error (#2481) 2023-11-09 19:54:23 +00:00
Andrew FerlitschandGitHub 7d53d90235 fix: timeout in CI/CD (#2478) 2023-11-09 19:42:43 +00:00
Matthew TangandGitHub fc3f467899 [Vertex AI SDK] Remove bigframes tf-io installation on user side (#2472)
* Remove tf-io installation on user side

* Fix lint
2023-11-09 19:31:40 +00:00
Andrew FerlitschandGitHub 11fe3dbc28 fix: missing link (#2466) 2023-11-09 18:11:12 +00:00
Andrew FerlitschandGitHub 253f755d86 fix: remove output (#2476) 2023-11-09 16:50:03 +00:00
Mend RenovateandGitHub 89b868705b chore(deps): update actions/checkout action to v4 (#2394) 2023-11-09 14:32:16 +00:00
Mend RenovateandGitHub 038fc057ee chore(deps): update dependency pyupgrade to v3.15.0 (#2314) 2023-11-09 14:30:53 +00:00
Andrew FerlitschandGitHub 4377a1b485 fix: bug in selection algo for age and max notebooks (#2475)
* fix: invert time test

* fix: percent unt
2023-11-09 00:17:51 +00:00
Andrew FerlitschandGitHub 9f5cb39eb4 already in official (#2477) 2023-11-09 00:17:28 +00:00
yexing111andGitHub 103c168a82 Rephrase optimized notebook to address previous comment (#2473)
* Rephrase optimized notebook

* Update format issue and change region

* Update format issue and change region2

* Fix import format

* Apply format

* Change region
2023-11-08 22:04:42 +00:00
Andrew FerlitschandGitHub 42914ffba6 fix: read from local file (#2474)
* fix: read from local file

* fix: GCS file
2023-11-08 21:46:03 +00:00
Andrew FerlitschandGitHub b4f3601262 debug: saving results (#2471) 2023-11-08 19:48:43 +00:00
yexing111andGitHub 3978ea80bf Create new colab for FS optimized serving (#2454)
* Create new colab for FS optimized serving

* Address comments

* Fix allowlist syntax error with param

* Change default region to trigger test in clean env

* Comment expect to fail cells

* Change default region to trigger test
2023-11-08 13:15:24 +00:00
Kelsi LakeyandGitHub b3a8e98150 Update delete_outdated_tensorboard_experiments.ipynb (#2469)
Change detailed_log to match DETAILED_LOG variable defined above.
Add note about how user can set tensorboard experiment labels.
2023-11-08 00:56:39 +00:00
weigaryandGitHub 817e9f6f5f Update stable diffusion XL notebook to use the optimized serving docker. (#2467)
* Update stable diffusion XL notebook to use the optimized serving docker.

* Update model_garden_pytorch_stable_diffusion_xl_1_0.ipynb

minor update

* Update model_garden_pytorch_stable_diffusion_xl_1_0.ipynb

minor update
2023-11-08 00:55:49 +00:00
Andrew FerlitschandGitHub f028260fe9 feat: detect error from log (#2465)
* feat: detect error from log

* fix: None
2023-11-07 15:57:13 +00:00
Mend RenovateandGitHub 3b0dc3a9af chore(deps): update dependency black to v23.10.1 (#2086) 2023-11-07 13:51:08 +00:00
Kathy YuandGitHub d27adf8c47 Update swap space setting for CodeLLaMA notebook. (#2462) 2023-11-07 00:13:51 +00:00
KCFindstrandGitHub 4873c54cf0 Add hyperparameter tuning instructions to llama2 PEFT notebook (#2460) 2023-11-07 00:13:27 +00:00
Andrew FerlitschandGitHub 55645a8583 fix: protect harness from system wide execution failure (#2464)
* feat: add option for files not to index

* fix: harden harness against system failure
2023-11-06 16:17:38 +00:00
Andrew FerlitschandGitHub 47da217cca Tpu ga 2 (#2461)
* migrate to official

* fix: AR permission

* fix: TPU available

* convert to KFP2
2023-11-03 20:49:48 +00:00
Andrew FerlitschandGitHub 2cc877438c fix: timeout (#2458) 2023-11-02 16:46:34 +00:00
Jose BracheandGitHub 2ee1c72bf9 Jbrache 20231101 (#2457)
* chore: Renaming notebook, updated text formatting, typos.

* chore: Renaming notebook, updated text formatting, typos.
2023-11-02 16:42:41 +00:00
Kathy YuandGitHub ee5f69b5b8 Add deployment recommendations, clarifications and bug fixes to PEFT and vLLM notebooks. (#2455) 2023-11-01 20:19:26 +00:00
Andrew FerlitschandGitHub da3f4abbc2 updates for webdoc index generation (#2456)
* fix: remove backticks

* fix: vector search branding
2023-11-01 18:52:04 +00:00
Andrew FerlitschandGitHub cc585a3faa fix broken links (#2453) 2023-11-01 13:27:59 +00:00
Andrew FerlitschandGitHub 6afc5ce353 fix: skipping in indexer (#2452) 2023-10-31 22:36:33 +00:00
Andrew FerlitschandGitHub 9cb9d272f0 fix: last date ran (#2451) 2023-10-31 21:00:07 +00:00
weigaryandGitHub 759726e7b4 Update the stable diffusion 1.5 notebook to use the optimized serving docker image (#2450) 2023-10-31 20:55:23 +00:00
kemurayamaandGitHub d282fe7461 Update model_garden_pytorch_stable_diffusion_2_1.ipynb (#2446)
Deleted `torch_dtype=torch.float16` on line 397
2023-10-31 20:54:57 +00:00
Andrew FerlitschandGitHub ed7cd22e27 feat: add arg for run first file (#2449) 2023-10-31 19:04:32 +00:00
Andrew FerlitschandGitHub fdac86f541 fix: run first (#2448) 2023-10-31 17:54:22 +00:00
Andrew FerlitschandGitHub 7f464a92e0 migrate to official (#2443)
* migrate to official

* fix: missing install

* fix: import os

* fix: IS_COLAB
2023-10-30 19:11:44 +00:00
Andrew FerlitschandGitHub a779d317af migrate to official (#2431)
* migrate to official

* fix: artifact registry

* fix: lint

* fix: missing image

* fix: add more cleanup
2023-10-30 19:10:05 +00:00
Andrew FerlitschandGitHub ee538ce371 migrate to official (#2444)
* migrate to official

* fix: missing installs

* fix: IS_COLAB
2023-10-30 17:27:30 +00:00
Andrew FerlitschandGitHub 2ec5b39bdc migrate to official (#2441)
* migrate to official

* fix: remove param

* fix: IS_COLAB

* fix: requirements.txt

* fix: image missing

* fix: IS_TESTING

* fix: IS_TESTINGFG
2023-10-30 14:27:17 +00:00
Andrew FerlitschandGitHub 68f160db50 migrate to official (#2445) 2023-10-30 14:20:12 +00:00
Andrew FerlitschandGitHub b65392f2be fix: learn more about (#2419)
* fix: learn more about

* fix: VPC issue

* fix: VPC issue

* fix: handle exception

* fix: add VPC network

* fix: lint
2023-10-30 14:06:58 +00:00
Jaycee LiandGitHub 6625012a95 Move sdk2 bigframes notebooks (#2440)
* Refactor SDK 2.0 notebooks

* fix linting

* Update CODEOWNERS

* change codeowner username

* install dependencies

* update dependencies

* update folder name

* Update CODEOWNERS

* move sdk2 notebooks

* linting
2023-10-27 17:47:55 +00:00
e542e915b1 Colab (#2439)
* Support Colab Enterprise

* Support Colab Enterprise

---------

Co-authored-by: minwoopark <minwoopark@google.com>
2023-10-27 17:47:00 +00:00
Huguens JeanandGitHub 757419e1b1 Update BioGPT serve docker URI in notebook. (#2438) 2023-10-27 17:46:28 +00:00
Andrew FerlitschandGitHub 3dd41db8a5 fix: timeouts (#2437) 2023-10-27 17:01:30 +00:00
Andrew FerlitschandGitHub c027f88d2a fix: unreliable service (#2436) 2023-10-27 15:30:43 +00:00
Mend RenovateandGitHub 596bb6a6b7 chore(deps): update dependency flake8 to v6.1.0 (#2131) 2023-10-27 14:56:51 +00:00
xqr-gandGitHub d3a6a7bf91 change model version (#2433) 2023-10-26 23:03:11 +00:00
Jaycee LiandGitHub be68829742 Refactor SDK 2.0 notebooks (#2367)
* Refactor SDK 2.0 notebooks

* fix linting

* Update CODEOWNERS

* change codeowner username

* install dependencies

* update dependencies

* update folder name

* Update CODEOWNERS
2023-10-26 18:54:02 +00:00
dstnluong-googleandGitHub 64be3cd9ee Fix VLLM format string. (#2432)
* Minor updates to Vicuna notebook

* Lint

* Fix format string for Vicuna notebook.
2023-10-26 17:41:33 +00:00
Eric DongandGitHub 2414433f94 chore: remove unnecessary comments from the template (#2428) 2023-10-26 15:40:49 +00:00
Andrew FerlitschandGitHub 7206ea4d99 Harden 9 (#2429)
* fix: force run based on age of last run

* fix: force run based on age of last run
2023-10-26 15:40:34 +00:00
Andrew FerlitschandGitHub 8dad9cd13f fix: clean and rebrand - permission (#2335)
* fix: clean and rebrand

* fix: VPC setup

* rebrand

* rebrand

* fix: PROJECTT

* fix: VPC network

* fix: redis

* fix: import os
2023-10-25 21:20:59 +00:00
Andrew FerlitschandGitHub d0037863ff feat: record last date of fail (#2425) 2023-10-25 17:20:12 +00:00
Andrew FerlitschandGitHub ce4b2b1781 fix CI/CD error (#2423) 2023-10-25 17:03:37 +00:00
Andrew FerlitschandGitHub 8b2e7766c3 add more notebooks to list (#2424) 2023-10-25 16:51:11 +00:00
Andrew FerlitschandGitHub 7844755cac feat: select notebook if failed on last run (#2420) 2023-10-25 12:56:53 +00:00
Andrew FerlitschandGitHub 6f566cc4f8 feat: add option for files not to index (#2418) 2023-10-24 18:59:35 +00:00
Andrew FerlitschandGitHub 6ac2f82c0b debug CI/CD failure (#2405)
* debug CI/CD failure

* pin GCPC version
2023-10-24 18:24:55 +00:00
Andrew FerlitschandGitHub 1f818fe469 Harden 3 (#2416)
* feat: run-first argument

* feat: run-first code

* feat: add run first file
2023-10-24 17:03:33 +00:00
weigaryandGitHub 51f87eb06a Pin the transformer-serve version in the NLLB notebook (#2417) 2023-10-24 16:58:33 +00:00
KCFindstrandGitHub cdb5c1c54b Switch #BiomedCLIP default GPU to V100 (#2415) 2023-10-24 16:58:03 +00:00
dstnluong-googleandGitHub 7f6c2f28d3 Minor updates to Vicuna notebook. (#2410)
* Minor updates to Vicuna notebook

* Lint
2023-10-24 16:57:28 +00:00
Kathy YuandGitHub ced4f55dac Add V100 recommendations for LLaMA 2. (#2409) 2023-10-24 16:56:52 +00:00
Andrew FerlitschandGitHub a5a003b831 Harden 2 (#2414)
* feat: run-first argument

* feat: run-first code
2023-10-24 13:57:46 +00:00
Andrew FerlitschandGitHub e7b8238615 fix: filename only not path (#2412) 2023-10-23 20:11:19 +00:00
Andrew FerlitschandGitHub e5a50be51e feat: skip notebook option (#2411) 2023-10-23 19:37:37 +00:00
Andrew FerlitschandGitHub e5bfc74c11 clean: not index notebooks w/o webdoc page (#2408) 2023-10-23 17:57:49 +00:00
Andrew FerlitschandGitHub d03779423c cleanup: obsolete build files (#2406) 2023-10-23 17:01:54 +00:00
weigaryandGitHub ba62d20dad Update an incorrect hyperlink in the NLLB notebook. (#2403)
* Add a notebook example for the NLLB model in model garden

* Add a notebook example for the NLLB model in model garden

* Update an incorrect hyperlink in the NLLB notebook.
2023-10-23 16:30:56 +00:00
KCFindstrandGitHub 50273e9883 Tag PEFT trainer docker in #ModelGarden notebooks. (#2404) 2023-10-20 23:42:07 +00:00
Kelsi LakeyandGitHub d6ab1248e2 Remove tensorboard billing alert from get_started_with_vertex_experiments_autologging.ipynb (#2402) 2023-10-20 23:39:59 +00:00
c6f451c8d1 Patch-4 (#2363)
* Miscellaneous editorial fixes and rebranding to "Vertex AI Feature Store (Legacy)"

* chore: rebrand Legacy Feature Store product

* chore: Rebrand to "Vertex AI Feature Store (Legacy)" and change "ingest" to "import".

---------

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2023-10-20 22:26:02 +00:00
Andrew FerlitschandGitHub 71f3f12607 fix CI/CD failure (#2398) 2023-10-20 20:51:01 +00:00
Sebastian SchmidtandGitHub c7b9274c2e Display generated images in Image Generator notebook (#2395)
* Display generated images in Image Generator notebook

* Style

* Lint
2023-10-20 18:47:40 +00:00
Kathy YuandGitHub ee46a01c83 Open-source ImageBind serving Docker image. (#2401)
* Open-source ImageBind serving Docker image.

* Update CODEOWNERS to cover ImageBind.
2023-10-20 18:19:35 +00:00
Kathy YuandGitHub d8a6659fd2 Update deployment recommendations in ImageBind notebook. (#2400) 2023-10-20 18:18:55 +00:00
Andrew FerlitschandGitHub b24eb863af migrate to official (#2354)
* migrate to official

* workaround VPC

* fix: missing title
2023-10-20 18:15:59 +00:00
Andrew FerlitschandGitHub a0bebae049 migrate to official (#2355)
* migrate to official

* fix: settings

* workaround VPC
2023-10-20 17:35:46 +00:00
Andrew FerlitschGitHubivanmkc@google.com <ivanmkc@google.com>
1cab2c2d1c rebrand and clean (#2350)
* rebrand and clean

* fix: Added better type checking and fixed misspelling of _GCP_VPC_NETWORK_NAME

---------

Co-authored-by: ivanmkc@google.com <ivanmkc@google.com>
2023-10-20 15:50:52 +00:00
Andrew FerlitschandGitHub f0dacd8ccd deprecate to community (#2396) 2023-10-20 12:31:17 +00:00
Andrew FerlitschandGitHub 9b8dd67fc6 clean and rebrand - parallelism (#2338)
* clean and rebrand

* import

* import

* fix: lint

* deprecate: move to community

* fix: lint
2023-10-20 12:30:21 +00:00
Andrew FerlitschandGitHub fe57394773 fix: link (#2393) 2023-10-19 16:58:36 +00:00
Kathy YuandGitHub 6b98f077b7 Add ImageBind notebook. (#2392) 2023-10-19 16:56:50 +00:00
Huguens JeanandGitHub b515719465 Chore: Open source Segment Anything handler and dockerfile to Model Garden. (#2389) 2023-10-19 16:56:06 +00:00
dstnluong-googleandGitHub 0603133c15 Add accelerator suggestions for Vicuna. (#2374)
* Add Vicuna notebook

* Add notebook to CODEOWNERS

* add GPU recs

* replace 33b with 13b-32k

* lint

* Update accelerator count

* Lint

* Add suggested accelerator setup.

* Lint

* Add comment for max_model_len

* remove license line
2023-10-19 16:55:37 +00:00
Andrew FerlitschandGitHub 9901150c5c fix: add missing learn about (#2388) 2023-10-18 19:23:25 +00:00
3d7886eb0b Fix CODEOWNERS change due to merge conflict. (#2390)
Co-authored-by: minwoopark <minwoopark@google.com>
2023-10-18 17:29:54 +00:00
9abb80db28 Add DITO notebook (#2387)
Co-authored-by: minwoopark <minwoopark@google.com>
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2023-10-18 16:55:29 +00:00
85e93c8db3 Add OWL-ViT v2 notebook (#2386)
* Add OWL-ViT v2 notebook

* Add OWL-ViT v2 notebook.

---------

Co-authored-by: minwoopark <minwoopark@google.com>
2023-10-18 16:53:24 +00:00
Andrew FerlitschandGitHub df11806ebf fix: missing learn more about (#2384) 2023-10-18 14:16:28 +00:00
Andrew FerlitschandGitHub 57210868ad fix: missing learn more about (#2385) 2023-10-18 12:28:23 +00:00
Jose BracheandGitHub 44fa59f6de Jbrache persistent resource (#2379)
* feat: Committing new example for persistent resources

* feat: Committing new example for persistent resources
2023-10-17 21:32:52 +00:00
Xiang XuandGitHub d397549dac fix streaming (#2378) 2023-10-17 19:42:20 +00:00
Andrew FerlitschandGitHub c45aaff2f1 fix: handling H1 heading (#2383) 2023-10-17 17:47:12 +00:00
Andrew FerlitschandGitHub 88cf9b3278 update indices (#2382) 2023-10-17 17:42:09 +00:00
Matthew TangandGitHub b589216811 Clean up SDK2 Bigframes notebooks (#2362)
* Clean up SDK2 Bigframes notebooks

* Debug ci dependency error

* Remove cell output

* Remove local overrides

* Additional debug

* Re-trigger CI test

* Rerun CI tests

* Rerun CI tests

* Rerun CI tests

* Add tensorflow-io-gcs-filesystem pin

* Fix version pin

* Fix other version pin
2023-10-17 17:05:54 +00:00
Andrew FerlitschandGitHub 7ae85ce5d6 fix: CI/CD failure (#2377)
* fix: CI/CD failure

* deprecate from official

* lint
2023-10-17 15:58:15 +00:00
Andrew FerlitschandGitHub 0ad3530420 Debug CI/CD failure (#2375)
* Debug CI/CD failure

* change TF11 to TF12

* Update get_started_with_custom_training_autologging_local_script.ipynb

try 2.10

* valid TF12
2023-10-16 23:36:47 +00:00
Andrew FerlitschandGitHub 58547f4630 CI/CD: debug fail (#2346)
* CI/CD: debug fail

* unhardcode the PROJECT_ID
2023-10-16 23:36:02 +00:00
Sebastian SchmidtandGitHub 4fca43d63d Update MediaPipe Image Generator notebook with latest changes (#2372) 2023-10-16 16:40:25 +00:00
KCFindstrandGitHub 8a0acfa1b0 Remove misleading prompt output from openllama notebook (#2371) 2023-10-13 15:35:24 +00:00
KCFindstrandGitHub 90001d4234 Add custom dataset support to #ModelGarden PEFT notebooks (#2370)
* Add custom dataset support to #ModelGarden PEFT notebooks

* Update OpenLLaMA notebook

* Revert unnecessary change in Llama2 notebook.
2023-10-12 20:10:13 +00:00
sen-samandGitHub 3d4bd5fdfc chore: rebrand "Vertex AI Feature Store (Legacy)", miscellaneous editorial changes, and changing "ingest" to "import" globally. (#2369) 2023-10-12 20:09:17 +00:00
Kathy YuandGitHub 283c0a3727 Add model evaluation to Dolly V2 notebook. (#2368) 2023-10-12 20:08:23 +00:00
Andrew FerlitschandGitHub bbfc2d9114 migrate to official (#2356)
* migrate to official

* fix: os

* fix: review

* fix: review
2023-10-12 00:17:20 +00:00
Kathy YuandGitHub fa1cfbe09b Remove extra print statement in LLaMA 2 notebook. (#2366) 2023-10-11 22:48:51 +00:00
KCFindstrandGitHub c781c9f7ad Update #ModelGarden TFVision notebooks model export docker URI. (#2365) 2023-10-11 22:48:26 +00:00
Huguens JeanandGitHub 4c37f8e43b Update SAM docker URI and accelerator type for vertex endpoint deployment. (#2361) 2023-10-11 22:47:41 +00:00
KCFindstrandGitHub acf5853b98 Add #ModelGarden BiomedCLIP notebook. (#2364) 2023-10-11 19:05:29 +00:00
Julio Anthony LeonardandGitHub 7d086b08e7 Fix typos and sentence (#2359)
Fix a typo and add more clarity to sentences
2023-10-11 12:17:33 +00:00
sen-samandGitHub e4275197ac Miscellaneous editorial fixes and rebranding to "Vertex AI Feature Store (Legacy)" (#2358)
* Miscellaneous editorial fixes and rebranding to "Vertex AI Feature Store (Legacy)"

* chore: rebrand Legacy Feature Store product
2023-10-11 00:35:56 +00:00
Xiang XuandGitHub 8fede82c32 Upgrade deps version for Mistral model (#2351) 2023-10-09 22:53:13 +00:00
Andrew FerlitschandGitHub e598af21ac debug: CI/CD failure (#2347)
* debug: CI/CD failure

* debug: CI/CD failure
2023-10-06 22:24:59 +00:00
Andrew FerlitschandGitHub 682786616c port: kfp2 (#2302)
* port: kfp2

* fix import importer_node

* fix: selector

* fix: format

* lint

* set node

* fix: types

* fix: type

* types

* yaml/json

* yaml/json

* train image

* train image

* key error

* fix: outputs

* fix: outputs

* fix: outputs

* fix: outputs

* fix: outputs
2023-10-06 20:40:51 +00:00
dstnluong-googleandGitHub feee6149a1 Add Vicuna notebook (#2252)
* Add Vicuna notebook

* Add notebook to CODEOWNERS

* add GPU recs

* replace 33b with 13b-32k

* lint

* Update accelerator count

* Lint
2023-10-06 17:57:31 +00:00
Huguens JeanandGitHub bf374c8c5e Fix BioGPT notebook name in Vertex AI Model Garden. (#2344) 2023-10-06 17:29:02 +00:00
Xiang XuandGitHub 7e58fb8471 add streaming to llm notebooks (#2345) 2023-10-06 17:27:22 +00:00
Andrew FerlitschandGitHub 37f75ce3da fix: rebrand (#2342) 2023-10-06 13:45:14 +00:00
Andrew FerlitschandGitHub 2b94e8b51e fix: rebrand (#2343) 2023-10-06 13:43:37 +00:00
Andrew FerlitschandGitHub 0041b7da91 fix: rebrand (#2341) 2023-10-06 13:42:32 +00:00
Andrew FerlitschandGitHub 6de14d11c8 port: kfp2 (#2327)
* port: kfp2

* fix: imports

* fix: v1

* fix: params

* fix: params

* fix: imports

* fix: model upload

* fix: importer node

* fix: artifacts_type

* fix: component paths

* fix: component paths

* fix: component paths
2023-10-06 00:20:50 +00:00
Rajesh ThallamandGitHub 203d2e8a0b Add Mistral models to Vertex AI Model Garden (#2340)
* PyTorch efficient training - refcator code

* Revert "PyTorch efficient training - refcator code"

This reverts commit 90b563a7697b15b4154ac76236b894253dd58f3c.

* Add notebook to deploy Mistral models on Vertex AI

* Add notebook to deploy Mistral models on Vertex AI

* Add notebook to deploy Mistral models on Vertex AI

* Updated notebook to deploy Mistral models on Vertex AI

* Linting fixes

* Adding endpoint cleanup and machine spec

* Updating CODEOWNERS file

* Update linting fixes
2023-10-06 00:02:22 +00:00
Andrew FerlitschandGitHub ca7cb251ec fix: rebrand (#2339) 2023-10-05 23:21:42 +00:00
Andrew FerlitschandGitHub db359011f4 fix: rebrand/clean (#2334) 2023-10-05 22:56:14 +00:00
Andrew FerlitschandGitHub 52313b8fc4 fix: remove redis (#2333) 2023-10-05 22:55:39 +00:00
sen-samandGitHub c6a2c8e673 Update online_feature_serving_and_fetching_bigquery_data_with_feature_store.ipynb (#2331)
Made a minor fix flagged by the PM.
2023-10-05 18:48:08 +00:00
sen-samandGitHub 3e090ce61d Update online_feature_serving_and_vector_retrieval_bigquery_data_with_feature_store.ipynb (#2332)
Minor change (restored the missing "of" in the title).
2023-10-05 18:47:40 +00:00
Huguens JeanandGitHub 8061ce96ed Add BioGPT to Vertex AI Model Garden. (#2323) 2023-10-05 15:51:28 +00:00
5eeb4b1fd9 Add offical notebook for Vertex SDK LLM snippets (#1843)
* Add offical notebook for Vertex SDK LLM snippets

* Updating based on template

* cleanup for linter

* edit notebook

* fix lint

* test checks

* project id

* comply with template

* fix lint

* add pandas import

* fix lint

* fix test error

* Address Andy's comments

---------

Co-authored-by: Yvonne <liyvonne@google.com>
2023-10-05 00:15:02 +00:00
Andrew FerlitschandGitHub bc14aa72b9 fix: CI/CD failure (#2329) 2023-10-04 23:18:20 +00:00
Andrew FerlitschandGitHub c9faf848b2 port: kfp2 (#2328) 2023-10-04 23:17:29 +00:00
Andrew FerlitschandGitHub ea89e8e1f6 port: kfp2 (#2326) 2023-10-04 23:13:08 +00:00
Andrew FerlitschandGitHub aa8e2c6af3 port: kfp2 (#2318)
* port: kfp2

* port: kfp2
2023-10-04 20:28:16 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2529586683 build(deps): bump pillow (#2322)
Bumps [pillow](https://github.com/python-pillow/Pillow) from 9.0.1 to 10.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.1...10.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>
2023-10-04 16:38:17 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
66601678e0 build(deps): bump pillow (#2321)
Bumps [pillow](https://github.com/python-pillow/Pillow) from 9.0.1 to 10.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.1...10.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>
2023-10-04 16:37:47 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
75da4cfb99 build(deps): bump pillow (#2320)
Bumps [pillow](https://github.com/python-pillow/Pillow) from 9.0.1 to 10.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.1...10.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>
2023-10-04 16:37:09 +00:00
Eric DongandGitHub 7d406848ea feat: feature store 2.0 tutorial (goku) (#2281)
* feat: feature store 2.0 tutorial (goku)

* Complying with the template

* Complying with the template 2

* clarify the notebook description

* clarify the notebook description 2

* address review comments and rename file

* add known issue and change install package

* wait for the sync job to complete, and fix resource conflicts

* address review comments

* address review comments 2

* add a delay for the endpoint to start properly
2023-10-04 01:20:44 +00:00
Eric DongandGitHub 2aea69a022 feat: feature store 2.0 tutorial for feature value fetching (#2283)
* feat: feature store 2.0 tutorial for feature value fetching

* remove 2.0 references and rename file name

* add known issue and change install package

* add sdk; add job check logic; fix cleanup

* address review comments
2023-10-03 20:54:03 +00:00
Andrew FerlitschandGitHub 4a56ab4138 port: kfp2 (#2313) 2023-10-03 14:31:40 +00:00
Andrew FerlitschandGitHub b7c7691c52 kfp: notice (#2312) 2023-10-03 01:50:37 +00:00
Andrew FerlitschandGitHub 57da2a745f kfp: notice (#2311) 2023-10-03 01:50:04 +00:00
Andrew FerlitschandGitHub d0ea048385 fix: notice (#2310) 2023-10-03 01:49:28 +00:00
Andrew FerlitschandGitHub 15537b2ed8 port: kfp2 (#2309) 2023-10-03 01:48:47 +00:00
Andrew FerlitschandGitHub a3239d8b71 port: kfp2 (#2308) 2023-10-03 01:48:10 +00:00
Andrew FerlitschandGitHub 6ecebd2973 port: kfp2 (#2304)
* port: kfp2

* fix: import

* fix: params

* fix: json/yaml
2023-10-02 21:37:01 +00:00
Andrew FerlitschandGitHub c4fe6fad23 deprecate (#2306) 2023-10-02 20:29:36 +00:00
Andrew FerlitschandGitHub a162051187 deprecate (#2305) 2023-10-02 20:18:58 +00:00
Ashley XuandGitHub 0d7d96e09c feat: add BigFrames llm code notebooks in generative_ai (#2290)
* feat: add BigFrames llm code notebooks

* fix: fix the linter and address comments
2023-10-02 17:26:07 +00:00
Huguens JeanandGitHub 5a1549d5cc Open source jax vision transformer to model garden. (#2295) 2023-10-02 16:11:16 +00:00
Kathy YuandGitHub aed9434c7f Add instructions for using L4-24G GPUs to serve LLaMA 2 70B models. (#2303) 2023-10-02 16:00:58 +00:00
Andrew FerlitschandGitHub 5ce45d1222 port: kfp2 (#2300)
* port: kfp2

* port: kfp2

* resolve import issue

* fix import

* fix: import

* fix importer_node
2023-10-02 15:50:18 +00:00
Andrew FerlitschandGitHub 58b8cba1e9 port: kfp2 (#2299)
* port: kfp2

* port: kfp2

* port: kfp2
2023-10-02 15:48:42 +00:00
Andrew FerlitschandGitHub da1e2b17f3 port: kfp2 (#2298)
* port: kfp2

* port: kfp2
2023-10-02 15:47:21 +00:00
Andrew FerlitschandGitHub f98a7aa4d6 port: kfp2 (#2297)
* port: kfp2

* port: kfp2
2023-10-02 15:30:29 +00:00
Andrew FerlitschandGitHub 84393171c2 port: KFP2 (#2296) 2023-09-30 14:53:34 +00:00
Ashley XuandGitHub d7f07167aa feat: add BigFrames gen-ai notebook for a use case about drug (#2291)
* feat: add BigFrames gen-ai notebook for a use case about drug

* fix: sort the imports

* fix: fix the linter checks
2023-09-29 19:05:12 +00:00
Andrew FerlitschandGitHub 2511bb1246 fix: CI/CD failure (#2292)
* fix: CI/CD failure

* fix: CI/CD failure
2023-09-29 16:56:11 +00:00
Andrew FerlitschandGitHub 4e3fbed9f7 missing setting IS_COLAB (#2288) 2023-09-29 15:54:51 +00:00
dstnluong-googleandGitHub 6726b90892 Add train/model_export files for TFVision. (#2279)
* Add TFVision

* Add TFVision to CODEOWNERS

* remove serving.Dockerifle

* build from vertex-ai
2023-09-29 15:51:30 +00:00
weigaryandGitHub f257b2f924 Add a notebook example for the NLLB model in model garden (#2289)
* Add a notebook example for the NLLB model in model garden

* Add a notebook example for the NLLB model in model garden
2023-09-28 22:00:06 +00:00
Andrew FerlitschandGitHub 2ace347737 fix: CI/CD failure (#2284)
* fix: CI/CD failure

* continue to debug

* continue to debug

* fix REGION
2023-09-28 18:28:18 +00:00
Huguens JeanandGitHub 572cbaf8b7 Open source detectron2 handler and trainer scripts and dockerfiles. (#2286) 2023-09-28 15:23:24 +00:00
eb93058f8e Add F-VLM Dockerfiles (#2285)
Co-authored-by: minwoopark <minwoopark@google.com>
2023-09-28 15:22:53 +00:00
Andrew FerlitschandGitHub 45e9a2db9e debug CI/CD internal failure (#2278)
* debug CI/CD internal failure

* fix: CI/CD failure
2023-09-27 20:58:27 +00:00
Andrew FerlitschandGitHub 530b4a6978 fix: cache issue (#2282)
* fix: cache issue

* fix: missing import

* fix: review comments
2023-09-27 20:56:46 +00:00
Andrew FerlitschandGitHub 3a9d88d642 fix: CI/CD failure (#2277) 2023-09-27 15:38:29 +00:00
Andrew FerlitschandGitHub fe5dc2bfbe Update pre-built to prebuilt (#2276) 2023-09-25 18:40:56 +00:00
Mend RenovateandGitHub d4c96f334d chore(deps): update dependency pyupgrade to v3.13.0 (#2066) 2023-09-25 18:30:06 +00:00
Mend RenovateandGitHub 487c04a216 Update python Docker tag to v3.11 (#1345) 2023-09-25 18:20:50 +00:00
Matthew TangandGitHub 45536c644c Make SDK 2.0 bigframes notebook wording consistent (#2274)
* Make SDK 2.0 bigframes notebook wording consistent

* Make learn more in a new line
2023-09-25 14:17:48 +00:00
Andrew FerlitschandGitHub 297d7b7e71 debug: verify works (#2275) 2023-09-25 14:16:15 +00:00
Andrew FerlitschandGitHub 4a9e61a007 feat: SDK2 remote predict (#2259)
* feat: SDK2 remote predict

* fix: 3.10

* fix: py check

* fix: py check

* fix: review comments

* fix: pytorch lightning not support register model
2023-09-22 19:50:52 +00:00
Andrew FerlitschandGitHub ef6c7457c3 fix: CI/CD failure (#2269) 2023-09-22 16:10:14 +00:00
weigaryandGitHub 578287d3ef Add a section to merge a base model with a lora (#2272) 2023-09-22 15:59:48 +00:00
Andrew FerlitschandGitHub 0fb27b69b6 feat: SDK2 remote training (#2258)
* feat: SDK2 remote training

* fix: 3.10

* fix: 3.10

* fix: py check

* fix: py check

* fix: review comments
2023-09-22 12:57:22 +00:00
Andrew FerlitschandGitHub f327bd4bec feat: SDK2 remote tuning (#2260)
* feat: SDK2 remote tuning

* fix: missing pandas

* fix: review comments
2023-09-22 12:54:20 +00:00
xqr-gandGitHub efc37b883e Modify a comment. (#2262) 2023-09-21 22:31:39 +00:00
Matthew TangandGitHub 5e8011040d Add SDK 2.0 Bigframes Tensorflow sample notebook (#2256)
* Add SDK 2.0 Bigframes Tensorflow sample notebook

* Add pip install tensorflow

* Pin version of tensorflow

* Fix comments

* Add link to bigframes documentation
2023-09-21 18:45:55 +00:00
weigaryandGitHub 7189513c27 Make vLLM the default serving option for open llama peft (#2261) 2023-09-21 15:34:08 +00:00
Ray IramaneeratandGitHub ed560893d9 fix: Add REGION to the pipeline init (plus BigQuery region validation step) to make "non-US" region to work (#2245)
* Update automl_tabular_classification_beans.ipynb, add REGION to pipeline init and validate BQ REGION

- Add REGION to pipeline init
- Add validation to BQ REGION against pipeline REGION

* Update automl_tabular_classification_beans.ipynb: Add region to the region validation message to print

* Update automl_tabular_classification_beans.ipynb

* Update automl_tabular_classification_beans.ipynb

* Update automl_tabular_classification_beans.ipynb

* Update automl_tabular_classification_beans.ipynb

Fix lint error: white space around =, order of import
2023-09-21 15:32:26 +00:00
Andrew FerlitschandGitHub 0df92f8127 feat: streaming prediction (#2255)
* feat: streaming prediction

* fix: cleanup

* fix: review comments

* fix: learn about
2023-09-21 13:48:38 +00:00
Andrew FerlitschandGitHub b43d97e2c6 feat: SDK2 tabnet (#2253)
* feat: SDK2 tabnet

* fix: hardcoded project id

* fix: hardcoded project id

* fix: import scikit-learn

* fix: install preview

* fix: installs

* fix: missing TF

* fix: review comments

* fix: todo
2023-09-20 19:39:40 +00:00
Matthew TangandGitHub 5b4f20a1ef Add SDK 2.0 Bigframes Pytorch sample notebook (#2247)
* Add SDK 2.0 Bigframes Pytorch sample notebook

* Fix lint

* Add torch pip install

* Add remote job name constant
2023-09-19 19:03:06 +00:00
dstnluong-googleandGitHub cac8816db7 Add LoRA examples to SD notebook. (#2221)
* Add LoRA examples to SD notebook.

* Add comment to explain taks flag

* fix

* set correct task

* Add LoRA to SD notebook
2023-09-19 16:15:09 +00:00
xqr-gandGitHub 6d00ad9e95 Add embedding new API colab to the official folder. (#2246)
* Add embedding new API colab to the official folder.

* Add more comments.

* Change the description from See from to Learn more
2023-09-19 16:11:33 +00:00
Andrew FerlitschandGitHub 65a5f952c4 fix: post Next (#2250)
* fix: post Next

* fix: lint
2023-09-18 20:53:01 +00:00
Andrew FerlitschandGitHub 6662639e30 update: post-Next (#2249) 2023-09-18 20:34:30 +00:00
Matthew TangandGitHub 461e1e6f8b Add SDK 2.0 Bigframes Sklearn sample notebook (#2238)
* Add SDK 2.0 Bigframes Sklearn sample notebook

* Fix lint

* Unpin python version since py310 is broken for CI

* Rerun lint

* Resolve comments

* Remove local overrides

* Update folder path
2023-09-18 19:02:56 +00:00
Andrew FerlitschandGitHub e27db74595 fix: new model value (#2207) 2023-09-18 16:24:08 +00:00
Eric DongandGitHub e4895da43b fix: investigate a weekly regression error - remove a hardcoded debug code cell (#2244) 2023-09-18 16:16:38 +00:00
David HaleyandGitHub a331687d86 Add missing 'import os' for notebooks in Colab (#2105)
* Add missing 'import os' for Colab

The module is imported, but the Colab instructions restart the kernel
losing the import. Make sure `os` is imported on use.

* Remove redundant import
2023-09-15 14:03:33 +00:00
Huguens JeanandGitHub 54cb49c269 Manually release oss vLLM source code and dockerfiles to model garden. (#2243) 2023-09-14 17:50:00 +00:00
a7a106db51 Add F-VLM training. (#2241)
Co-authored-by: minwoopark <minwoopark@google.com>
2023-09-14 03:22:01 +00:00
Kelsi LakeyandGitHub 0d080632d8 Update Image Classification components to use updated v0.2 container (reduced number of vulnerabilities) (#2242)
* Update preprocess component to use ready-to-go docker container v0.2

* Update load component to use ready-to-go docker container v0.2

* Update train component to use ready-to-go docker container v0.2

* Update transcode csv component to use ready-to-go docker container v0.2

* Update load component to use ready-to-go docker container v0.2
2023-09-14 03:20:39 +00:00
Sebastian SchmidtandGitHub 3b1249eb41 Remove duplicate configuration of project ID (#2240) 2023-09-13 22:44:18 +00:00
genquan9andGitHub 2e9d41266a Minor updatesfor LLaMA2 notebooks with clear instructions (#2239) 2023-09-13 05:24:05 +00:00
Huguens JeanandGitHub b8b6a17836 Manually release oss TIMM source code and dockerfiles to model garden. (#2236) 2023-09-13 05:22:42 +00:00
KCFindstrandGitHub d1b68b2d19 Add Vertex Online Prediction to #MediaPipe #ModelGarden image generation notebook. (#2227) 2023-09-13 05:19:54 +00:00
Sebastian SchmidtandGitHub 9c6ea2571c Add Face Stylizer notebook (#2230)
* Add Face Stylizer notebook

* Remove unused import
2023-09-12 17:59:41 +00:00
Kathy YuandGitHub 3a4c6f6c3a Add language model evaluation to Falcon Instruct + PEFT notebook. (#2231) 2023-09-11 16:21:55 +00:00
dstnluong-googleandGitHub e77aadf64e Fix comments (#2234) 2023-09-11 16:18:13 +00:00
Xiang XuandGitHub dc6949043f fix llama gcs bucket path (#2226) 2023-08-31 22:23:04 +00:00
genquan9andGitHub d9ac568f07 Add instructions to deploy Llama2 13B with multiple V100 (#2224)
* Add instructions to deploy Llama2 13B with multiple V100

* update the prediction reference link
2023-08-31 17:21:08 +00:00
xqr-gandGitHub c32505330c Remove the quiet tag (#2225)
* Demo colab for the embedding model

* Update text_embedding_api_cloud_next_new_models.ipynb

* Update the demo. Update the CODEOWNER.

* Update the links.

* Remove the quiet tag of the pip command
2023-08-30 22:08:23 +00:00
xqr-gandGitHub f5354ad8e8 Update the links to the embedding demo. (#2223)
* Demo colab for the embedding model

* Update text_embedding_api_cloud_next_new_models.ipynb

* Update the demo. Update the CODEOWNER.

* Update the links.
2023-08-30 04:56:13 +00:00
xqr-gandGitHub 0647c1c790 Demo colab for the embedding model (#2222)
* Demo colab for the embedding model

* Update text_embedding_api_cloud_next_new_models.ipynb

* Update the demo. Update the CODEOWNER.
2023-08-30 04:20:52 +00:00
bda6fb06d8 Fixes the build failure (#2195)
* feat: boilerplate reduction 59

* fix: bucket

* spark runtime

* dataproc runtine -> 1.1.20

* updates the build steps + clean up steps

* ran linter test

* adds gcloud components update step for test env + adds needed services in before you begin section

* ran linter test

* moves the gcloud components update to the start + updates experiment fetching

* ran linter test

* updates the aiplatform sdk to the latest

* ran linter test

* removes gcloud components update and adds try except at get_dataframe() method

* ran linter test

* initializes experiment + adds gcloud update + removes try catch

* ran linter test

---------

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2023-08-29 19:33:36 +00:00
KCFindstrandGitHub 66472e2642 Revise Model Garden MoViNet notebooks (#2220)
* Revise Model Garden MoViNet notebooks.

* Update GPU number in MoViNet notebook docs.
2023-08-29 19:31:33 +00:00
Xiang XuandGitHub 887ed4c9e2 update llama2 (#2219) 2023-08-29 19:30:36 +00:00
Kathy YuandGitHub c9bea5fa06 Add language model evaluation to OpenLLaMA + PEFT notebook. (#2218)
* Add language model evaluation to OpenLLaMA + PEFT notebook.

* Sync lint change to OpenLLaMA + PEFT notebook.
2023-08-29 19:30:03 +00:00
Alexey VolkovandGitHub c8941953a7 Pipeline components - cherry-pick fix: Google-cloud - Vertex_AI - Models - Upload_XGBoost_model - Fixed the file extension (#2217)
* Pipeline components - cherry-pick fix: Google-cloud - Vertex_AI - Models - Upload_XGBoost_model - Fixed the file extension

Cherry-pick of [fix: Google-cloud - Vertex_AI - Models - Upload_XGBoost_model - Fixed the file extension](https://github.com/Ark-kun/pipeline_components/commit/e16ceefd98743165eda70147f75bb4ac0f11d259)

* [Community] Train tabular models with many frameworks - Updated the XGBoost  samples
2023-08-29 12:18:10 +00:00
Xiang XuandGitHub ba91df54ac add llama2 rlhf (#2215) 2023-08-29 01:19:33 +00:00
Yvonne LiandGitHub 8f5f5a6b69 feat: add notebook for next (#2214)
* add notebook for next

* fix lint error

* move file
2023-08-29 01:18:47 +00:00
Xiang XuandGitHub ff1c126df5 fix codellama (#2212) 2023-08-28 21:41:59 +00:00
kathyyu-googleandGitHub d35b3d08c8 Add Dockerfile for language model evaluation harness. (#2209) 2023-08-28 15:37:25 +00:00
Xiang XuandGitHub 5dd9acd84b add codellama (#2210) 2023-08-28 15:36:59 +00:00
Huguens JeanandGitHub 7703378a58 Open source Bytetrack multi object tracking container to model garden. (#2206) 2023-08-25 16:44:29 +00:00
Andrew FerlitschandGitHub f74425e740 feat: RLHF bulk infer (#2203)
* feat: RLHF bulk infer

* fix: review comments

* fix: review comment

* fix: review comment

* update: text-bison@001

* fix: revert change

* fix: colab endpoint
2023-08-24 19:36:13 +00:00
Andrew FerlitschandGitHub ee651d1f22 feat: RLHF tuning (#2202)
* feat: RLHF tuning

* fix: review comments

* fix: review comments
2023-08-24 17:00:05 +00:00
Sebastian SchmidtandGitHub 5128b8c6f2 Sync MediaPipe notebooks with internal versions (#2204)
* Sync MediaPipe notebooks with internal versions

* Fix breakage due to lint

* Lint
2023-08-23 21:05:18 +00:00
Xiang XuandGitHub 80752fb7b8 fix vllm (#2201) 2023-08-23 20:53:42 +00:00
0a4421504e Add Stable Diffusion notebook (#2199)
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2023-08-23 16:16:45 +00:00
xcchen1andGitHub fe18c65c5b Add StarCoder notebook. (#2198) 2023-08-23 16:16:33 +00:00
Xiang XuandGitHub 27ad9ef273 add vLLM (#2200) 2023-08-23 16:11:33 +00:00
MarkandGitHub 5c6d4b89a0 Add notebook for Tabular Workflow for Forecasting (#2184) 2023-08-23 16:10:44 +00:00
dstnluong-googleandGitHub 20b69adc5c Add OSS checkpoint to YOLOv7 (#2169)
* support yolov7

* Add OSS checkpoint to YOLOv7
2023-08-22 22:36:41 +00:00
dstnluong-googleandGitHub d7e5cf0f85 Switch peft notebooks from vertex-ai-restricted to vertex-ai (#2167) 2023-08-22 22:35:40 +00:00
genquan9andGitHub d94e1b0edf Update instruction to enable NLP API for text moderation (#2194) 2023-08-21 15:50:42 +00:00
KCFindstrandGitHub fab75315ae Add MoViNet action recognition notebook (#2193) 2023-08-18 19:37:26 +00:00
weigaryandGitHub f3be7fac74 Open source Parameter-efficient Fine-tuning (PEFT) containers (#2192) 2023-08-17 23:57:49 +00:00
Krishna Chaithanya MovvaandGitHub df20a2fe50 Fixes the 400 model server issue (#2190)
* fixes the sklearn versions + section structure updates based on template

* ran linter test
2023-08-17 17:29:39 +00:00
Karl WeinmeisterandGitHub 1a9c7011f0 fix: update notebook template comment (#2191)
Add extra # character. This enables users to uncomment the whole cell, versus picking just the right lines to uncomment.
2023-08-17 17:27:27 +00:00
genquan9andGitHub 3eb27ebf71 Polish llama2 notebooks (#2189) 2023-08-17 17:26:29 +00:00
edb90d4255 Fixes the issues from PR#1871 (#2186)
* fix: boilerplate reduction 41

* fix: install

* fix: TFDV version

* fix: increase wait time

* increase wait time

* replace INPUT_GS_PATH with TRAINING_DATASET while copying data in GCS + removes future tense + clean up step for batch job + moves the learn more section above clean up section

* ran linter test

---------

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2023-08-16 16:42:43 +00:00
dstnluong-googleandGitHub c7332c647b Add Keras YOLOv8 notebook. (#2159)
* Add Keras YOLOv8 notebook.

* List out possible backbones.

* Make expand_dims consistent

* Add function comments and sample dataset

* Fix comment.
2023-08-16 16:36:38 +00:00
genquan9andGitHub 60e0aafbbc update llama2 notebooks with precision mode and override parameters (#2183) 2023-08-15 16:01:01 +00:00
bingatgoogleandGitHub a89991e159 Mg stable diffusion xl (#2179)
* Add the stable diffusion xl notebook

* Fix CODEOWNERS error.

* Minor changes to stable diffusion xl notebook.

* Add workbench link in stable diffusion xl notebook.
2023-08-15 16:00:29 +00:00
weigaryandGitHub 437c23bbdf Add batch prediction examples to the ICN/IOD proprietary models in Mo… (#2171)
* Add batch prediction examples to the ICN/IOD proprietary models in Model Garden

* Update teh IOD documentation to allow users to use up to 8 GPUs in training.

* Resolved comments
2023-08-15 15:59:48 +00:00
dstnluong-googleandGitHub 8730fd6fec Add local inference for Falcon Instruct. (#2174)
* Add local inference for Falcon Instruct

* Lint

* Add memory necessary for falcon 7b

* nit: Typo
2023-08-14 18:34:18 +00:00
dstnluong-googleandGitHub d7caba028c Add local inference instructions to OpenLLaMA (#2172)
* Add local inferences to openllama

* Lint

* model.to is unnecessary

* Remove commented line
2023-08-14 18:33:41 +00:00
9ce9cec0a8 Reduction 88 (#2178)
* fix: boilerplate reduction 88

* fix: install

* fix: reduce dataset size

* fix: > 24hrs

* fix: reduce dataset for testing

* fix: reduce dataset for testing

* updates sklearn and fixes the version, elaborates some existing descriptions and adds updates based on the template

* ran linter test

* changes FILE_NAME to LOCAL_FILE_NAME and adds a clean up step for the local saved model

* ran linter test

---------

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2023-08-14 17:39:11 +00:00
42bc870ee3 Fixes timestamp issue + Elaborates some text descriptions (#2177)
* fix: boilerplate reduction 33

* fix: project ID

* fix: df type

* fix: uuid

* fix: uuid

* fix: uuid

* fix: uuid

* fix: timestamp

* fixes the timestamp issue + cleans up the descriptions

* ran linter test

---------

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2023-08-14 16:04:28 +00:00
dstnluong-googleandGitHub 85f4e2b294 Fix YOLOv7 config link (#2175) 2023-08-14 16:00:25 +00:00
genquan9andGitHub 734836b928 Add a notebook for llama2 serving and finetuning with peft, and analyze with vertex text moderation API (#2170)
* Add a notebook for llama2 serving and finetuning with peft, and analyze with vertex text moderation API

* Fix comments
2023-08-14 15:57:31 +00:00
Ivan CheungGitHubivanmkc@google.com <ivanmkc@google.com>
0b13475152 fix: Removed memorystore (#2173)
Co-authored-by: ivanmkc@google.com <ivanmkc@google.com>
2023-08-12 18:50:51 +00:00
Ivan CheungGitHubivanmkc@google.com <ivanmkc@google.com>
4320bf500c Added multimodal embeddings (#2164)
* fix: Added multimodal embeddings notebook

* Fixed remaining issues

* Reverted notebooks/official/matching_engine/sdk_matching_engine_create_text_to_image_embeddings.ipynb

* Reduced QPS to 2

* Ran linter

* Added None check

* Fixed header links

* Fixed header text

* GH review fixes

* Removed outputs

* Changed title

* debug

* More fixes

---------

Co-authored-by: ivanmkc@google.com <ivanmkc@google.com>
2023-08-11 01:30:05 +00:00
07ec84687e Reduces the max_steps parameter + Textual content updates and fixes (#2168)
* fix: issue 2125

* removes duplicate parameters, reduces max_steps to 100, fixes grammar and updates realted to the writing guidelines

* removes f from the string parameter

* ran linter test

* sets max_steps to 20 and adds lines in the cleanup step to remove the pipeline jobs

* ran linter test

---------

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2023-08-10 20:49:01 +00:00
Lav RaiandGitHub 06926f8318 Add F-VLM notebook. (#2166) 2023-08-10 20:48:12 +00:00
Krishna Chaithanya MovvaandGitHub 067fab6aba Adds preprocessing steps from the original dataset (#2165)
* adds the preprocessing steps on the original dataset + updates for boiler plate reduction

* ran linter test

* adds project-id and ticks in the sql queries

* ran linter test
2023-08-09 16:25:14 +00:00
Yvonne LiandGitHub b239467901 feat: add generative ai notebooks (#2127)
* add generative ai notebooks

* fix lint

* comment out auth

* comply with official notebook templates

* fix lint + comments

* fix clear output

* fix lint error

* resolve Andy's comments

* remove TODOs

* fix lint

* add code comments

* change we to you
2023-08-08 18:41:22 +00:00
Andrew FerlitschandGitHub 9cb60dc7f8 fix: bad filename (#2162)
* fix: bad filename

* fix: lint
2023-08-08 18:35:19 +00:00
Andrew FerlitschandGitHub 8ad0e435e8 fix: broken links (#2161) 2023-08-08 18:35:07 +00:00
Andrew FerlitschandGitHub e229ba997b fix broken links (#2160) 2023-08-08 18:34:55 +00:00
KCFindstrandGitHub 8f1c79684f Switch movinet and data converter dockers to vertex-ai project (#2158) 2023-08-08 17:45:39 +00:00
LynneandGitHub 1ecb182603 Add OpenCLIP notebook (#2154)
* Add OpenCLIP notebook

* Resolve PR comments.
2023-08-08 04:24:09 +00:00
68452d30ce Typo fixes + Template related updates + Grammar + Dataflow service dependancy (#2155)
* upgrade: boilerplate reduction 38

* fixes the pipeline-root-path typo, adds dataflow api dependency in the before-you-begin section, restructures the sections according to the template, fixes grammar and headings

* ran linter test

---------

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2023-08-08 04:23:28 +00:00
Andrew FerlitschandGitHub 2c12bcb257 fix: replace internal links (#2157) 2023-08-07 22:09:58 +00:00
Andrew FerlitschandGitHub 688f748c1e fix: official standard (#2156) 2023-08-07 22:09:53 +00:00
Andrew FerlitschandGitHub 57061d7a7b fix: official standard (#2151) 2023-08-07 22:09:44 +00:00
c26c240570 Add train/serve files for OpenCLIP (#2153)
* Add train/serve files for OpenCLIP

* Fix build path in comment

---------

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2023-08-07 17:33:23 +00:00
KCFindstrandGitHub ce1f9080ee Add data converter and movinet code to model garden (#2152)
* Add model garden data converter and movinet code.

* Add movinet and data converter CODEOWNERS.
2023-08-07 17:21:11 +00:00
5909a3dbb1 Update documentation about only 2 GPUs are supported now. (#2150)
Co-authored-by: minwoopark <minwoopark@google.com>
2023-08-04 19:52:12 +00:00
5ec6512c3e feat: boiler plate reduction 54 - bigquery-public-data:ml_datasets.census_adult_income: not exist (#1912)
* feat: boiler plate reduction 54

* fix: bucket

* fix: import os

* ran linter test (#2138)

---------

Co-authored-by: Krishna Chaithanya Movva <krishna.movva@springml.com>
2023-08-04 17:05:17 +00:00
Andrew FerlitschandGitHub c9ff35db22 fix: issue 1898 (#2148) 2023-08-04 01:31:20 +00:00
Andrew FerlitschandGitHub 2dd8729326 fix: deprecated service (#2146) 2023-08-04 01:27:20 +00:00
Andrew FerlitschandGitHub b9e07d9400 fix: issue 2121 (#2145) 2023-08-04 01:25:59 +00:00
9d3c84dbd5 Change default accelerator count. (#2147)
Co-authored-by: minwoopark <minwoopark@google.com>
2023-08-03 21:15:18 +00:00
Andrew FerlitschandGitHub d2b07abdea Mg 1 (#2141)
* update: official requirements

* update: official requirements
2023-08-03 16:46:39 +00:00
dstnluong-googleandGitHub fff45ff60a Revert URI back to vertex-ai-restricted (#2142) 2023-08-03 16:46:09 +00:00
Karl WeinmeisterandGitHub f115e52637 Update copyright year to 2023 in notebook template (#2143) 2023-08-03 16:45:38 +00:00
dstnluong-googleandGitHub 3c7c3f8b3a revert change to docker URI (#2140) 2023-08-02 22:08:12 +00:00
188525acc9 Update deploy machine info. (#2139)
Co-authored-by: minwoopark <minwoopark@google.com>
2023-08-02 22:07:35 +00:00
90da7214c7 Add Pic2Word serving dockerfile and handler (#2134)
* Added Pic2Word notebook to Vertex AI Model Garden.

* Added jismailyan to pic2word notebook codeowners

* Pic2Word update.

* Formatted notebook using lint script.

* Add Pic2Word serving dockerfile and handler.

* Add jismailyan to CODEOWNERS for model OSS pic2word

* Fix filename typo

---------

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2023-08-01 19:07:27 +00:00
ac4bf93914 Adding video object tracking with Vertex AI IOD endpoint and Bytetrac… (#2098)
* Adding video object tracking with Vertex AI IOD endpoint and Bytetrack to model garden.

* Run vot container locally.

* fix: typo in license

---------

Co-authored-by: Andrew Ferlitsch <aferlitsch@gmail.com>
2023-08-01 19:04:08 +00:00
Andrew FerlitschandGitHub 80eefe2043 debug: check if passes 20 - 'float' has no len() (#2044)
* debug: check if passes 20

* fix: len float issue
2023-08-01 01:22:10 +00:00
Andrew FerlitschandGitHub d573c9e7f5 fix: scikit-learn version (#2135) 2023-08-01 01:21:22 +00:00
Andrew FerlitschandGitHub 62f49b91ec fix: install db-dtypes (#2112)
* fix: install db-dtypes

* fix: TF import issue

* fix: TF related import

* debug: import issue

* debug: TF issue

* debug: try again

* fix: install issue

* fix: install within job

* fix: install within job
2023-07-31 20:11:35 +00:00
KCFindstrandGitHub 0901306cf5 Fix #ModelGarden MoViNet notebook links (#2133) 2023-07-31 19:16:24 +00:00
Sebastian SchmidtandGitHub 2dd47e8c70 Add GestureRecognizer and TextClasssifier notebooks (#2129)
* Add GestureRecognizer and TextClasssifier notebooks

* Updates
2023-07-31 17:44:44 +00:00
Andrew FerlitschandGitHub 3e89a23166 fix: CI/CD failure (#2123)
* fix: CI/CD failure

* fix: delete dataset
2023-07-28 23:17:40 +00:00
Andrew FerlitschandGitHub d48692bd4b fix: torch install (#2130)
* fix: torch install

* try again
2023-07-28 23:16:49 +00:00
9fa9fb078e add a separate notebook for falcon instruct peft to be more easy to understand (#2126)
Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2023-07-28 15:39:10 +00:00
Daniel Elias BecerraandGitHub e170a5cb5a Add workaround to import BigQuery table for predictions_bigquery_sour… (#2110)
* Add workaround to import BigQuery table for predictions_bigquery_source parameter

* Fix format after running lint

* Comment out optional code block for reference

* Comment out optional code block for reference

* Change env variables
2023-07-28 15:36:40 +00:00
KCFindstrandGitHub a6794907e4 Add #ModelGarden MoViNet Video Clip Classification Notebook (#2119)
* Add #ModelGarden MoViNet video classification notebook.

* Add CODEOWNERS for MoViNet clip classification community notebook.

* Revise #ModelGarden MoViNet VCN notebook
2023-07-27 17:22:10 +00:00
Andrew FerlitschandGitHub fed657b8fb fix: pip install (#2124) 2023-07-26 21:11:03 +00:00
Andrew FerlitschandGitHub c2ca773c27 debug: check if passes 26 (#2050)
* debug: check if passes 26

* fix: setting project ID
2023-07-25 20:41:00 +00:00
Andrew FerlitschandGitHub 228cad82c2 fix: AR not found (#2116) 2023-07-25 00:46:33 +00:00
Andrew FerlitschandGitHub d83ef25cc6 fix: pin gcpc (#2114) 2023-07-25 00:42:59 +00:00
a6439ecb5e Added Pic2Word notebook to Model Garden github (#2026)
* Added Pic2Word notebook to Vertex AI Model Garden.

* Added jismailyan to pic2word notebook codeowners

* Pic2Word update.

* Formatted notebook using lint script.

---------

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2023-07-24 21:09:23 +00:00
Andrew FerlitschandGitHub 2cbebe604c fix: numpy type (#2117) 2023-07-24 20:40:07 +00:00
Andrew FerlitschandGitHub 432ce2aeb1 fix: AR issue (#2115) 2023-07-24 20:39:32 +00:00
Andrew FerlitschandGitHub 654907ad4d fix: missing install (#2113) 2023-07-24 20:15:40 +00:00
Andrew FerlitschandGitHub 8d0ad548b2 fix: positional params (#2111) 2023-07-24 19:47:55 +00:00
dstnluong-googleandGitHub 0bb5343dca Replace vertex-ai-restricted with vertex-ai for diffusers, keras, and transformers; also remove extraneous <td> (#2099)
* Add train/serve files for keras

* Fix comment and typo.

* Fix dockerfile commands

* Fix dockerfile comment.

* replace vertex-ai-restricted iwth vertex-ai for diffusers, keras, and transformers; also remove extraneous <td>
2023-07-24 18:55:45 +00:00
Andrew FerlitschandGitHub 97a18feba0 fix: branding (#2109) 2023-07-22 13:31:45 +00:00
7200238f4f Update deploy machine information. (#2107)
Co-authored-by: minwoopark <minwoopark@google.com>
2023-07-21 15:34:09 +00:00
genquan9andGitHub d9058c2e4e add a sperate notebook for openllama peft to be more specific (#2106) 2023-07-21 15:33:08 +00:00
dstnluong-googleandGitHub 1b6e663af0 Move frames_to_video_bytes to handler.py (#2104) 2023-07-20 15:30:28 +00:00
Andrew FerlitschandGitHub 5887f400c8 feat: KFP2 pipeline example (#2096)
* feat: KFP2 pipeline example

* Update kfp2_pipeline.ipynb

remove hardwired project ID

* fix: review
2023-07-19 21:12:45 +00:00
dstnluong-googleandGitHub 5e509423a6 support yolov7 (#2037) 2023-07-19 16:55:41 +00:00
dstnluong-googleandGitHub bb61d92f80 Add train/serve files for keras (#2077)
* Add train/serve files for keras

* Fix comment and typo.

* Fix dockerfile commands

* Fix dockerfile comment.
2023-07-18 15:42:07 +00:00
genquan9andGitHub 34431b6511 Fix typos in peft notebooks (#2100)
* fix typos in keras model deployment

* fix types in peft notebook
2023-07-18 15:31:30 +00:00
dstnluong-googleandGitHub ec3ec5a2c1 import urllib in timm notebook (#2101)
* import urllib

* lint
2023-07-18 15:30:59 +00:00
d9f5a40088 fix: boilerplate reduction 76 - training failed - bug filed (#1947)
* fix: boilerplate reduction 77

* fix: lint

* fix: syntax error

* fix: GCS bucket

* Fix GCS bucket

* fix: bucket

* fix: bucket

* fix: correct the model GSC output path (#2102)

---------

Co-authored-by: Eric Dong <itseric@google.com>
2023-07-18 14:18:21 +00:00
713a54815b debug: check if passes 30 - Training failed (#2054)
* debug: check if passes 30

* fix: service account

* fix: pin protobuff version for dependency compatibility (#2097)

---------

Co-authored-by: Eric Dong <itseric@google.com>
2023-07-17 16:10:22 +00:00
Andrew FerlitschandGitHub 06c87bc24d debug: regression failure (#2093)
* debug: internal error

* debug: install dbdtypes

* debug: create repo
2023-07-17 15:57:06 +00:00
Andrew FerlitschandGitHub 75c37416d8 debug: internal error (#2092) 2023-07-17 15:46:49 +00:00
dstnluong-googleandGitHub ad99d0d0c0 Fix local inference when loading weights from GCS (#2090)
* Fix local inference when loading weights from GCS

* remove extra <td>
2023-07-14 22:37:31 +00:00
dstnluong-googleandGitHub c7b3e67989 Remove COCA from available models (#2091) 2023-07-14 22:36:54 +00:00
dstnluong-googleandGitHub 2f7078e6a8 Cleanup IOD proprietary notebook. (#2035)
* Cleanup proprietary IOD notebook

* lint

* fix: aip to aiplatform
2023-07-14 18:18:45 +00:00
dstnluong-googleandGitHub 393bb67645 Cleanup ICN proprietary notebook. (#2034)
* Clean up ICN proprietary notebook

* Lint

* add back region check
2023-07-14 18:18:06 +00:00
genquan9andGitHub b945549ec4 minor updates for peft notebooks with BERT supports (#2089)
* fix typos in keras model deployment

* minor updates for peft notebooks with BERT supports
2023-07-14 18:05:45 +00:00
Xiang XuandGitHub d963893088 remove t5 (#2088) 2023-07-14 18:05:03 +00:00
dstnluong-googleandGitHub 7ffbf0cde7 Add pylintrc to model_oss (#2085) 2023-07-14 18:04:21 +00:00
Sebastian SchmidtandGitHub fb978444f7 Update wording in MediaPipe notebooks (#2084) 2023-07-14 18:03:40 +00:00
dstnluong-googleandGitHub de35525c70 Install entire diffusers repository rather than diffusers package (#2081)
* Install entire diffusers repository rather than diffusers package

* Remove google3 references

* Update diffuser install for serve.Dockerfile

* Add video_utils

* Move common functions to util and video_util.

* Fix dockerfile commands by adding $
2023-07-14 18:02:53 +00:00
Andrew FerlitschandGitHub feb0e6410d feat: add arg for max concurrent notebooks (#2080) 2023-07-14 18:02:01 +00:00
Andrew FerlitschandGitHub 6b1c0b35e8 fix help msg (#2079)
* feat: make rate limit a cmdarg

* review: rename cmd arg

* fix: replace rate_limit with max_threads

* fix: docstring typo
2023-07-14 18:01:36 +00:00
dstnluong-googleandGitHub 04540495f0 Add transformers serve files. (#2075)
* Add transformers serve files.

* Add transformer files to CODEOWNERS

* Add image_format_converter.py to utils

* Add $ to dockerfile example commands.
2023-07-14 18:01:04 +00:00
bingatgoogleandGitHub ad6e554984 Add the stable diffusion 2.1 notebook (#2087) 2023-07-12 20:09:48 +00:00
Andrew FerlitschandGitHub ee52b0487c feat: make rate limit a cmdarg (#2078)
* feat: make rate limit a cmdarg

* review: rename cmd arg

* fix: replace rate_limit with max_threads
2023-07-07 15:58:48 +00:00
Andrew FerlitschandGitHub 89b494b96d Attempt to fix CI/CD issue (#2074)
* Attempt to fix CI/CD issue

* Fix TF import
2023-07-06 21:50:39 +00:00
genquan9andGitHub 5cc8751c20 fix typos in keras model deployment (#2070) 2023-07-06 15:53:11 +00:00
genquan9andGitHub 0a22ad7578 Add model garden peft notebooks for LLMs (#2063)
* add model garden peft notebooks for LLMs

* fix comments and minor update peft notebook descriptions
2023-07-05 15:27:31 +00:00
dstnluong-googleandGitHub 792313cce5 Remove bad parameters for local stable diffusion. (#2062) 2023-06-30 19:52:18 +00:00
Andrew FerlitschandGitHub 27e87047bb fix: lint (#2065) 2023-06-30 17:53:05 +00:00
Xiang XuandGitHub 145b2cab33 add restart (#2064) 2023-06-30 16:22:06 +00:00
Andrew FerlitschandGitHub ca65becfe3 debug: lint (#2061) 2023-06-29 01:36:53 +00:00
Andrew FerlitschandGitHub eeb5a9f6e4 fix: lint (#2059) 2023-06-29 01:35:45 +00:00
Andrew FerlitschandGitHub c5f11d35d5 debug: lint (#2060) 2023-06-29 01:34:23 +00:00
Andrew FerlitschandGitHub 91beb065ff next try at resolving lint issue (#2057) 2023-06-28 19:19:49 +00:00
Huguens JeanandGitHub c22fe20973 add missing pycocotools import (#2058) 2023-06-28 16:27:42 +00:00
Andrew FerlitschandGitHub e97e5ed7cc debug: check if passes 29 (#2053) 2023-06-28 12:55:48 +00:00
Andrew FerlitschandGitHub be98093169 fix: check if passes 24 (#2048)
* fix: check if passes 24

* fix: lint
2023-06-28 12:54:58 +00:00
Andrew FerlitschandGitHub ea8bc3f993 debug: check if passes 23 (#2047) 2023-06-28 12:54:19 +00:00
Andrew FerlitschandGitHub bcacc0d0d4 set pyupgrade to use Python 3.10 for consistency with Docker version (#2055) 2023-06-27 22:01:09 +00:00
Andrew FerlitschandGitHub 656afd3cff debug: check if passes 28 (#2052) 2023-06-27 20:11:13 +00:00
Andrew FerlitschandGitHub e6ae1b185c debug: check if passes 27 (#2051) 2023-06-27 20:10:47 +00:00
Andrew FerlitschandGitHub b0fdf128c3 debug: check if passes 25 (#2049) 2023-06-27 19:40:44 +00:00
Huguens JeanandGitHub 99c4f80558 SAM notebook final qa. (#2039) 2023-06-27 17:43:05 +00:00
Andrew FerlitschandGitHub 71436766d2 debug: check if passes 22 (#2046) 2023-06-27 17:39:30 +00:00
Andrew FerlitschandGitHub 2ad5331658 debug: check if passes 19 (#2043) 2023-06-27 17:13:24 +00:00
Andrew FerlitschandGitHub 83d231ada8 debug: check if passes 18 (#2042) 2023-06-27 17:12:48 +00:00
Andrew FerlitschandGitHub 6479533e29 Check if passes 17 (#2041)
* fix: boulerplate reduction

* fix: IS_COLAB

* fix: IS_COLAB

* debug: check if passes 17
2023-06-27 17:12:22 +00:00
Andrew FerlitschandGitHub 6e7ec746d1 update: lower rate limit (#2036)
per Ivan suggested, change greedy=True to greedy=False
2023-06-27 16:46:05 +00:00
Mend RenovateandGitHub efd08571df chore(deps): update dependency pyupgrade to v3.7.0 (#1986) 2023-06-27 15:38:19 +00:00
Andrew FerlitschandGitHub 44c868c4b4 fix: boilerplate reduction (#2032)
* fix: boulerplate reduction

* fix: IS_COLAB

* fix: IS_COLAB
2023-06-27 15:34:50 +00:00
Alicia WilliamsandGitHub 59f7fa0fd9 Remove allowlist note (#2033) 2023-06-26 23:39:45 +00:00
Andrew FerlitschandGitHub 2c3f2736eb fix: check if passes 16 (#2031) 2023-06-26 19:40:25 +00:00
Andrew FerlitschandGitHub ed54360fc7 fix: check if passes 15 (#2030) 2023-06-26 19:39:48 +00:00
Sebastian SchmidtandGitHub 66506d4269 Add MediaPipe Object Detection Colab to Model Garden (#2025) 2023-06-26 16:20:19 +00:00
099876c411 Remove VIT from the model_type list since it is not supported yet. (#2009)
* Add diffusers train/serve docker files.

* Add two notebook examples for model garden google proprietary ICN/IOD models.

* Reformat the icn/iod notebooks.

* Format the notebook files.

* Remove VIT from the  list since it is not supported yet.

---------

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2023-06-26 16:14:33 +00:00
Huguens JeanandGitHub bfd36eecbb Cleanup SAM segmentation notebook (#2027)
* Cleanup SAM notebook to:
 - run endpoint/model deployment in separate cell and results visualization in another.
 - add show_predictions function to show overlayed masks.

* Fix typo in SAM model garden notebook.

* Fix typo and cleanup SAM notebook with linter.
2023-06-26 16:13:47 +00:00
Andrew FerlitschandGitHub b82ade00bb fix: stale dataset > 24hrs (#1928)
* fix: stale dataset

* fix: project ID
2023-06-26 12:14:22 +00:00
Andrew FerlitschandGitHub 68f3500196 fix: boilerplate reduction 112 (#2023)
* fix: boilerplate reduction 112

* fix: machine type

* fix: cleanup

* fix: cleanup

* fix: lint

* fix: lint

* fix: exception
2023-06-26 12:13:04 +00:00
Andrew FerlitschandGitHub 74b5b8ce59 fix: boilerplate reduction 18 - > 24hrs (#1844)
* fix: boilerplate reduction 18

* fix: boilerplate reduction 18

* missing import

* fix: create AR repo

* fix: gcloud update
2023-06-23 23:38:38 +00:00
Andrew FerlitschandGitHub 6627f58dac fix: boilerplate reduction 19 - >24hrs (#1845)
* fix: boilerplate reduction 19

* fix: create AR repo

* fix: fb install

* fix: install gcloud

* fix: syntax error
2023-06-23 22:01:39 +00:00
Andrew FerlitschandGitHub 31fdffd56a fix: boilerplate reduction 49 - import protobuf (#1884)
* fix: boilerplate reduction 49

* fix: syntax error

* fix: install

* fix indent

* Update model_monitoring.ipynb

* fix TF install

* TF install

* fix: pin protobuf

* install protobuf

* another attempt at fixing import

* fix: pin versions

* fix: imports

* debug: TF conflict

* fix: user email
2023-06-23 22:01:06 +00:00
Andrew FerlitschandGitHub 15bec0d5ba fix: boilerplate reduction 71 - model path (#1943)
* fix: boilerplate reduction 71

* bucket name

* bucket name

* fix: bucket

* fix: bucket

* fix: storage path

* fix: model path
2023-06-23 22:00:43 +00:00
Andrew FerlitschandGitHub f0a2b16f75 fix: boiletplate reduction 105 (#2016)
* fix: boiletplate reduction 105

* fix: missing REGION

* fix: missing import

* Fix: cleanup
2023-06-23 22:00:28 +00:00
Andrew FerlitschandGitHub 3c6a5b3245 fix: boilerplate reduction 106 (#2017)
* fix: boilerplate reduction 105

* fix: bucket name

* fix: cleanup
2023-06-23 22:00:25 +00:00
Sebastian SchmidtandGitHub 21ba3b0f71 Small content updates for ImageClassification notebook (#2024) 2023-06-23 19:07:33 +00:00
Andrew FerlitschandGitHub d15a635917 fix: boilerplate reduction 111 (#2022)
* fix: boilerplate reduction 111

* fix: TIMESTAMP
2023-06-23 18:36:48 +00:00
dstnluong-googleandGitHub ce18d2a32a Add MaxViT to the TFVision ICN Notebook. (#1974)
* Add MaxViT to TFVision ICN Notebook

* Lint
2023-06-23 17:55:51 +00:00
Andrew FerlitschandGitHub 12cbd5a082 fix: boilerplate 103 (#2010)
* fix: boilerplate 103

* fix: REGION
2023-06-23 17:08:05 +00:00
Andrew FerlitschandGitHub 86fbbdbe01 fix: boilerplate reduction 109 (#2020)
* fix: boilerplate reduction 109

* fix: remove unused code

* fix: train image
2023-06-23 12:34:09 +00:00
Andrew FerlitschandGitHub 191424175e fix: boilerplate reduction 110 (#2021) 2023-06-23 12:32:53 +00:00
Andrew FerlitschandGitHub c544933d44 fix: boilerplate reduction 108 (#2019)
* fix: boilerplate reduction 108

* fix: missing import

* fix: missing import
2023-06-23 12:32:06 +00:00
Andrew FerlitschandGitHub fff8aad453 fix: boilerplate reduction 107 (#2018) 2023-06-23 12:30:58 +00:00
Andrew FerlitschandGitHub 3c3c924917 fix: boilerplate reduction 104 (#2015) 2023-06-23 12:30:01 +00:00
Andrew FerlitschandGitHub a874825e61 fix: check if passes 11 (#2013) 2023-06-23 12:28:58 +00:00
Andrew FerlitschandGitHub 10ca70f9b3 fix: boilerplate reduction 100 (#2005) 2023-06-23 12:27:24 +00:00
Andrew FerlitschandGitHub b640558e09 fix: check if passes 7 (#2004) 2023-06-23 12:26:20 +00:00
Andrew FerlitschandGitHub b5169f96b7 Check passes 10 (#2012)
* fix: check if passes 9

* fix: check if passes 10
2023-06-22 21:19:44 +00:00
Andrew FerlitschandGitHub b7a3c3faed fix: check if passes 9 (#2011) 2023-06-22 19:35:47 +00:00
weigaryandGitHub 9ae5ce3276 Updates to the vision diffusers. (#2008)
* Add diffusers train/serve docker files.

* Updates to the vision diffusers.
2023-06-22 18:11:06 +00:00
Andrew FerlitschandGitHub bce7d73867 fix: check if passes 8 (#2006) 2023-06-22 17:57:16 +00:00
Sebastian SchmidtandGitHub 708861b55c Add MediaPipe Image Classification notebook (#1991)
* Add MediaPipe Image Classification notebook

* Add to Codeowners

* Move to MG Community

* Update notebook

* Remove mediapipe-model-maker
2023-06-22 15:55:10 +00:00
Andrew FerlitschandGitHub 93f36606a2 fix: check if passes #5 (#2001) 2023-06-22 14:48:06 +00:00
Andrew FerlitschandGitHub 373795f9f8 fix: check if passes #4 (#2000) 2023-06-22 14:47:22 +00:00
Andrew FerlitschandGitHub d9bb986997 fix: boilerplate reduction 99 (#2003) 2023-06-22 12:41:40 +00:00
Andrew FerlitschandGitHub 048336b6d2 900 sec timeout - Model.upload (#1984)
* check if passes

* lint: fix

* fix: fix XAI issue
2023-06-22 02:21:46 +00:00
Andrew FerlitschandGitHub 9340737a8e feat: boilerplate reduction 60 - DAG failed (#1918)
* feat: boilerplate reduction 60

* fix: CI/CD failure
2023-06-22 02:20:34 +00:00
dstnluong-googleandGitHub e801ede0c8 Remove "--allow_compression" flag on serving for Yolo models. (#1994)
* Remove --allow_compression for Yolo models.

* Lint
2023-06-21 22:23:02 +00:00
Lav RaiandGitHub 7fce82b608 Add ViT JAX notebook. (#1997)
* Add ViT JAX notebook.

* Add ViT JAX notebook.
2023-06-21 19:06:46 +00:00
Andrew FerlitschandGitHub 20440b6418 fix: boilerplate reduction 72 - DAG failed (#1944)
* fix: boilerplate reduction 72

* fix: region

* data region

* fix: import os

* fix: lint

* fix: lint

* fix: lint
2023-06-21 18:37:11 +00:00
Andrew FerlitschandGitHub ef69968160 fix: boilerplate reduction 82 : custom job not created (#1953)
* fix: boilerplate reduction 82

* fix: IS_COLAB

* fix: AR repo

* fix: indent

* fix: import os

* fix: enable api

* fix: delete AR

* fix: longer pause

* fix: pause
2023-06-21 17:52:46 +00:00
Andrew FerlitschandGitHub 9bbe7c6643 fix: boilerplate reduction 84: NumPy array to a Tensor (#1955)
* fix: boilerplate reduction 84

* install numpy

* fix: numpy type

* add import numpy

* fix: np type

* fix: syntax error
2023-06-21 16:48:24 +00:00
weigaryandGitHub 84875c4814 Notebook (#1996)
* Add diffusers train/serve docker files.

* Add two notebook examples for model garden google proprietary ICN/IOD models.

* Reformat the icn/iod notebooks.

* Format the notebook files.
2023-06-21 16:23:05 +00:00
Anthony TripaldiandGitHub 28fb284400 Update broken link for data format (#1992) 2023-06-21 15:37:41 +00:00
Andrew FerlitschandGitHub 441e4e7965 fix: check if passes - training failed - no model (#1988)
* fix: check if passes

* fix: import tf
2023-06-21 12:27:04 +00:00
weigaryandGitHub 52d1fe548e Add diffusers train/serve docker files. (#1995) 2023-06-21 00:17:03 +00:00
71921231dc Fixed typo and linkback - 900 sec timeout (#1551)
* Update automl_text_classification_model_evaluation.ipynb

* pin components

---------

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2023-06-21 00:10:35 +00:00
Andrew FerlitschandGitHub 0553f768eb boilerplate reduction #97 (#1990)
* boilerplate reduction #100

* fix: import os

* fix: AR stuff

* fix: syntax error
2023-06-20 23:52:33 +00:00
Andrew FerlitschandGitHub 9a0037bb64 fix: cleanup AR > 24hrs (#1929)
* fix: repo cleanup

* fix: delete AR

* fix: unique repo name

* fix: enable service

* fix: artifact repo create

* fix: create AR repo

* fix: AR create

* fix: IS_COLAB

* fix: gcloud install components

* --quiet option
2023-06-20 21:57:19 +00:00
Andrew FerlitschandGitHub 68aad86385 Check passes 4 (#1989)
* check if passes

* fix: bucket name
2023-06-20 19:14:06 +00:00
Andrew FerlitschandGitHub 520a0b0ae8 fix: boilerplate reduction 85 - BUCKET_NAME (#1956)
* fix: boilerplate reduction 85

* db-dtypes

* fix: pin seaborn

* handle exception

* fix: bucket name
2023-06-20 16:04:00 +00:00
Andrew FerlitschandGitHub 8e817a4ece check if passes (#1985) 2023-06-19 16:05:51 +00:00
Andrew FerlitschandGitHub 7391eed85c Update sdk_custom_tabular_regression_online_explain.ipynb (#1983) 2023-06-19 14:03:23 +00:00
Andrew FerlitschandGitHub 578b118329 Check if passes (#1982) 2023-06-19 14:02:49 +00:00
Andrew FerlitschandGitHub 4bd9d4c54b fix: boilerplate reduction 29 - XAI issue (#1856)
* fix: boilerplate reduction 29

* Fix TF issue, upgrade to 2.11

* Fix: missing cv install

* Update sdk_custom_image_classification_online_explain.ipynb
2023-06-16 19:31:08 +00:00
weigaryandGitHub c97aedf227 Add two additional files to the util directory. (#1981)
* Add the first util class to the vertex-vision-model-garden repo

* Updated file names.

* Delete the 1st incorrect file set.

* Add the codeowners

* Revised the file folder structures.

* Add two additional files to the util directory.
2023-06-16 19:23:32 +00:00
weigaryandGitHub 6bb255bc5f Add the first util class to the vertex_vision_model_garden repo. (#1978)
* Add the first util class to the vertex-vision-model-garden repo

* Updated file names.

* Delete the 1st incorrect file set.

* Add the codeowners

* Revised the file folder structures.
2023-06-16 19:22:51 +00:00
Eric DongandGitHub 5a96b4a335 fix: pin protobuf version to address a dependency compatibility issue (#1980)
* fix: pin protobuf version to address a dependency compability issue

* removed --user install

* update protobuf version

* workaround an artifact registry
2023-06-16 19:18:35 +00:00
Andrew FerlitschandGitHub b502254a10 Weekly index (#1972)
* feat: add build to generate web index of official notebooks

* fix: review comments

* fix: store results

* fix: store results

* fix: --steps

* fix: --steps

* fix: moved to its own dir
2023-06-16 18:26:54 +00:00
ec6ba9ecf0 Add the text2video-zero notebook (#1977)
* Add the text2video-zero notebook.

* Add code owner for text2video-zero.

---------

Co-authored-by: Andrew Ferlitsch <aferlitsch@google.com>
2023-06-16 17:38:36 +00:00
KCFindstrandGitHub 709745f405 Add #ModelGarden text-to-video notebook. (#1973) 2023-06-16 17:36:51 +00:00
Huguens JeanandGitHub 0b1046e6c6 Add Segment Anything (SAM) notebook to model garden community folder. (#1975)
* Add Segment Anything (SAM) notebook to model garden community folder.

* Added SAM notebook to the CODEOWNERS file.
2023-06-16 17:34:19 +00:00
Andrew FerlitschandGitHub f6ae1205dc fix: create AR repo > 24hrs (#1937)
* fix: create AR repo

* fix: gcloud install
2023-06-15 20:53:16 +00:00
ab98cf8b36 fix: boilerplate reduction 67 : training pipeline failed (#1939)
* fix: boilerplate reduction 67

* fix: pin transformers version to avoid Pytorch breaking change (#1979)

---------

Co-authored-by: Eric Dong <itseric@google.com>
2023-06-15 16:41:53 +00:00
Andrew FerlitschandGitHub c60e8d1e3d feat: add build to generate web index of official notebooks (#1971)
* feat: add build to generate web index of official notebooks

* fix: review comments

* fix: store results
2023-06-13 20:08:04 +00:00
Andrew FerlitschandGitHub f1e3b02eb0 fix: boilerplate reduction 73 - DAG failed (#1945)
* fix: boilerplate reduction 73

* fix: region

* import os

* fix: import uuid

* fix: lint
2023-06-13 12:38:39 +00:00
Mend RenovateandGitHub 5885cb3724 chore(deps): update dependency pyupgrade to v3.6.0 (#1969) 2023-06-11 13:40:09 +00:00
Andrew FerlitschandGitHub 9827ae0218 fix: boilerplate reduction 27 - Internal error (#1854)
* fix: boilerplate reduction 27

* fix: import os
2023-06-10 00:19:55 +00:00
Andrew FerlitschandGitHub 712a066981 fix: boilerplate reduction 28 - internal error, try again (#1855)
* fix: boilerplate reduction 28

* fix: import

* fix: XAI TF conflict
2023-06-09 19:34:48 +00:00
Lav RaiandGitHub 5528d1cedc Add llm notebooks (#1968)
* Add Bart-large-cnn and dolly-v2 serving notebooks.

* Add Bart-large-cnn and dolly-v2 serving notebooks.

* Add Bart-large-cnn and dolly-v2 serving notebooks.
2023-06-09 18:35:13 +00:00
Andrew FerlitschandGitHub 155f316588 fix: boilerplate reduction 95 (#1966)
* fix: boilerplate reduction 95

* fix: import os

* fix: install pyspark

* fix: numpy bool
2023-06-09 12:31:40 +00:00
Xiang XuandGitHub 50d13e004d add new (#1961) 2023-06-08 19:44:23 +00:00
Andrew FerlitschandGitHub 03a2717248 fix: boilerplate reduction 94 (#1965)
* fix: boilerplate reduction 95

* fix:  import os

* fix: install pyspark
2023-06-08 17:37:35 +00:00
Andrew FerlitschandGitHub 3d7e0c2861 fix: boilerplate reduction 91 (#1963)
* fix: boilerplate reduction 91

* fix: install scikit-learn
2023-06-08 17:36:45 +00:00
Andrew FerlitschandGitHub de54c3d2dd fix: boilerplate reduction 81 (#1952)
* fix: boilerplate reduction 81

* fix: import os

* fix: import sys
2023-06-08 17:35:39 +00:00
Andrew FerlitschandGitHub d3e066a1ee fix: boilerplate reduction 80 - AR (#1951)
* fix: boilerplate reduction 80

* fix: AR

* fix: AR
2023-06-08 17:31:57 +00:00
Andrew FerlitschandGitHub 669eb0f2e7 fix: boilerplate reduction 83 (#1954) 2023-06-08 17:30:44 +00:00
Andrew FerlitschandGitHub 3618721baf fix: boilerplate reduction 86 (#1957)
* fix: boilerplate reduction 86

* fix: install
2023-06-08 16:17:55 +00:00
Andrew FerlitschandGitHub 9fad2cf0eb fix: boilerplate reduction 87 (#1958) 2023-06-08 16:16:50 +00:00
Andrew FerlitschandGitHub 9b625c143b fix: boilerplate reduction 89 (#1960) 2023-06-08 16:15:36 +00:00
Andrew FerlitschandGitHub 6600309c4a fix: boilerplate reduction 90 (#1962)
* fix: boilerplate reduction 90

* fix: install db-dtypes
2023-06-08 16:14:34 +00:00
Andrew FerlitschandGitHub 1091ec83b4 fix: boilerplate reduction 92 (#1964) 2023-06-08 16:13:39 +00:00
Andrew FerlitschandGitHub a29e1dd50a fix: boilerplate reduction 79 (#1950)
* fix: boilerplate reduction 79

* fix: import os

* fix: IS_COLAB
2023-06-08 16:12:37 +00:00
Andrew FerlitschandGitHub ef7959a7d8 fix: boilerplate reduction 77: TF (#1948)
* fix: boilerplate reduction 77

* TF

* Fix install TF
2023-06-07 20:23:04 +00:00
Andrew FerlitschandGitHub 2d38e7fc3b fix: boilerplate reduction 78 (#1949) 2023-06-07 20:21:41 +00:00
Andrew FerlitschandGitHub 5ac40786f1 fix: create AR repo (#1936) 2023-06-07 19:53:04 +00:00
Andrew FerlitschandGitHub 91ea9c7d4e fix: boilerplate reduction 74 (#1946)
* fix: boilerplate reduction 74

* fix: region

* import os

* fix: import uuid
2023-06-07 19:05:35 +00:00
Andrew FerlitschandGitHub 7de2195b1c fix: boilerplate reduction 70 (#1942) 2023-06-07 14:28:28 +00:00
Andrew FerlitschandGitHub a9ba2062b1 fix: boilerplate reduction 68 (#1940)
* fix: boilerplate reduction 68

* fix: install os

* import sys
2023-06-07 14:27:29 +00:00
Andrew FerlitschandGitHub de46d815b9 fix: train job not using TRAIN_IMAGE (#1938) 2023-06-06 19:36:47 +00:00
Andrew FerlitschandGitHub 6e4fb5396a tune: AR repeaper (#1935) 2023-06-06 17:15:16 +00:00
Andrew FerlitschandGitHub 3d9a462528 feat: delete AR repos (#1932) 2023-06-05 21:31:51 +00:00
Andrew FerlitschandGitHub d0de4f9340 feat: boilerplate reduction 66 (#1926)
* feat: boilerplate reduction 66

* fix bucket name
2023-06-05 21:29:21 +00:00
Andrew FerlitschandGitHub fb42792527 feat: boilerplate reduction 56 (#1914)
* feat: boilerplate reduction 56

* fix: bucket
2023-06-05 15:28:56 +00:00
Andrew FerlitschandGitHub cfaa10834c feat: boilerplate reduction 58 (#1916)
* feat: boilerplate reduction 58

* fix: bucket
2023-06-05 15:28:12 +00:00
Andrew FerlitschandGitHub 5dfc3c29d0 feat: boilerplate reduction 65 (#1924) 2023-06-05 15:27:15 +00:00
rachael-dsandGitHub 91aa0822b9 Updated notebook and readme to include link of now published blog (#1927) 2023-06-05 15:18:16 +00:00
Andrew FerlitschandGitHub b002e7ba2c tune: selecting notebooks (#1908)
* tune: selecting notebooks

* test: add test for select_notebook

* fix: random algo

* test: convert to pytest

* fix: review

* fix: remove path ..

* fix: assert
2023-06-01 21:34:14 +00:00
dstnluong-googleandGitHub c273a4c3a9 Add instructions for selecting operating system (#1920) 2023-06-01 19:33:39 +00:00
518 changed files with 139677 additions and 30888 deletions
+21 -7
View File
@@ -1,5 +1,14 @@
from typing import List
from ratemate import RateLimit
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--dry_run",
type=bool,
default=False)
args = parser.parse_args()
from resource_cleanup_manager import (
DatasetResourceCleanupManager,
ModelResourceCleanupManager,
@@ -7,13 +16,15 @@ from resource_cleanup_manager import (
ResourceCleanupManager,
MatchingEngineIndexEndpointResourceCleanupManager,
MatchingEngineIndexResourceCleanupManager,
FeatureStoreLegacyCleanupManager,
FeatureStoreCleanupManager,
PipelineJobCleanupManager,
TrainingJobCleanupManager,
HyperparameterTuningCleanupManager,
BatchPredictionJobCleanupManager,
ExperimentCleanupManager,
BucketCleanupManager
BucketCleanupManager,
ArtifactRegistryCleanupManager
)
rate_limit = RateLimit(max_count=25, per=60, greedy=False)
@@ -25,7 +36,10 @@ def run_cleanup_managers(managers: List[ResourceCleanupManager], is_dry_run: boo
print(f"Fetching {type_name}'s...")
resources = manager.list()
print(f"Found {len(resources)} {type_name}'s")
try:
print(f"Found {len(resources)} {type_name}'s")
except Exception as e:
print(f"{type_name} {e}")
for resource in resources:
try:
if not manager.is_deletable(resource):
@@ -42,9 +56,7 @@ def run_cleanup_managers(managers: List[ResourceCleanupManager], is_dry_run: boo
print("")
is_dry_run = False
if is_dry_run:
if args.dry_run:
print("Starting cleanup in dry run mode...")
# List of all cleanup managers
@@ -54,13 +66,15 @@ managers: List[ResourceCleanupManager] = [
ModelResourceCleanupManager(), # ModelResourceCleanupManager must follow EndpointResourceCleanupManager due to deployed models blocking model deletion.
MatchingEngineIndexEndpointResourceCleanupManager(),
MatchingEngineIndexResourceCleanupManager(),
FeatureStoreLegacyCleanupManager(),
FeatureStoreCleanupManager(),
PipelineJobCleanupManager(),
TrainingJobCleanupManager(),
HyperparameterTuningCleanupManager(),
BatchPredictionJobCleanupManager(),
ExperimentCleanupManager(), # Experiment missing _resource_noun
BucketCleanupManager()
BucketCleanupManager(),
ArtifactRegistryCleanupManager()
]
run_cleanup_managers(managers=managers, is_dry_run=is_dry_run)
run_cleanup_managers(managers=managers, is_dry_run=args.dry_run)
@@ -6,14 +6,21 @@ READ FIRST BEFORE MAKING CHANGES
- Add --dry-run option to the clean-up script. This option will just output the list of resources the script will delete instead of actually deleting the resources.
- Have a larger conversation in DEE before touching any resources that were not created as part of vertex-ai-samples
'''
import os
import abc
from typing import Any, Type
from google.cloud import aiplatform
from google.cloud.aiplatform import base
from google.cloud.aiplatform_v1beta1 import (FeatureOnlineStoreAdminServiceClient,
FeatureOnlineStore)
from google.cloud import storage
from proto.datetime_helpers import DatetimeWithNanoseconds
PROJECT_ID = "python-docs-samples-tests"
REGION = "us-central1"
API_ENDPOINT = f"{REGION}-aiplatform.googleapis.com"
# If a resource was updated within this number of seconds, do not delete.
RESOURCE_UPDATE_BUFFER_IN_SECONDS = 60 * 60 * 8
@@ -128,12 +135,51 @@ class MatchingEngineIndexEndpointResourceCleanupManager(VertexAIResourceCleanupM
resource.undeploy_all()
resource.delete(force=True)
class FeatureStoreCleanupManager(VertexAIResourceCleanupManager):
class FeatureStoreLegacyCleanupManager(VertexAIResourceCleanupManager):
# TODO: only deleting legacy
# not deleting ingestions jobs
# ingest_from_xxx methods do not return a job ID, there is no list command, aka no python way to delete
# not deleting batch serving jobs
# batch_serve_to_xxx methods do not return a job ID, there is no list command, aka no python way to delete
vertex_ai_resource = aiplatform.Featurestore
def resource_name(self, resource: Any) -> str:
return resource.name
def delete(self, resource):
resource.delete(force=True)
class FeatureStoreCleanupManager(VertexAIResourceCleanupManager):
# for FS 2.0
# TODO: use _v1beta1, and gapic clients
# delete features, feature groups, feature views, feature online stores
vertex_ai_resource = FeatureOnlineStore
admin_client = FeatureOnlineStoreAdminServiceClient(
client_options={"api_endpoint": API_ENDPOINT}
)
def resource_name(self, resource: Any) -> str:
return resource.name
def type_name(self) -> str:
return "FeatureOnlineStore"
def list(self) -> Any:
try:
return self.admin_client.list_feature_online_stores(parent=f"projects/{PROJECT_ID}/locations/{REGION}")
except Exception as e:
print(e)
return []
def delete(self, resource):
try:
self.admin_client.delete_feature_online_store(name=resource.name, force=True)
except Exception as e:
print(e)
class PipelineJobCleanupManager(VertexAIResourceCleanupManager):
vertex_ai_resource = aiplatform.PipelineJob
@@ -220,5 +266,40 @@ class BucketCleanupManager(ResourceCleanupManager):
f"Skipping '{resource}' due to update_time being '{time_difference}', which is less than '{RESOURCE_UPDATE_BUFFER_IN_SECONDS}'."
)
return False
return True
class ArtifactRegistryCleanupManager(ResourceCleanupManager):
vertex_ai_resource = "Artifact Registry"
def list(self) -> Any:
import subprocess
result = subprocess.run(["gcloud artifacts repositories list --location=us-central1"],
shell=True, capture_output=True, text=True)
ret = []
lines = result.stdout.split('\n')[2:]
for line in lines:
repo = line.split(' ')[0]
if repo.startswith("my-docker-repo"):
ret.append(repo)
return ret
def delete(self, resource):
os.system(f"! gcloud artifacts repositories delete {resource} --location=us-central1")
@property
def type_name(self) -> str:
return "ArtifactRepository"
def resource_name(self, resource: Any) -> str:
return resource
# delete repository regardless of age
def get_seconds_since_modification(self, resource: Any) -> float:
return RESOURCE_UPDATE_BUFFER_IN_SECONDS + 1
def is_deleteable(self, resource: Any) -> bool:
return True
+49 -2
View File
@@ -18,6 +18,7 @@
import argparse
import pathlib
import os
import csv
import execute_changed_notebooks_helper
@@ -37,7 +38,7 @@ parser = argparse.ArgumentParser(description="Run changed notebooks.")
parser.add_argument(
"--test_paths_file",
type=pathlib.Path,
help="The path to the file that has newline-limited folders of notebooks that should be tested.",
help="The path to the file that has newline-delimited folders of notebooks that should be tested.",
required=True,
)
parser.add_argument(
@@ -121,6 +122,27 @@ parser.add_argument(
default=True,
help="Should run notebooks in parallel.",
)
parser.add_argument(
"--concurrent_notebooks",
type=int,
help="Maximum number of parallel notebook executions per minute",
default=10,
required=False,
)
parser.add_argument(
"--run_first_file",
type=pathlib.Path,
help="The path to the file that has newline-delimited of notebooks to run in the first batch",
default=None,
required=False,
)
parser.add_argument(
"--aiplatform_whl",
type=str,
help="The GCS path to a whl version google-cloud-aiplatform",
default=None,
required=False,
)
parser.add_argument(
"--dry_run",
type=str2bool,
@@ -150,6 +172,29 @@ else:
accumulative_results = execute_changed_notebooks_helper.load_results(results_bucket, results_file)
notebooks = [changed_notebook for changed_notebook in changed_notebooks if execute_changed_notebooks_helper.select_notebook(changed_notebook, accumulative_results, args.test_percent)]
# cap the number of notebooks to the specified percentage
max_notebooks = int((len(changed_notebooks) * (args.test_percent/100)))
if (len(notebooks) > max_notebooks):
notebooks = notebooks[:max_notebooks]
run_first = []
if args.run_first_file:
if not os.path.isfile(args.run_first_file):
print("Error: file does not exist", args.run_first_file)
else:
with open(args.run_first_file, 'r') as csvfile:
reader = csv.reader(csvfile)
for row in reader:
notebook = row[0]
run_first.append(notebook)
for notebook in run_first:
if notebook in notebooks:
# remove from existing list
notebooks.remove(notebook)
# add back to the front of the list
notebooks.insert(0, notebook)
print(f"Run first: {notebook}")
if args.dry_run:
print("Dry run ...\n")
@@ -168,5 +213,7 @@ else:
variable_region=args.variable_region,
variable_service_account=args.variable_service_account,
variable_vpc_network=args.variable_vpc_network,
private_pool_id=args.private_pool_id
private_pool_id=args.private_pool_id,
concurrent_notebooks=args.concurrent_notebooks,
aiplatform_whl=args.aiplatform_whl
)
@@ -36,14 +36,19 @@ import execute_notebook_helper
import execute_notebook_remote
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
# rolling time window for accumulating build results for selecting notebooks
MAX_RESULTS_AGE_SECONDS: int = (60 * 60) * 24 * 60 # 60 days
# maximum time since last run to force a run on the current build
MAX_AGE_BEFORE_FORCE_RUN: int = (60 * 60) * 24 * 30
def format_timedelta(delta: datetime.timedelta) -> str:
"""Formats a timedelta duration to [N days] %H:%M:%S format"""
@@ -86,8 +91,9 @@ class NotebookExecutionResult:
else:
return None
def load_results(results_bucket: str,
results_file: str) -> Dict[str,Any]:
results_file: str) -> Dict[str, Any]:
'''
Load accumulated notebook test results
'''
@@ -101,13 +107,26 @@ def load_results(results_bucket: str,
build_results_dir = os.path.dirname(results_file)
blobs = client.list_blobs(results_bucket, prefix=build_results_dir)
for blob in blobs:
time_created = blob.time_created.replace(tzinfo=None)
if (datetime.datetime.now().replace(tzinfo=None) - time_created).total_seconds() > MAX_RESULTS_AGE_SECONDS:
continue
content = util.download_blob_into_memory(results_bucket, blob.name, download_as_text=True)
build_results = json.loads(content)
try:
build_results = json.loads(content)
except:
continue # skip corrupted build results files
for notebook in build_results:
if notebook in accumulative_results:
accumulative_results[notebook] += build_results[notebook]
accumulative_results[notebook]['passed'] += build_results[notebook]['passed']
accumulative_results[notebook]['failed'] += build_results[notebook]['failed']
if accumulative_results[notebook]['last_time_ran'] < time_created:
accumulative_results[notebook]['last_time_ran'] = time_created
else:
accumulative_results[notebook] = build_results[notebook]
accumulative_results[notebook]['failed_on_latest_run'] = build_results[notebook]['failed']
accumulative_results[notebook]['last_time_ran'] = time_created
print(accumulative_results)
except Exception as e:
@@ -126,19 +145,42 @@ def select_notebook(changed_notebook: str,
if changed_notebook in accumulative_results:
pass_count = accumulative_results[changed_notebook]['passed']
fail_count = accumulative_results[changed_notebook]['failed']
failed_on_latest_run = accumulative_results[changed_notebook]['failed_on_latest_run']
last_time_ran = accumulative_results[changed_notebook]['last_time_ran']
else:
pass_count = 1
fail_count = 0
failed_on_latest_run = 0
last_time_ran = datetime.datetime.now().replace(tzinfo=None)
inferred_failure_rate = fail_count / (pass_count + fail_count)
# If notebook has not been ran in a long time, force running it
if (datetime.datetime.now().replace(tzinfo=None) - last_time_ran).total_seconds() > MAX_AGE_BEFORE_FORCE_RUN:
should_test_do_to_age = True
else:
should_test_do_to_age = False
# if failed on the last time it was ran, select the notebook
if failed_on_latest_run:
inferred_failure_rate = 1
# otherwise, calculate the frequency of failure
else:
inferred_failure_rate = fail_count / (pass_count + fail_count)
# If failure rate is high, the chance of testing should be higher
should_test_due_to_failure = random.uniform(0, 1) < inferred_failure_rate
should_test_due_to_failure = random.uniform(0, 1) <= inferred_failure_rate
#if accumulative_resultsi[changed_notebook]['latest_date_ran']
# Additionally, only test a percentage of these
should_test_due_to_random_subset = random.uniform(0, 1) < test_percent
should_test_due_to_random_subset = random.uniform(0, 1) <= (test_percent / 100)
return should_test_due_to_failure and should_test_due_to_random_subset
if should_test_due_to_failure or should_test_due_to_random_subset or should_test_do_to_age:
print(f"Selected: {changed_notebook}, {should_test_due_to_failure}, {should_test_due_to_random_subset}")
return True
else:
print(f"Not Selected: {changed_notebook}, pass {pass_count}, fail {fail_count}")
return False
def _process_notebook(
@@ -196,7 +238,7 @@ def _get_notebook_python_version(notebook_path: str) -> str:
# Look for the python version specification pattern
re_match = re.search(
"python version = (\d\.\d)", markdown, flags=re.IGNORECASE
"python version = (\d+\.\d+)", markdown, flags=re.IGNORECASE
)
if re_match:
# get the version number
@@ -216,7 +258,6 @@ def _create_tag(filepath: str) -> str:
return tag
rate_limit = RateLimit(max_count=10, per=60, greedy=True)
def process_and_execute_notebook(
@@ -230,9 +271,8 @@ def process_and_execute_notebook(
private_pool_id: Optional[str],
deadline: datetime.datetime,
notebook: str,
should_get_tail_logs: bool = False,
should_get_tail_logs: bool = True,
) -> NotebookExecutionResult:
rate_limit.wait() # wait before creating the task
print(f"Running notebook: {notebook}")
@@ -413,15 +453,39 @@ def _save_results(results: List[NotebookExecutionResult],
else:
pass_count = 0
fail_count = 1
if result.error_message is None:
error_type = ''
elif '500 Internal' in result.error_message or 'INTERNAL' in result.error_message or 'internal error' in result.error_message:
error_type = 'INTERNAL'
elif 'context deadline exceeded' in result.error_message or 'TIMEOUT' in result.error_message:
error_type = 'TIMEOUT'
elif 'Quota' in result.error_message or 'quotas are exceeded' in result.error_message:
error_type = 'QUOTA'
elif 'ServiceUnavailable' in result.error_message:
error_type = 'SERVICEUNAVAILABLE'
elif 'ModuleNotFoundError' in result.error_message:
error_type = 'IMPORT'
elif result.is_pass:
error_type = ''
else:
error_type = 'undetermined'
if error_type != '':
log_url = result.log_url
else:
log_url = ''
build_results[result.path] = {
'duration': result.duration.total_seconds(),
'start_time': str(result.start_time),
'passed': pass_count,
'failed': fail_count
'failed': fail_count,
'error_type': error_type,
'log_url': log_url
}
print(f"adding {result.path}")
print("Saving accumulative results ...")
print(f"Saving accumulative results to {results_file}, nentries {len(build_results)}")
content = json.dumps(build_results)
client = storage.Client()
@@ -443,6 +507,8 @@ def process_and_execute_notebooks(
variable_service_account: str,
variable_vpc_network: Optional[str] = None,
private_pool_id: Optional[str] = None,
concurrent_notebooks: Optional[int] = 10,
aiplatform_whl: Optional[str] = None,
):
"""
Run the notebooks that exist under the folders defined in the test_paths_file.
@@ -473,6 +539,8 @@ def process_and_execute_notebooks(
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.
concurrent_notebooks (int): Max number of notebooks per minute to run in parallel.
aiplatform_whl: alternate whl version of Vertex AI SDK to install
"""
# Calculate deadline
@@ -489,7 +557,9 @@ def process_and_execute_notebooks(
print(
"Running notebooks in parallel, so no logs will be displayed. Please wait..."
)
with concurrent.futures.ThreadPoolExecutor(max_workers=100) as executor:
with concurrent.futures.ThreadPoolExecutor(max_workers=concurrent_notebooks) as executor:
print(f"Max workers: {executor._max_workers}")
notebook_execution_results = list(
@@ -36,7 +36,7 @@ steps:
- -c
- |
. 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` --build_id ${BUILD_ID} --test_percent=${_TEST_PERCENT}
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 "${_GCP_VPC_NETWORK_NAME}" `if [ ! -z "${_PRIVATE_POOL_NAME}" ]; then echo "--private_pool_id ${_PRIVATE_POOL_NAME}"; fi` --build_id ${BUILD_ID} --test_percent=${_TEST_PERCENT} --concurrent_notebooks=${_CONCURRENT_NOTEBOOKS} --run_first_file=${_RUN_FIRST_FILE}
env:
- 'IS_TESTING=1'
timeout: 86400s
+8
View File
@@ -0,0 +1,8 @@
notebooks/official/pipelines/google_cloud_pipeline_components_automl_text.ipynb
notebooks/official/generative_ai/rlhf_tune_llm.ipynb
notebooks/official/generative_ai/tune_peft.ipynb
notebooks/official/prediction/llm_streaming_prediction.ipynb
notebooks/official/migration/sdk-automl-text-classification-batch-prediction.ipynb
notebooks/official/vizier/get_started_vertex_vizier.ipynb
notebooks/official/workbench/sentiment_analysis/Sentiment_Analysis.ipynb
notebooks/official/model_monitoring/get_started_with_model_monitoring_automl.ipynb
1 notebooks/official/pipelines/google_cloud_pipeline_components_automl_text.ipynb
2 notebooks/official/generative_ai/rlhf_tune_llm.ipynb
3 notebooks/official/generative_ai/tune_peft.ipynb
4 notebooks/official/prediction/llm_streaming_prediction.ipynb
5 notebooks/official/migration/sdk-automl-text-classification-batch-prediction.ipynb
6 notebooks/official/vizier/get_started_vertex_vizier.ipynb
7 notebooks/official/workbench/sentiment_analysis/Sentiment_Analysis.ipynb
8 notebooks/official/model_monitoring/get_started_with_model_monitoring_automl.ipynb
-40
View File
@@ -1,40 +0,0 @@
notebooks/official/training/pytorch_gcs_data_training.ipynb
notebooks/official/custom/custom_training_tensorboard_profiler.ipynb
notebooks/official/custom/custom-tabular-bq-managed-dataset.ipynb
notebooks/official/ml_metadata/sdk-metric-parameter-tracking-for-locally-trained-models.ipynb
notebooks/official/ml_metadata/sdk-metric-parameter-tracking-for-custom-jobs.ipynb
notebooks/official/tabnet/tabnet_vertex_tutorial.ipynb
notebooks/official/tabnet/get_started_with_tabnet.ipynb
notebooks/official/pipelines/google_cloud_pipeline_components_automl_text.ipynb
notebooks/official/pipelines/multicontender_vs_champion_deployment_method.ipynb
notebooks/official/pipelines/google_cloud_pipeline_components_automl_images.ipynb
notebooks/official/pipelines/rapid_prototyping_bqml_automl.ipynb
notebooks/official/pipelines/challenger_vs_blessed_deployment_method.ipynb
notebooks/official/matching_engine/sdk_matching_engine_create_stack_overflow_embeddings.ipynb
notebooks/official/matching_engine/sdk_matching_engine_for_indexing.ipynb
notebooks/official/matching_engine/sdk_matching_engine_create_text_to_image_embeddings.ipynb
notebooks/official/explainable_ai/sdk_custom_image_classification_online_explain.ipynb
notebooks/official/explainable_ai/xai_image_classification_feature_attributions.ipynb
notebooks/official/explainable_ai/sdk_custom_image_classification_batch_explain.ipynb
notebooks/official/tabular_workflows/tabnet_on_vertex_pipelines.ipynb
notebooks/official/model_registry/get_started_with_model_registry.ipynb
notebooks/official/model_registry/bqml_vertexai_model_registry.ipynb
notebooks/official/sdk/SDK_Custom_Training_Python_Package_Managed_Text_Dataset_Tensorflow_Serving_Container.ipynb
notebooks/official/model_monitoring/batch_prediction_model_monitoring.ipynb
notebooks/official/model_monitoring/get_started_with_model_monitoring_setup.ipynb
notebooks/official/model_monitoring/get_started_with_model_monitoring_custom.ipynb
notebooks/official/model_monitoring/get_started_with_model_monitoring_custom_tf_serving.ipynb
notebooks/official/model_monitoring/model_monitoring.ipynb
notebooks/official/tensorboard/tensorboard_profiler_custom_training_with_prebuilt_container.ipynb
notebooks/official/tensorboard/tensorboard_hyperparameter_tuning_with_hparams.ipynb
notebooks/official/tensorboard/tensorboard_profiler_custom_training.ipynb
notebooks/official/model_evaluation/custom_tabular_regression_model_evaluation.ipynb
notebooks/official/model_evaluation/custom_tabular_classification_model_evaluation.ipynb
notebooks/official/model_evaluation/automl_video_classification_model_evaluation.ipynb
notebooks/official/experiments/comparing_local_trained_models.ipynb
notebooks/official/automl/automl_image_classification_online_online_prediction.ipynb
notebooks/official/automl/automl-text-classification.ipynb
notebooks/official/automl/sdk_automl_video_object_tracking_batch.ipynb
notebooks/official/feature_store/sdk-feature-store-pandas.ipynb
notebooks/official/prediction/custom_batch_prediction_feature_filter.ipynb
notebooks/official/prediction/pytorch_image_classification_with_prebuilt_serving_containers.ipynb
-80
View File
@@ -1,80 +0,0 @@
notebooks/official/training/hyperparameter_tuning_tensorflow.ipynb
notebooks/official/training/get_started_with_vertex_distributed_training.ipynb
notebooks/official/training/hyperparameter_tuning_xgboost.ipynb
notebooks/official/training/multi_node_ddp_gloo_vertex_training_with_custom_container.ipynb
notebooks/official/training/distributed_hyperparameter_tuning.ipynb
notebooks/official/training/pytorch-text-sentiment-classification-custom-train-deploy.ipynb
notebooks/official/training/xgboost_data_parallel_training_on_cpu_using_dask.ipynb
notebooks/official/training/multi_node_ddp_nccl_vertex_training_with_custom_container.ipynb
notebooks/official/bigquery_ml/get_started_with_bqml_training.ipynb
notebooks/official/bigquery_ml/bqml-online-prediction.ipynb
notebooks/official/custom/custom_training_container_and_model_registry.ipynb
notebooks/official/custom/sdk-custom-image-classification-online.ipynb
notebooks/official/custom/sdk-custom-image-classification-batch.ipynb
notebooks/official/custom/SDK_FBProphet_Forecasting_Online.ipynb
notebooks/official/custom/get_started_vertex_training_xgboost.ipynb
notebooks/official/custom/get_started_with_vertex_endpoint_and_shared_vm.ipynb
notebooks/official/custom/SDK_Custom_Container_Prediction.ipynb
notebooks/official/reduction_server/pytorch_distributed_training_reduction_server.ipynb
notebooks/official/tabnet/ai-explanations-tabnet-algorithm.ipynb
notebooks/official/vizier/get_started_vertex_vizier.ipynb
notebooks/official/vizier/gapic-vizier-multi-objective-optimization.ipynb
notebooks/official/pipelines/get_started_with_hpt_pipeline_components.ipynb
notebooks/official/pipelines/google_cloud_pipeline_components_automl_tabular.ipynb
notebooks/official/pipelines/custom_tabular_train_batch_pred_bq_pipeline.ipynb
notebooks/official/pipelines/metrics_viz_run_compare_kfp.ipynb
notebooks/official/pipelines/google_cloud_pipeline_components_model_upload_predict_evaluate.ipynb
notebooks/official/pipelines/google_cloud_pipeline_components_model_train_upload_deploy.ipynb
notebooks/official/pipelines/get_started_with_machine_management.ipynb
notebooks/official/pipelines/custom_model_training_and_batch_prediction.ipynb
notebooks/official/pipelines/control_flow_kfp.ipynb
notebooks/official/pipelines/lightweight_functions_component_io_kfp.ipynb
notebooks/official/pipelines/google_cloud_pipeline_components_bqml_text.ipynb
notebooks/official/pipelines/pipelines_intro_kfp.ipynb
notebooks/official/pipelines/automl_tabular_classification_beans.ipynb
notebooks/official/pipelines/google_cloud_pipeline_components_dataproc_tabular.ipynb
notebooks/official/explainable_ai/sdk_automl_tabular_classification_online_explain.ipynb
notebooks/official/explainable_ai/sdk_custom_tabular_regression_online_explain.ipynb
notebooks/official/explainable_ai/sdk_automl_tabular_binary_classification_batch_explain.ipynb
notebooks/official/explainable_ai/sdk_custom_tabular_regression_online_explain_get_metadata.ipynb
notebooks/official/explainable_ai/sdk_custom_tabular_regression_batch_explain.ipynb
notebooks/official/tabular_workflows/prophet_on_vertex_pipelines.ipynb
notebooks/official/tabular_workflows/wide_and_deep_on_vertex_pipelines.ipynb
notebooks/official/sdk/SDK_AutoML_Video_Classification.ipynb
notebooks/official/model_monitoring/get_started_with_model_monitoring_automl.ipynb
notebooks/official/model_monitoring/get_started_with_model_monitoring_automl_image_batch.ipynb
notebooks/official/model_monitoring/get_started_with_model_monitoring_automl_image_online.ipynb
notebooks/official/model_monitoring/get_started_with_model_monitoring_xgboost.ipynb
notebooks/official/tensorboard/tensorboard_custom_training_with_custom_container.ipynb
notebooks/official/tensorboard/tensorboard_custom_training_with_prebuilt_container.ipynb
notebooks/official/tensorboard/tensorboard_vertex_ai_pipelines_integration.ipynb
notebooks/official/model_evaluation/automl_text_classification_model_evaluation.ipynb
notebooks/official/model_evaluation/get_started_with_custom_model_evaluation_import.ipynb
notebooks/official/model_evaluation/automl_tabular_classification_model_evaluation.ipynb
notebooks/official/model_evaluation/automl_tabular_regression_model_evaluation.ipynb
notebooks/official/experiments/get_started_with_vertex_experiments.ipynb
notebooks/official/experiments/comparing_pipeline_runs.ipynb
notebooks/official/experiments/get_started_with_vertex_experiments_autologging.ipynb
notebooks/official/experiments/build_model_experimentation_lineage_with_prebuild_code.ipynb
notebooks/official/experiments/delete_outdated_tensorboard_experiments.ipynb
notebooks/official/automl/sdk_automl_tabular_regression_batch_bq.ipynb
notebooks/official/automl/sdk_automl_text_sentiment_analysis_online.ipynb
notebooks/official/automl/sdk_automl_text_entity_extraction_online.ipynb
notebooks/official/automl/sdk_automl_forecasting_hierarchical_batch.ipynb
notebooks/official/automl/automl_text_entity_extraction_batch_prediction.ipynb
notebooks/official/automl/automl_image_classification_batch_prediction.ipynb
notebooks/official/automl/automl_text_sentiment_analysis_batch_prediction.ipynb
notebooks/official/automl/sdk_automl_tabular_regression_online_bq.ipynb
notebooks/official/automl/get_started_automl_training.ipynb
notebooks/official/automl/automl-tabular-classification.ipynb
notebooks/official/automl/automl_image_object_detection_export_edge.ipynb
notebooks/official/automl/sdk_automl_image_object_detection_batch.ipynb
notebooks/official/automl/automl_tabular_on_vertex_pipelines.ipynb
notebooks/official/automl/sdk_automl_video_classification_batch.ipynb
notebooks/official/automl/sdk_automl_video_action_recognition_batch.ipynb
notebooks/official/automl/sdk_automl_tabular_forecasting_batch.ipynb
notebooks/official/automl/automl_image_object_detection_online_prediction.ipynb
notebooks/official/automl/automl_forecasting_bqml_arima_plus_comparison.ipynb
notebooks/official/datasets/get_started_bq_datasets.ipynb
notebooks/official/datasets/get_started_with_data_labeling.ipynb
notebooks/official/feature_store/feature_store_streaming_ingestion_sdk.ipynb
@@ -0,0 +1,33 @@
import sys
from execute_changed_notebooks_helper import (load_results, select_notebook)
def test_load_results():
bucket: str = "cloud-build-notebooks-presubmit"
bucket_file: str = "build_results"
accum = load_results(bucket, bucket_file)
print(accum)
assert len(accum) > 0
def test_select_notebook():
bucket: str = "cloud-build-notebooks-presubmit"
bucket_file: str = "build_results"
accum = load_results(bucket, bucket_file)
n_select = 0
n_notselect = 0
for notebook in accum:
if select_notebook(notebook, accum, 50):
n_select += 1
else:
n_notselect += 1
print(f"SELECTED {n_select}, NOT SELECTED {n_notselect}")
assert n_select > 0
assert n_notselect > 0
+26 -1
View File
@@ -35,7 +35,7 @@ class RemoveNoExecuteCells(Preprocessor):
class UpdateVariablesPreprocessor(Preprocessor):
def __init__(self, replacement_map: Dict):
def __init__(self, replacement_map: Dict[str, str]):
self._replacement_map = replacement_map
@staticmethod
@@ -98,3 +98,28 @@ class UniqueStringsPreprocessor(Preprocessor):
executable_cells.append(cell)
notebook.cells = executable_cells
return notebook, resources
class VertexAIInstallProprocessor(Preprocessor):
def __init__(self, vertex_ai_wheel):
self.vertex_ai_wheel = vertex_ai_wheel
@staticmethod
def update_vertex_ai_install(content: str):
if "google-cloud-aiplatform" not in content:
return content
return (
f"gsutil cp {self.vertex_ai_wheel} google-cloud-aiplatform.whl\n" +
content.replace("google-cloud-aiplatform\n", "google-cloud-aiplatform.whl\n")
.replace("google-cloud-aiplatform ", "google-cloud-aiplatform.whl ")
)
def preprocess(self, notebook, resources=None):
executable_cells = []
for cell in notebook.cells:
if cell.cell_type == "code":
cell.source = self.update_vertex_ai_install(
content=cell.source,
)
executable_cells.append(cell)
notebook.cells = executable_cells
+56 -5
View File
@@ -5,18 +5,69 @@ Cloud Storage location: gs://cloud-build-notebooks-presubmit/build_results/
'''
import argparse
import json
from util import download_file
import csv
import datetime
from google.cloud import storage
BUILD_BUCKET = "cloud-build-notebooks-presubmit"
BUILD_FOLDER = "build_results"
parser = argparse.ArgumentParser()
parser.add_argument('--file', dest='file',
default='build.json', type=str, help='build results file')
import json
default=None, type=str, help='build results filei (local or GCS)')
args = parser.parse_args()
with open('build.json', 'r') as f:
investigate = {}
with open('investigate.csv', 'r') as csvfile:
reader = csv.reader(csvfile)
for row in reader:
investigate[row[0][:-6]] = row[1]
if not args.file:
client = storage.Client()
blobs = client.list_blobs(BUILD_BUCKET, prefix=BUILD_FOLDER)
newest_time = datetime.datetime(2000, 1, 1)
for blob in blobs:
# individual PR
if blob.size < 2000:
continue
time_created = blob.time_created.replace(tzinfo=None)
if time_created > newest_time:
newest_time = time_created
args.file = f"gs://{BUILD_BUCKET}/{blob.name}"
if args.file.startswith("gs://"):
path = args.file[5:]
bucket = path.split('/')[0]
file = path[len(bucket)+1:]
download_file(bucket, file, "build.json")
args.file = "build.json"
with open(args.file, 'r') as f:
results = json.load(f)
for item in results.items():
notebook = item[0][len("/notebooks/official/")-1:-6]
if item[1]['passed']:
print(f"{item[0]},PASSED")
passed = "PASS"
else:
print(f"{item[0]},FAILED")
if notebook in investigate:
passed = "INVG"
else:
passed = "FAIL"
error = item[1]['error_type']
if passed == "FAIL":
if error == '':
error = "undetermined"
if 'log_url' in item[1]:
log_url = item[1]['log_url']
else:
log_url = ''
else:
log_url = ''
print(f"{notebook:75} {passed} {error:10} {log_url}")
+19
View File
@@ -0,0 +1,19 @@
notebook,status
prediction/llm_streaming_prediction.ipynb,wait_for_fix
custom/get_started_with_vertex_endpoint_and_shared_vm.ipynb,issue 2527
feature_store/online_feature_serving_and_fetching_bigquery_data_with_feature_store.ipynb,wait_for_reaper
feature_store/online_feature_serving_and_vector_retrieval_bigquery_data_with_feature_store.ipynb,wait_for_reaper
pipelines/google_cloud_pipeline_components_TPU_model_train_upload_deploy.ipynb,wait_for_fix
explainable_ai/sdk_custom_image_classification_batch_explain.ipynb,issue 2528
explainable_ai/sdk_custom_image_classification_online_explain.ipynb,issue 2528
explainable_ai/sdk_custom_tabular_regression_online_explain.ipynb,issue 2528
explainable_ai/sdk_automl_tabular_binary_classification_batch_explain.ipynb,issue 2528
explainable_ai/xai_image_classification_feature_attributions.ipynb,issue 2528
matching_engine,sdk_matching_engine_create_stack_overflow_embeddings.ipynb,issue 2530
automl/automl_forecasting_bqml_arima_plus_comparison.ipynb,flaky
model_evaluation/custom_tabular_regression_model_evaluation.ipynb,regr
experiments/get_started_with_vertex_experiments.ipynb,regr
experiments/comparing_local_trained_models.ipynb,regr
generative_ai/tune_peft.ipynb,internal
pipelines/custom_model_training_and_batch_prediction.ipynb,regr
feature_store/online_feature_serving_and_fetching_bigquery_data_with_feature_store_optimized.ipynb,wait_for_reaper
1 notebook status
2 prediction/llm_streaming_prediction.ipynb wait_for_fix
3 custom/get_started_with_vertex_endpoint_and_shared_vm.ipynb issue 2527
4 feature_store/online_feature_serving_and_fetching_bigquery_data_with_feature_store.ipynb wait_for_reaper
5 feature_store/online_feature_serving_and_vector_retrieval_bigquery_data_with_feature_store.ipynb wait_for_reaper
6 pipelines/google_cloud_pipeline_components_TPU_model_train_upload_deploy.ipynb wait_for_fix
7 explainable_ai/sdk_custom_image_classification_batch_explain.ipynb issue 2528
8 explainable_ai/sdk_custom_image_classification_online_explain.ipynb issue 2528
9 explainable_ai/sdk_custom_tabular_regression_online_explain.ipynb issue 2528
10 explainable_ai/sdk_automl_tabular_binary_classification_batch_explain.ipynb issue 2528
11 explainable_ai/xai_image_classification_feature_attributions.ipynb issue 2528
12 matching_engine sdk_matching_engine_create_stack_overflow_embeddings.ipynb issue 2530
13 automl/automl_forecasting_bqml_arima_plus_comparison.ipynb flaky
14 model_evaluation/custom_tabular_regression_model_evaluation.ipynb regr
15 experiments/get_started_with_vertex_experiments.ipynb regr
16 experiments/comparing_local_trained_models.ipynb regr
17 generative_ai/tune_peft.ipynb internal
18 pipelines/custom_model_training_and_batch_prediction.ipynb regr
19 feature_store/online_feature_serving_and_fetching_bigquery_data_with_feature_store_optimized.ipynb wait_for_reaper
+11
View File
@@ -0,0 +1,11 @@
sdk2_remote_tabnet_training.ipynb
remote_hyperparameter_tuning.ipynb
remote_prediction.ipynb
remote_training_bigframes_pytorch.ipynb
remote_training_bigframes_sklearn.ipynb
remote_training_bigframes_tensorflow.ipynb
remote_training_lightning.ipynb
remote_training_pytorch.ipynb
remote_training_sklearn.ipynb
remote_training_tensorflow_with_autologging.ipynb
@@ -0,0 +1,23 @@
steps:
# 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
- python3 -m venv workspace/env
# Install Python dependencies and run testing script
- name: ${_PYTHON_IMAGE}
entrypoint: /bin/sh
args:
- -c
- |
. workspace/env/bin/activate &&
python3 notebooks/notebook_template_review.py --web --title --steps --desc --linkback --notebook-dir=notebooks/official --skip-file=${_DO_NOT_INDEX_FILE} >web.html
artifacts:
objects:
location: gs://${_GCS_ARTIFACTS_BUCKET}/webdoc
paths: ['web.html']
timeout: 86400s
+2 -2
View File
@@ -7,11 +7,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Fetch pull request branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch base main branch
+1 -1
View File
@@ -4,7 +4,7 @@
# 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
FROM python:3.12
WORKDIR setup
+5 -5
View File
@@ -2,9 +2,9 @@ git+https://github.com/tensorflow/docs
ipython
jupyter
nbconvert
black==23.3.0
pyupgrade==3.4.0
isort==5.12.0
flake8==6.0.0
nbqa==1.7.0
black==24.4.2
pyupgrade==3.16.0
isort==5.13.2
flake8==7.1.0
nbqa==1.8.5
+2 -2
View File
@@ -84,7 +84,7 @@ if [ ${#notebooks[@]} -gt 0 ]; then
# python3 -m nbqa black "$notebook" --check
# BLACK_RTN=$?
echo "Running pyupgrade..."
python3 -m nbqa pyupgrade "$notebook"
python3 -m nbqa pyupgrade --exit-zero-even-if-changed "$notebook"
PYUPGRADE_RTN=$?
echo "Running isort..."
python3 -m nbqa isort "$notebook" --check
@@ -97,7 +97,7 @@ if [ ${#notebooks[@]} -gt 0 ]; then
python3 -m nbqa black "$notebook"
BLACK_RTN=$?
echo "Running pyupgrade..."
python3 -m nbqa pyupgrade "$notebook"
python3 -m nbqa pyupgrade --exit-zero-even-if-changed "$notebook"
PYUPGRADE_RTN=$?
echo "Running isort..."
python3 -m nbqa isort "$notebook"
+31 -7
View File
@@ -1,23 +1,44 @@
# Google Cloud Vertex AI Samples
# ![Google Cloud](https://avatars.githubusercontent.com/u/2810941?s=60&v=4) Google Cloud Vertex AI Samples
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
Welcome to the Google Cloud [Vertex AI](https://cloud.google.com/vertex-ai/docs/) sample repository.
This repository contains notebooks, code samples, sample apps, and other resources that demonstrate how to use, develop and manage machine learning and generative AI workflows using Google Cloud Vertex AI.
## 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.
[Vertex AI](https://cloud.google.com/vertex-ai) is a fully-managed, unified AI development platform for building and using generative AI. This repository is designed to help you get started with Vertex AI. Whether you're new to Vertex AI or an experienced ML practitioner, you'll find valuable resources here.
For more Vertex AI Generative AI notebook samples, please visit the Vertex AI [Generative AI](https://github.com/GoogleCloudPlatform/generative-ai) GitHub repository.
## Explore and learn
You can explore, learn, and contribute to this repository to unleash the full potential of machine learning on Vertex AI! You can follow the links in the header section of each of the notebooks to -
![Colab](https://cloud.google.com/ml-engine/images/colab-logo-32px.png) Open and run the notebook in [Colab](https://colab.google/)\
![Colab Enterprise](https://cloud.google.com/ml-engine/images/colab-enterprise-logo-32px.png) Open and run the notebook in [Colab Enterprise](https://cloud.google.com/colab/docs/introduction)\
![Workbench](https://lh3.googleusercontent.com/UiNooY4LUgW_oTvpsNhPpQzsstV5W8F7rYgxgGBD85cWJoLmrOzhVs_ksK_vgx40SHs7jCqkTkCk=e14-rj-sc0xffffff-h130-w32) Open and run the notebook in [Vertex AI Workbench](https://cloud.google.com/vertex-ai/docs/workbench/introduction)\
![Github](https://cloud.google.com/ml-engine/images/github-logo-32px.png) View the notebook on Github
## Get started
To get started using Vertex AI, you must have a Google Cloud project.
- If you don't have a Google Cloud project, you can learn and build on GCP for free using [Free Trail](https://cloud.google.com/free).
- Once you have a Google Cloud project, you can learn more about [setting up a project and a development environment](https://cloud.google.com/vertex-ai/docs/start/cloud-environment).
## 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
│ │ ├── ...
│ ├── community - Notebooks contributed by the community
│ │ ├── model_garden
│ │ ├── ...
├── community-content - Sample code and tutorials contributed by the community
```
## Contributing
@@ -35,3 +56,6 @@ This is not an officially supported Google product. The code in this repository
## Feedback
Please feel free to fill out our [survey](https://bit.ly/vertex-ai-samples-survey) to give us feedback on the repo and its content.
## References
- [Vertex AI Jupyter Notebook tutorials](https://cloud.google.com/vertex-ai/docs/tutorials/jupyter-notebooks)
+19
View File
@@ -10,3 +10,22 @@
/pipeline_components @Ark-kun
/pipeline_components/image_ml_model_training @lakeyk
/prediction_featurestore_integration @googleapis/vertex-prediction-team
/vertex_model_garden/model_oss/notebook_util @minwoo33park
/vertex_model_garden/model_oss/util @weigary
/vertex_model_garden/model_oss/diffusers @weigary
/vertex_model_garden/model_oss/keras @dstnluong-google
/vertex_model_garden/model_oss/transformers @dstnluong-google
/vertex_model_garden/model_oss/pic2word @jismailyan-google
/vertex_model_garden/model_oss/open_clip @lydhr
/vertex_model_garden/model_oss/movinet @KCFindstr
/vertex_model_garden/model_oss/data_converter @KCFindstr
/vertex_model_garden/model_oss/peft @weigary
/vertex_model_garden/model_oss/lm-evaluation-harness @kathyyu-google
/vertex_model_garden/model_oss/tfvision @dstnluong-google
/vertex_model_garden/model_oss/fvlm @minwoo33park
/vertex_model_garden/model_oss/imagebind @kathyyu-google
/vertex_model_garden/model_oss/llava @py4
/vertex_model_garden/model_oss/vllm @kathyyu-google
/vertex_model_garden/benchmarking_reports @lavraicse
/vertex_model_garden/model_oss/autogluon @lavraicse
@@ -9,7 +9,7 @@ binarize_column_using_Pandas_on_CSV_data_op = components.load_component_from_url
split_rows_into_subsets_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/dataset_manipulation/Split_rows_into_subsets/in_CSV/component.yaml")
train_XGBoost_model_on_CSV_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/XGBoost/Train/component.yaml")
xgboost_predict_on_CSV_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/XGBoost/Predict/component.yaml")
upload_XGBoost_model_to_Google_Cloud_Vertex_AI_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/google-cloud/Vertex_AI/Models/Upload_XGBoost_model/component.yaml")
upload_XGBoost_model_to_Google_Cloud_Vertex_AI_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/d5c9918850a6cc70004c4269dae066cfe2e664eb/community-content/pipeline_components/google-cloud/Vertex_AI/Models/Upload_XGBoost_model/component.yaml")
deploy_model_to_endpoint_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/google-cloud/Vertex_AI/Models/Deploy_to_endpoint/component.yaml")
# %% Pipeline definition
@@ -23,7 +23,7 @@ upload_PyTorch_model_archive_to_Google_Cloud_Vertex_AI_op = components.load_comp
# XGBoost
train_XGBoost_model_on_CSV_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/XGBoost/Train/component.yaml")
xgboost_predict_on_CSV_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/XGBoost/Predict/component.yaml")
upload_XGBoost_model_to_Google_Cloud_Vertex_AI_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/google-cloud/Vertex_AI/Models/Upload_XGBoost_model/component.yaml")
upload_XGBoost_model_to_Google_Cloud_Vertex_AI_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/d5c9918850a6cc70004c4269dae066cfe2e664eb/community-content/pipeline_components/google-cloud/Vertex_AI/Models/Upload_XGBoost_model/component.yaml")
# Scikit-learn
#train_linear_regression_model_using_scikit_learn_from_CSV_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/1f5cf6e06409b704064b2086c0a705e4e6b4fcde/community-content/pipeline_components/ML_frameworks/Scikit_learn/Train_linear_regression_model/from_CSV/component.yaml")
@@ -8,7 +8,7 @@ fill_all_missing_values_using_Pandas_on_CSV_data_op = components.load_component_
split_rows_into_subsets_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/dataset_manipulation/Split_rows_into_subsets/in_CSV/component.yaml")
train_XGBoost_model_on_CSV_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/XGBoost/Train/component.yaml")
xgboost_predict_on_CSV_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/XGBoost/Predict/component.yaml")
upload_XGBoost_model_to_Google_Cloud_Vertex_AI_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/google-cloud/Vertex_AI/Models/Upload_XGBoost_model/component.yaml")
upload_XGBoost_model_to_Google_Cloud_Vertex_AI_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/d5c9918850a6cc70004c4269dae066cfe2e664eb/community-content/pipeline_components/google-cloud/Vertex_AI/Models/Upload_XGBoost_model/component.yaml")
deploy_model_to_endpoint_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/google-cloud/Vertex_AI/Models/Deploy_to_endpoint/component.yaml")
# %% Pipeline definition
@@ -22,7 +22,7 @@ upload_PyTorch_model_archive_to_Google_Cloud_Vertex_AI_op = components.load_comp
# XGBoost
train_XGBoost_model_on_CSV_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/XGBoost/Train/component.yaml")
xgboost_predict_on_CSV_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/XGBoost/Predict/component.yaml")
upload_XGBoost_model_to_Google_Cloud_Vertex_AI_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/google-cloud/Vertex_AI/Models/Upload_XGBoost_model/component.yaml")
upload_XGBoost_model_to_Google_Cloud_Vertex_AI_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/d5c9918850a6cc70004c4269dae066cfe2e664eb/community-content/pipeline_components/google-cloud/Vertex_AI/Models/Upload_XGBoost_model/component.yaml")
# Scikit-learn
train_linear_regression_model_using_scikit_learn_from_CSV_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/1f5cf6e06409b704064b2086c0a705e4e6b4fcde/community-content/pipeline_components/ML_frameworks/Scikit_learn/Train_linear_regression_model/from_CSV/component.yaml")
@@ -1,5 +1,5 @@
absl-py==1.1.0
fastapi==0.75.2
fastapi==0.109.1
uvicorn==0.18.2
timm==0.5.4
smart_open==6.0.0
@@ -64,8 +64,8 @@ implementation:
labels["component-source"] = "github-com-ark-kun-pipeline-components"
# The serving container decides the model type based on the model file extension.
# So we need to rename the mode file (e.g. /tmp/inputs/model/data) to *.pkl
_, renamed_model_path = tempfile.mkstemp(suffix=".pkl")
# So we need to rename the mode file (e.g. /tmp/inputs/model/data) to *.bst
_, renamed_model_path = tempfile.mkstemp(suffix=".bst")
shutil.copyfile(src=model_path, dst=renamed_model_path)
model = aiplatform.Model.upload_xgboost_model_file(
@@ -87,7 +87,7 @@ outputs:
- {name: image_size_path, type: HeightWidth}
implementation:
container:
image: us-docker.pkg.dev/vertex-ai/ready-to-go-image-classification/image-components:v0.1
image: us-docker.pkg.dev/vertex-ai/ready-to-go-image-classification/image-components:v0.2
# command is a list of strings (command-line arguments).
# The YAML language has two syntaxes for lists and you can use either of them.
# Here we use the "flow syntax" - comma-separated strings inside square brackets.
@@ -109,4 +109,4 @@ implementation:
{inputValue: l2_regularization_penalty},
--image-size-path,
{outputPath: image_size_path},
]
]
@@ -34,7 +34,7 @@ outputs:
path for the validation data,'}
implementation:
container:
image: us-docker.pkg.dev/vertex-ai/ready-to-go-image-classification/image-components:v0.1
image: us-docker.pkg.dev/vertex-ai/ready-to-go-image-classification/image-components:v0.2
# command is a list of strings (command-line arguments).
# The YAML language has two syntaxes for lists and you can use either of them.
# Here we use the "flow syntax" - comma-separated strings inside square brackets.
@@ -55,7 +55,7 @@ outputs:
for the saved model,'}
implementation:
container:
image: us-docker.pkg.dev/vertex-ai/ready-to-go-image-classification/image-components:v0.1
image: us-docker.pkg.dev/vertex-ai/ready-to-go-image-classification/image-components:v0.2
# command is a list of strings (command-line arguments).
# The YAML language has two syntaxes for lists and you can use either of them.
# Here we use the "flow syntax" - comma-separated strings inside square brackets.
@@ -20,7 +20,7 @@ outputs:
path for the TFRecord image data}
implementation:
container:
image: us-docker.pkg.dev/vertex-ai/ready-to-go-image-classification/image-components:v0.1
image: us-docker.pkg.dev/vertex-ai/ready-to-go-image-classification/image-components:v0.2
# command is a list of strings (command-line arguments).
# The YAML language has two syntaxes for lists and you can use either of them.
# Here we use the "flow syntax" - comma-separated strings inside square brackets.
@@ -22,7 +22,7 @@ outputs:
path for the TFRecord image data}
implementation:
container:
image: us-docker.pkg.dev/vertex-ai/ready-to-go-image-classification/image-components:v0.1
image: us-docker.pkg.dev/vertex-ai/ready-to-go-image-classification/image-components:v0.2
# command is a list of strings (command-line arguments).
# The YAML language has two syntaxes for lists and you can use either of them.
# Here we use the "flow syntax" - comma-separated strings inside square brackets.
@@ -1,4 +1,4 @@
google-cloud-bigquery==2.20.0
tensorflow==2.7.2
pillow==9.0.1
pillow==10.3.0
tf-agents==0.8.0
@@ -1,4 +1,4 @@
google-cloud-pubsub==2.5.0
pillow==9.0.1
pillow==10.3.0
tf-agents==0.8.0
tensorflow==2.7.2
@@ -1,5 +1,5 @@
dataclasses==0.6
google-cloud-aiplatform==1.8.1
tensorflow==2.7.2
pillow==9.0.1
pillow==10.3.0
tf-agents==0.8.0
@@ -0,0 +1,15 @@
# Vertex AI custom prediction routines samples
## Overview
Vertex Custom Prediction Routines(CPR) simplify the process of building custom containers
and make local model testing easy. Here are the sameple codes for different libraries.
### Objectives
The objective is to provide various samples for Vertex Custom Prediction Routine(CPR).
### Supporting libraries
* torch
* sklearn
* xgboost
@@ -0,0 +1,73 @@
import ast
import json
import os
import pickle
import torch
from google.cloud.aiplatform.utils import prediction_utils
from google.cloud.aiplatform.prediction.predictor import Predictor
from transformers import AutoModelForQuestionAnswering
from typing import Dict, List
class TorchTransformersPredictor(Predictor):
def __init__(self):
return
def load(self, artifacts_uri: str) -> None:
prediction_utils.download_model_artifacts(artifacts_uri)
if os.path.isfile("setup_config.json"):
with open("setup_config.json") as setup_config_file:
self.setup_config = json.load(setup_config_file)
if os.path.exists("model.pt"):
self.model = AutoModelForQuestionAnswering.from_pretrained("model.pt")
self.model.eval()
else:
raise ValueError("One of the following model files must be provided: model.pt.")
def preprocess(self, prediction_input: dict) -> torch.Tensor:
max_length = self.setup_config["max_length"]
instances = prediction_input["instances"]
question_context = ast.literal_eval(instances)
question = question_context["question"]
context = question_context["context"]
inputs = self.tokenizer.encode_plus(
question,
context,
max_length=int(max_length),
pad_to_max_length=True,
add_special_tokens=True,
return_tensors="pt",
)
input_ids = inputs["input_ids"]
attention_mask = inputs["attention_mask"]
return torch.Tensor(input_ids, attention_mask)
@torch.inference_mode()
def predict(self, instances: torch.Tensor) -> List[str]:
input_ids, attention_mask = instances
outputs = self._model(input_ids, attention_mask)
answer_start_scores = outputs.start_logits
answer_end_scores = outputs.end_logits
num_rows, num_cols = answer_start_scores.shape
inferences = []
for i in range(num_rows):
answer_start_scores_one_seq = answer_start_scores[i].unsqueeze(0)
answer_start = torch.argmax(answer_start_scores_one_seq)
answer_end_scores_one_seq = answer_end_scores[i].unsqueeze(0)
answer_end = torch.argmax(answer_end_scores_one_seq) + 1
prediction = self.tokenizer.convert_tokens_to_string(
self.tokenizer.convert_ids_to_tokens(
input_ids[i].tolist()[answer_start:answer_end]
)
)
inferences.append(prediction)
return inferences
def postprocess(self, prediction_results: List[str]) -> Dict:
return {"predictions": prediction_results}
@@ -0,0 +1,4 @@
[MASTER]
generated-members=get_concrete_function,cv2.*
ignored-modules=tensorflow,google.cloud
Binary file not shown.

After

Width:  |  Height:  |  Size: 472 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

@@ -0,0 +1,253 @@
# ViT PyTorch vs JAX training benchmarks on Vertex AI Training Platform
Lav Rai, Software Engineer, Google Cloud
Xiang Xu, Software Engineer, Google Cloud
Andreas Steiner, Software Engineer, Google DeepMind
Tao Wang, Software Engineer, Google DeepMind
Alexander Kolesnikov, Research Engineer, Google DeepMind
## Introduction
Many repositories now offer both PyTorch and JAX versions of a model. For
example, [Hugging Face offers many models such as GPT2, BERT][1]
etc. Other examples are [OpenLLaMa][2] and [ViT][3]
models which were first developed in JAX and then their corresponding PyTorch
versions were made available. **Given both the PyTorch and JAX options for a
model, it may not be obvious as to which option to choose**. To make such a
decision, it is important for one to know about the training cost, effectiveness
and efficiency for each choice.
Apart from the framework choice, the other choice that one faces on Vertex AI
training platform is the type and count of the accelerators. Although the
[Vertex AI pricing table][4] lists the price per hour for each
machine, **one may not know beforehand about the training speed of JAX and
PyTorch frameworks for different types and count of the accelerators**.
If one has access to some training benchmark numbers for the same model
under (a) PyTorch and JAX frameworks and (b) for different types and count of
the accelerators, then it will be easier for them to make a cost effective
decision. Such a benchmark will also aid the developers in identifying strength
and weakness of different choices and then figure out recipes to remove those
weaknesses if possible.
This blog uses the ViT [classification models][5] of varying sizes
to benchmark the training performance of PyTorch and JAX versions on the Vertex
AI Platform under different machine configurations. The goal is to:
- Benchmark OSS ViT training for both PyTorch and JAX frameworks.
- Benchmark OSS ViT L16, H14, g14, and G14 models.
- Benchmark OSS ViT PyTorch training with A100 GPUs.
- Benchmark OSS ViT JAX training with A100 GPUs and TPU V3 accelerators.
## Benchmarking setup
This section lays out the benchmarking set up for the [PyTorch][6] and [JAX][7]
frameworks and provides a reasoning for choosing those settings.
### PyTorch GPU
#### Machine configuration
We run training jobs on [Vertex AI Custom Training][8] using 1
single node with 8 A100-40GB GPUs.
- Machine type: [a2-highgpu-8g][9]
- Machine count: 1
- Accelerator type: [NVIDIA_TESLA_A100 (40GB)][10]
- Accelerator count: 8
#### Modeling
We benchmark 4 variants of ViT model in different sizes:
- [ViT-L16, 300M params][11]
- [ViT-H14, 630M params][12]
- [ViT-g14, 1B params][13]
- [ViT-G14, 1.8B params][14]
We use the Huggingface [transformers library][15] for ViT L16 and
H14 variants, and the [TIMM library][16] for ViT g14 and G14
variants.
#### Dataset
We run training against the [cifar10][17] dataset with 50K training
images and 10K test images. To factor out network communication overhead for
data loading, we copy the whole dataset to the local disk then load data from
the local disk during training.
#### Training parameters
- Trainer
- We use [PyTorch Lightning][18] as the trainer for the
boilerplate data loading and train loop coding.
- Precision
- Float16
- Input resolution
- 224 x 224
- Strategy
- We use [DDP][19] for models which can be entirely loaded to one
GPU, use [Deepspeed-ZeRO][20] otherwise:
- ViT-L16: DDP
- ViT-H14: DDP
- ViT-g14: DDP
- ViT-G14: Deepspeed-ZeRO stage-3
- Batch size
- We use the max batch size as power of 2 without CUDA OOM for each model:
- ViT-L16: 64 per GPU
- ViT-H14: 16 per GPU
- ViT-g14: 16 per GPU
- ViT-G14: 32 per GPU
- Compilation
- We apply [torch.compile][21] to model whenever it's applicable:
- ViT-L16: torch.compile
- ViT-H14: torch.compile
- ViT-g14: torch.compile
- ViT-G14: N/A
### JAX TPU and GPU
#### Machine configuration
All the TPU and GPU training jobs are run on [Vertex AI Custom
Training][8]. The following machine configurations were used for the
TPU and GPU experiments:
**Note**: TPU V3 POD requires multi-host supporting training code. For example,
a 32 core POD runs on 4 hosts with each host using 8 cores.
**Note**: 8 A100 are similar to TPU V3 32 cores in terms of [Vertex AI
pricing][4].
**Note**: [Each TPU v3 chip has 2 cores which can use 32 GB high-bandwidth
memory][22] (16 GB per core) so total memory for 32 cores is 16x32 =
512 GB. Therefore for the same price, TPUs offer more memory than 8 A100-40GB
GPUs.
#### Modeling
We decided to use an OSS code repository for model implementation. Using an OSS
repository helps anyone to independently verify the benchmarking results and
also relate to the results well. For JAX, we selected the
[Big Vision][23] code repository.
Same as the PyTorch modeling, we benchmark 4 variants of ViT model in different
sizes:
- [ViT-L16, 300M params][24]
- [ViT-H14, 630M params][24]
- [ViT-g14, 1B params][24]
- [ViT-G14, 1.8B params][24]
**Note**: The [Big Vision code repo][23] has not made the
checkpoints publicly available for the models larger than the ViT-L16. Therefore
for the rest of the three variants, the experiments only used random
initialization for benchmarking the training speed.
#### Dataset
We use training against the [cifar10 TensorFlow dataset][25] with
50K training images and 10K test images. This dataset is the same as the one
used for PyTorch experiments except that it is loaded as a TensorFlow dataset.
Similar to the PyTorch experiments, we copy the whole dataset to the docker
image to factor out network communication overhead for data loading.
#### Training parameters
- Precision
- "bfloat16" setting was used.
- Input resolution
- 224 x 224 after resize (to 448x448) and random crop (to 224x224) before
training.
- This resolution for training was the same as the PyTorch settings.
- Strategy
- Used DDP for all models except ViT-G14. ViT-G14 used the FSDP strategy.
- Batch size
- We use the max batch size as power of 2 without OOM for each model. The
[Benchmarking results][26] section shows the final
batch size for each experiment.
- Once a maximum batch-size for TPU V3 8 cores was determined, we just scaled
it linearly for 32 cores.
- Once a maximum batch-size for 1 A100 GPU was determined, we just scaled it
linearly for 8 A100 GPUs.
- Compilation
- [jax.jit() compilation][27] is used in JAX codes for efficient
execution in XLA.
- GPU related flags
- The following flags are set in the dockerfile for the GPU runs.
- Note: _xla_gpu_enable_pipelined_collectives_ is set to false for the
ViT-G14 FSDP run.
### Evaluation metric
For both the PyTorch and JAX experiments, the following evaluation metrics are
collected:
- Throughput: Images-per-second observed for training.
- Cost: The training-cost-per-epoch (USD).
**Note**: The above metrics are not biased against any framework or machine
configurations. In addition, these metrics will help one decide the most
efficient training configurations on Vertex AI.
## Benchmarking results
The lowest cost experiment for each model is marked in **bold** in the last
column.
![vit_benchmarking_table](images/vit_benchmarking_table.png)
The following bar charts summarize the performance visually:
![vit_training_time](images/vit_training_time.png)
![vit_training_cost](images/vit_training_cost.png)
The following section provides observations and conclusions for these results.
## Observation and Conclusions
- Training with JAX TPU V3 POD with 32 cores costs 33% less than the PyTorch GPU
8 A100-40GBs runs.
- Training with JAX GPU 8 A100-40GBs costs 23% less than the PyTorch GPU 8
A100-40GBs runs.
- JAX TPU V3 POD with 32 cores was 4x faster and slightly more cost-effective
than the JAX TPU V3 8 core run for the ViT-large model. This indicates that it
might be better to use more cores. The JAX TPU V3 speed scales very well with
the number of cores.
- Cloud TPU VM training speed numbers were the same as the Vertex AI for
TPU V3 8 cores. The dataset was copied to the docker in both the cases.
- The training-cost-per-epoch increases with the model size irrespective of the
framework.
[1]: https://github.com/huggingface/transformers/blob/main/examples/research_projects/jax-projects/README.md#quickstart-flax-and-jax-in-transformers
[2]: https://github.com/openlm-research/open_llama
[3]: https://github.com/google-research/vision_transformer
[4]: https://cloud.google.com/vertex-ai/pricing#custom-trained_models
[5]: https://arxiv.org/abs/2010.11929
[6]: #pytorch-gpu
[7]: #jax-tpu-and-gpu
[8]: https://cloud.google.com/vertex-ai/docs/training/overview
[9]: https://cloud.google.com/vertex-ai/docs/training/configure-compute#machine-types
[10]: https://cloud.google.com/vertex-ai/docs/training/configure-compute#specifying_gpus
[11]: https://huggingface.co/google/vit-large-patch16-224-in21k
[12]: https://huggingface.co/google/vit-huge-patch14-224-in21k
[13]: https://github.com/huggingface/pytorch-image-models/blob/v0.9.2/timm/models/vision_transformer.py#L1308
[14]: https://github.com/huggingface/pytorch-image-models/blob/v0.9.2/timm/models/vision_transformer.py#L1312
[15]: https://huggingface.co/docs/transformers/main/model_doc/vit#transformers.ViTModel
[16]: https://github.com/huggingface/pytorch-image-models
[17]: https://huggingface.co/datasets/cifar10
[18]: https://lightning.ai/docs/pytorch/stable/
[19]: https://pytorch.org/docs/stable/notes/ddp.html
[20]: https://www.deepspeed.ai/tutorials/zero/
[21]: https://pytorch.org/tutorials/intermediate/torch_compile_tutorial.html
[22]: https://cloud.google.com/tpu/docs/system-architecture-tpu-vm#tpu_v3
[23]: https://github.com/google-research/big_vision
[24]: https://screenshot.googleplex.com/BximJgxsgvBVu38
[25]: https://www.tensorflow.org/datasets/catalog/cifar10
[26]: #benchmarking-results
[27]: https://jax.readthedocs.io/en/latest/jax-101/02-jitting.html
@@ -0,0 +1,227 @@
# Benchmark report on fine tuning the OpenLLaMA 7B model on Google Cloud Vertex Model Garden
Gary Wei, Software Engineer, Google Cloud
Dustin Luong, Software Engineer, Google Cloud
Changyu Zhu, Software Engineer, Google Cloud
Genquan Duan, Software Engineer, Google Cloud
## Introduction
Fine-tuning of LLMs can be non-trivial to find an optimal configuration of
machine types, training parameters, and other hyperparameters that achieves a
good balance between cost efficiency and model performance. To facilitate users
in conducting tuning experiments, this report benchmarks OpenLLaMA 7B
fine-tuning on Google Cloud Vertex Model Garden, demonstrating both efficiency
and effectiveness. The observations are general and can be applied to other LLM
models.
We benchmarked fine tuning algorithms [LoRA](https://arxiv.org/abs/2106.09685)
and [QLoRA](https://arxiv.org/abs/2305.14314) supported by
[huggingface PEFT libraries](https://github.com/huggingface/peft). LoRA, short
for Low-Rank Adaptation of Large Language Models, is an improved fine tuning
method where instead of fine tuning all the weights that constitute the weight
matrix of the pre-trained large language model, two smaller matrices that
approximate this larger matrix are fine-tuned. QLoRA is an even more
memory-efficient version of LoRA, where the pretrained model is loaded to GPU
memory as quantized 4-bit weights, while preserving similar effectiveness to
LoRA. We also provide simple scripts and parameter settings to reproduce the
results reported in this report.
In general, there are many factors that affect the performance of fine-tuning
experiments, such as hardware settings, parameters, cost, and accuracy. It is
impractical to obtain benchmarks for all possible combinations of these factors.
Instead, we focus on tuning a subset of related parameters and evaluating their
impact on a set of chosen metrics. The evaluation metrics are GPU memory usage,
percentage of parameters tuned, tuning speed, cost, and accuracy. The tuning
parameters are batch size, lora rank, maximum sequence length, and maximum
training steps.
## Key takeaways
- **Use QLoRA to minimize the peak GPU requirements**: The QLoRA can
significantly reduce the peak GPU memory usage by ~75% compared to LoRA. For
OpenLLaMA7b, the peak memory is ~28G for LoRA and ~7G for QLoRA.
- **Use LoRA to maximize the tuning speed and minimize the tuning cost**: LoRA
is ~66% faster than QLoRA in fine tuning speed. LoRA/QLoRA tuning cost is
low generally, while LoRA is even ~40% cheaper than QLoRA with the same
parameters. Suggest to use QLoRA for limited GPU memories, and LoRA for
limited training budgets. For OpenLLaMA7b, the tuning speed for LoRA/QLoRA
~5 samples / 3 samples per second, and the tuning cost for LoRA/QLoRA in 500
steps is ~$1/$1.7 on `a2-highgpu-1g` with 1 A100 40G GPU. The tuning cost
for QLoRA in 500 steps is $6.75 on n1-standard-8 with 1 V100 GPU, while LoRA
could not run because of OOM.
- **Use QLoRA to tune models with large sequence lengths**. For OpenLLaMA7b,
the max sequence length for QLoRA can be 2048 when consuming 16.3G GPU,
while the max sequence length for LoRA is 512 when consuming 28.2G GPU, and
encounter OOM when max sequence length is 1024.
- **Both LoRA and QLoRA give similar accuracy improvement after fine tuning.**
For OpenLLaMA7b, both LoRA/QLoRA can improve the average accuracy by ~4%
evaluating on 3 typical tasks (ARC challenge, HellaSwag and TruthfulQA),
after training 1875 steps on dataset
[timdettmers/openassistant-guanaco](https://huggingface.co/datasets/timdettmers/openassistant-guanaco).
- **Use a big batch size if GPU memory is not a constraint**. For OpenLLaMA7b
with other default parameters, we suggest using a batch size as 24 for
QLoRA, but 2 for LoRA when tuning with 1 A100 40G. We also suggest using a
batch size as 8 for QLoRA when tuning with 1 V100. Tuning with LoRA and
batch size as 1 got OOM and we don't recommend tuning LoRA with 1 V100.
## Benchmark Details
### Experiment Setup
The benchmark dataset is
[timdettmers/openassistant-guanaco](https://huggingface.co/datasets/timdettmers/openassistant-guanaco).
The training dataset is directly downloaded from hugging face to the VM, before
every experiment.
The default tuning parameters during benchmark are:
- Host VM: a2-highgpu-1g
- Accelerator type: 1 A100 40G
- batch size: 2
- lora_rank: 16
- max_seq_length: 512
- precision_mode: float16
- max_train_steps: 500
For simplicity, we set the precision mode to `float16` when tuning LoRA models,
and set the precision to `4bit` for QLoRA.
Sample script to start fine tuning dockers in a VM on GCP.
```shell
IMAGE_TAG=us-docker.pkg.dev/vertex-ai/vertex-vision-model-garden-dockers/pytorch-peft-train:latest
docker run --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=0 \
--rm --name "test_gpu" -it --pull=always ${IMAGE_TAG} \
--task=instruct-lora \
--pretrained_model_id=openlm-research/open_llama_7b \
--dataset_name="timdettmers/openassistant-guanaco" \
--instruct_column_in_dataset="text" \
--precision_mode="float16" \
--output_dir=<OUTPUT DIR> \
--lora_rank=2 \
--max_sequence_length=512 \
--learning_rate=2e-4 \
--max_steps=50
```
### GPU Memory
In this benchmark, we investigated the impact of batch size, lora rank, and
maximum sequence length on GPU memory, and then made recommendations on the
maximum batch size for different GPUs.
#### Peak GPU memory by batch size (GB)
<img src="images/openllama_7b_fine_tune_benchmark_report/openllama-7b-peak-gpu-vs-batch-size.png" width="600">
- The QLoRA can significantly reduce the peak GPU memory usage by ~75%
compared to LoRA. The peak GPU memory is ~28G for LoRA and ~7G for QLoRA
when batch size is 2.
- QLoRA can support much larger batch sizes than LoRA
- We can use a batch size as 32 for QLoRA, but only 2 for LoRA on 1 A100
40G.
- We can use a batch size of 8 for QLoRA on 1 V100 GPU. LoRA will fail
with OOM even with a batch size of 1.
#### Peak GPU memory by LoRA rank (GB)
<img src="images/openllama_7b_fine_tune_benchmark_report/openllama-7b-peak-gpu-vs-lora-rank.png" width="600">
- Peak GPU memories are quite similar for different LoRA ranks for both
LoRA/QLoRA.
- The peak GPU memory increasing percentages are very small generally when
LoRA rank increases.
- The peak GPU memory increases from 28G with LoRA rank 4 to 29.09G with
LoRA rank 64, and the increasing percentage is only ~3.9%.
#### Peak GPU memory by max sequence length for LoRA/QLoRA (GB)
<img src="images/openllama_7b_fine_tune_benchmark_report/openllama-7b-peak-gpu-vs-max-seq-length.png" width="600">
- The peak GPU increases quickly when max sequence length increases for both
LoRA/QLoRA, and the increasing rate of LoRA is much faster than QLoRA.
- For LoRA tuning, the GPU memory increased from 20.5G (max sequence
length=256) to 28.2G (max sequence length=512), an increase of ~37%.
- For QLoRA tuning, the GPU memory increased from 6.94G (max sequence
length=256) to 7.57G (max sequence length=512), an increase of ~9%.
- The max sequence length for QLoRA can be 2048 when consuming 16.3G GPU,
while the max sequence length for LoRA is 512 when consuming 28.2G GPU, and
encounter OOM when max sequence length is 1024.
### Fine Tuning Parameters
This section shows the number/percentage of trainable parameters, and the sizes
of the fine tuned models. LoRA and QLoRA differ only in how they represent the
precision of their parameters. The total number of parameters and the number of
trainable parameters are the same for both methods.
| LoRA Rank | Finetuned parameters | Total parameters | Trainable Parameter Percentage | Fine tuned model size (MB) |
| --------- | -------------------- | ---------------- | ------------------------------ | -------------------------- |
| 8 | 2.00E+07 | 6.76E+09 | 0.3% | 76.4 |
| 16 | 4.00E+07 | 6.78E+09 | 0.6% | 152.65 |
| 32 | 8.00E+07 | 6.82E+09 | 1.2% | 305.15 |
| 64 | 1.60E+08 | 6.90E+09 | 2.3% | 610.15 |
LoRA/QLoRA tunes quite a small fraction (only 0.3% with LoRA rank=8) of all
parameters, and the tuned models are very small (only 76.4MB with LoRA rank=8).
### Fine Tuning Speed And Costs
The fine-tuning speed and cost are affected by various factors, such as the
GPUs, LoRA ranks, and max sequence lengths.
- LoRA is ~66% faster than QLoRA in fine tuning speed. The tuning speed for
LoRA/QLoRA ~5 samples / 3 samples per second on 1 A100 40G GPU
- Higher LoRA ranks, slower tuning speed for both LoRA/QLoRA.
- LoRA tuning speed reduces from ~5 samples per second with LoRA rank as 8
to ~4 samples per second with LoRA rank as 64, slowed down by 20%.
- QLoRA tuning speed reduces from ~3 samples per second with LoRA rank as
8 to ~2.5 samples per second with LoRA rank as 64, slowed down by 17%.
<img src="images/openllama_7b_fine_tune_benchmark_report/openllama-7b-tune-speed-vs-lora-rank.png" width="600">
- Longer sequence lengths, slower tuning speed.
- LoRA tuning speed reduces from ~5.56 samples per second with max
sequence length as 256 to ~4.84 samples per second with max sequence
length as 512 slowed down by 13%.
- LoRA tuning speed reduces from ~2.95 samples per second with max
sequence length as 256 to ~2.88 samples per second with max sequence
length as 512 slowed down by ~2.4%.
<img src="images/openllama_7b_fine_tune_benchmark_report/openllama-7b-tune-speed-lora-qlora.png" width="600">
- LoRA/QLoRA tuning cost is low generally, while LoRA is even ~40% cheaper
than QLoRA with the same parameters.
- The LoRA/QLoRA fine tuning cost for 500 steps is ~$1/$1.7 on 1 A100 40G.
- The tuning cost for QLoRA in 500 steps is $6.75 on n1-standard-8 with 1
V100 GPU, while LoRA could not run because of OOM.
<img src="images/openllama_7b_fine_tune_benchmark_report/openllama-7b-tune-cost-lora-qlora.png" width="600">
### Accuracy
We fine tuned Open Llama 7B model with
[timdettmers/openassistant-guanaco](https://huggingface.co/datasets/timdettmers/openassistant-guanaco),
and report accuracy similar to the
[HuggingFace leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard)
using
[Eleuther AI Language Model Evaluation Harness](https://github.com/EleutherAI/lm-evaluation-harness).
[HuggingFace leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard)
mainly compares models on ARC, HellaSwag, MMLU, and TruthfulQA. The authors did
not publish OpenLLaMA 7B on MMLU
([link](https://huggingface.co/openlm-research/open_llama_7b)). Therefore, we
only benchmark accuracies on ARC, HellaSwag, and TruthfulQA.
| | Mean | ARC | HellaSwag | TruthfulQA | Tuning Parameters |
| ------------------------------------------------------------ | ---- | ---- | --------- | ---------- | ------------------------------------------------------------ |
| OpenLLaMA7B ([Original Report](https://huggingface.co/openlm-research/open_llama_7b)) | 0.49 | 0.41 | 0.73 | 0.34 | n/a |
| OpenLLaMA7B ([Re-run with lm-evaluation-harness](https://github.com/EleutherAI/lm-evaluation-harness)) | 0.51 | 0.47 | 0.72 | 0.35 | n/a |
| OpenLLaMA7B+LoRA | 0.56 | 0.48 | 0.74 | 0.45 | LoRA Rank=16; Max Sequence Length=512;Learning Rate=1e-4; Train steps=1875 |
| OpenLLaMA7B+QLoRA | 0.53 | 0.45 | 0.73 | 0.42 | LoRA Rank=16; Max Sequence Length=512; Learning Rate=1e-4; Train steps=1875 |
- The base OpenLLaMA7B model gets better performance (2%) when using the
[Eleuther AI Language Model Evaluation Harness](https://github.com/EleutherAI/lm-evaluation-harness).
- LoRA/QLoRA can improve the performance by ~2-4% when trained for 1875 steps
with learning rate 1e-4.
@@ -0,0 +1,188 @@
# Benchmark report on hyperparameter tuning the OpenLLaMA models on Google Cloud Vertex Model Garden
Changyu Zhu, Software Engineer, Google Cloud
Dustin Luong, Software Engineer, Google Cloud
Gary Wei, Software Engineer, Google Cloud
Genquan Duan, Software Engineer, Google Cloud
## Introduction
Fine-tuning of LLMs can be non-trivial to find an optimal configuration of
machine types, training parameters, and other hyperparameters that achieves a
good balance between cost efficiency and model performance. To facilitate users
in conducting tuning experiments, this report benchmarks fine-tuning OpenLLaMA
models with [Vertex AI Hyperparameter Tuning Service](https://cloud.google.com/vertex-ai/docs/training/hyperparameter-tuning-overview), demonstrating both efficiency
and effectiveness. Similar hyperparameter tuning techniques can apply to other models as well.
## Key takeaways
- **The hyperparameter tuning service finds good parameters**: The best model found by the hyperparameter tuning service has an average improvement of around 4% in accuracy in *ARC*, *HellaSwag*, and *TruthfulQA* datasets, while only tuning the learning rate.
- **Hyperparameter tuning works with QLoRA on limited resources**: 4bit QLoRA is sufficient for hyperparameter tuning to find a set of good parameters. In this way, all OpenLLaMA models can run on 1 single `NVIDIA_L4` GPU. It is also possible to train for more steps on the good parameters discovered by hyperparameter tuning, avoiding the waste of computing resources on fine-tuning with suboptimal hyperparameters.
- **Hyperparameter tuning is cost-effective**: While `NVIDIA_L4` is slower than `NVIDIA_TESLA_V100`, it costs less and avoids the overhead of multi-GPU training since it has more GPU memory. Finding a good 3B/7B/13B OpenLLaMA model costs $28.5671, $47.8016, and $87.9208, respectively.
## Benchmarking setup
This section describes the experiment setup of the hyperparameter tuning experiments. The default tuning parameters are:
### Machine configuration
- Machine type: g2-standard-8
- Machine count: 1
- Accelerator type: NVIDIA_L4
- Accelerator count: 1
### Modeling
We benchmark all 3 OpenLLaMA models:
- [open_llama_3b](https://huggingface.co/openlm-research/open_llama_3b)
- [open_llama_7b](https://huggingface.co/openlm-research/open_llama_7b)
- [open_llama_13b](https://huggingface.co/openlm-research/open_llama_13b)
We use the Huggingface [PEFT](https://github.com/huggingface/peft) library for fine-tuning.
### Training dataset
We use the dataset [timdettmers/openassistant-guanaco](https://huggingface.co/datasets/timdettmers/openassistant-guanaco) loaded directly via Huggingface.
### Training parameters
The set of training parameters used during benchmarking:
- Batch size: 4
- Precision mode: 4bit QLoRA
- LoRA rank: 32
- LoRA alpha: 64
- Max sequence length: 512
- Max train steps: 1000
### Evaluation dataset
We use the [lm-evaluation-harness](https://github.com/EleutherAI/lm-evaluation-harness) library injected into the training loop for evaluation. The hyperparameter tuning job will pick the model according to the evaluation metrics.
- Eval task: [ARC Challenge](https://huggingface.co/datasets/ai2_arc)
- Eval metric: acc_norm
- Max eval examples: 10000
### Standalone evaluation dataset
After finding the best model with Vertex hyperparameter tuning service, we run standalone evaluations with the model on the following datasets:
- [ARC Challenge](https://huggingface.co/datasets/ai2_arc)
- [HellaSwag](https://huggingface.co/datasets/Rowan/hellaswag)
- [TruthfulQA](https://huggingface.co/datasets/EleutherAI/truthful_qa_mc)
### Hyperparameter tuning
We only tune the learning rate hyperparameter. It is considered a floating point value in the continuous range [1e-5, 1e-4]. We run 8 trials in total, with a parallelism of 1 or 2.
### Code example
The following code example launches an example hyperparameter tuning job of OpenLLaMA 7B model.
```py
from google.cloud import aiplatform
from google.cloud.aiplatform import hyperparameter_tuning as hpt
TRAIN_DOCKER_URI = 'us-docker.pkg.dev/vertex-ai/vertex-vision-model-garden-dockers/pytorch-peft-train:20231130_0936_RC00'
output_dir = "gs://path/to/output/dir"
base_model_id = "openlm-research/open_llama_7b"
dataset_name = "timdettmers/openassistant-guanaco"
hpt_precision_mode = "4bit"
machine_type = "g2-standard-8"
accelerator_type = "NVIDIA_L4"
accelerator_count = 1
eval_task = "arc_challenge"
eval_metric_name = "acc_norm"
max_steps = 1000
eval_limit = 10000
flags = {
"learning_rate": 1e-5,
"precision_mode": hpt_precision_mode,
"task": "instruct-lora",
"pretrained_model_id": base_model_id,
"output_dir": output_dir,
"warmup_steps": 10,
"max_steps": max_steps,
"lora_rank": 32,
"lora_alpha": 64,
"lora_dropout": 0.05,
"dataset_name": dataset_name,
"eval_steps": max_steps + 1, # Only evaluates at the end.
"eval_tasks": eval_task,
"eval_limit": eval_limit,
"eval_metric_name": eval_metric_name,
}
worker_pool_specs = [
{
"machine_spec": {
"machine_type": machine_type,
"accelerator_type": accelerator_type,
"accelerator_count": accelerator_count,
},
"replica_count": 1,
"container_spec": {
"image_uri": TRAIN_DOCKER_URI,
"args": ["--{}={}".format(k, v) for k, v in flags.items()],
},
}
]
metric_spec = {"model_performance": "maximize"}
parameter_spec = {
"learning_rate": hpt.DoubleParameterSpec(
min=1e-5, max=1e-4, scale="linear"
),
}
train_job = aiplatform.CustomJob(
display_name=job_name,
worker_pool_specs=worker_pool_specs,
staging_bucket=STAGING_BUCKET,
)
train_hpt_job = aiplatform.HyperparameterTuningJob(
display_name=f"{job_name}_hpt",
custom_job=train_job,
metric_spec=metric_spec,
parameter_spec=parameter_spec,
max_trial_count=8,
parallel_trial_count=2,
)
train_hpt_job.run()
```
## Benchmark results
### Fine-tuning cost
The fine-tuning cost is calculated from `us-central1` pricing and may be subject to changes.
| Model | Train time | Trials | Parallel Trials | Hourly cost | Cost | Eval acc_norm (ARC-Challenge) |
|---------------|------------|--------|-----------------|-------------|----------|-------------------------------|
| OpenLLaMA 3B | 16 hrs | 8 | 2 | $1.7072 | $28.5671 | 39.9% |
| OpenLLaMA 7B | 28 hrs | 8 | 2 | $1.7072 | $47.8016 | 45.8% |
| OpenLLaMA 13B | 103 hrs | 8 | 1 | $0.8536 | $87.9208 | 47.6% |
### Fine-tuning performance
Here are the evaluation results of the best model found by hyperparameter tuning, compared with the baseline model. The column `Eval acc_norm` is calculated during training, which is always lower than that during standalone evaluation, because the model is loaded and evaluated at a lower precision (4bit during training / float16 during standalone evaluation).
| Model | Eval acc_norm (ARC-Challenge) | ARC | hellaswag | Truthfulqa_mc | ∆ARC | ∆Hellaswag | ∆Truthfulqa_mc | ∆Average |
|---------------|-------------------------------|--------|-----------|---------------|--------|------------|----------------|----------|
| OpenLLaMA 3B | 39.9% | 41.47% | 69.97% | 38.31% | +1.62% | +7.32% | +3.34% | +4.09% |
| OpenLLaMA 7B | 45.8% | 49.83% | 75.53% | 41.53% | +2.82% | +3.55% | +6.68% | +4.35% |
| OpenLLaMA 13B | 47.6% | 52.20% | 78.90% | 44.27% | +1.01% | +3.67% | +6.19% | +3.62% |
## Related documents
1. [Benchmark report on fine tuning the OpenLLaMA 7B model on Google Cloud Vertex Model Garden
](
https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/community-content/vertex_model_garden/benchmarking_reports/pytorch_openllama_7b_finetune_benchmark_report.md)
@@ -0,0 +1,218 @@
# Benchmark Stable Diffusion v1-5 Fine Tuning and Serving With Google Cloud Vertex Model Garden
Dustin Luong, Software Engineer, Google Cloud
Gary Wei, Software Engineer, Google Cloud
Changyu Zhu, Software Engineer, Google Cloud
Genquan Duan, Software Engineer, Google Cloud
## Introduction
[The public notebook][1] shows the full examples of fine tuning and serving of Stable diffusion v1-5. [The github repo][2] contains examples of building training and serving dockers for Google Cloud Vertex Model Garden. This report benchmarks Stable diffusion v1-5 fine tuning and serving in Google Cloud Vertex AI, showing both efficiencies and effectiveness.
### Benchmark Highlights
- Fine tuning
- Stable diffusion v1-5 with LoRA and Gradient checkpointing only requires ~10G GPU memory. Larger batch sizes, or larger resolutions require more GPU memories, but not does not change much for different LoRA ranks.
- The fine tuning speed is fast in ~11 minutes for 1k steps, and costs less than $1 in 1 A100. The fine tuning speed increases with batch sizes, decreases with resolution, but is not affected much by LoRA ranks.
- LoRA tunes a few percent (only 0.1% with LoRA rank=8) of all parameters, and the tuned models are very small (only 3.1MB with LoRA rank=8).
- Dreambooth+LoRA and Dreambooth can achieve similar performances, but Dreambooth LoRA can require much less GPU.
- Increasing batch size, reducing training steps, and increasing learning rate can result in models with the same performance for less cost.
- Inference
- The optimized serving docker pytorch-peft-serve can speed up inference by 2x than current pytorch-diffuser-serve, and support both base models and fine tuned lora models.
- The optimized serving docker pytorch-peft-serve can generate 4 512*512 images in 4.1 seconds on 1 V100 and 1.7 seconds on 1 A100.
Benchmark details are below.
## Fine Tuning Benchmarks
### Experiment Setup
We mainly compare two tuning algorithms:
- parameter efficient finetuning based on [dreambooth][3] and [LoRA][4] (shorten as Dreambooth+LoRA below)
- full parameter fine tuning based on [dreambooth][3] (shorten as Dreambooth below)
And then report benchmark results on GPU memories, tuning parameters, tuning speeds, costs and accuracy, using the public oxford flowers dataset: [train][5] and [test][6], where the column blip_caption as texts, and column image as images. We also benchmark subject and prompt fidelity using the [dataset][7] from the Dreambooth paper.
The default tuning parameters during benchmark are:
- Hardware: 1 A100 40G
- batch size: 4
- lora_rank: 8
- resolution: 512
- max_train_steps: 10
- use_lora: False
- gradient_checkpointing: False
```
# Examples to start finetuning dockers.
MODEL_NAME="runwayml/stable-diffusion-v1-5"
OUTPUT_DIR=<OUTPUT_DIR>
INSTANCE_DATA_DIR=<INSTANCE_DATA_DIR>
INSTANCE_PROMPT=<INSTANCE_PROMPT>
IMAGE="us-docker.pkg.dev/vertex-ai/vertex-vision-model-garden-dockers/pytorch-peft-train"
docker run \
--runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=0 \
--rm --name "test_gpu" \
-it ${IMAGE} \
--task=text-to-image-dreambooth-lora-peft \
--pretrained_model_name_or_path=$MODEL_NAME \
--resolution=512 \
--instance_data_dir=$INSTANCE_DATA_DIR \
--instance_prompt=$INSTANCE_PROMPT \
--train_batch_size=4 \
--max_train_steps=10 \
--output_dir=${OUTPUT_DIR} \
--use_lora \
--lora_r=8 \
--gradient_checkpointing
```
### GPU Memories
Many various factors will impact GPU memory usages. In this benchmark, we mainly benchmark with different finetuning algorithms, batch sizes, lora rank, resolution, and then recommended max batch size on different GPUs.
![sd_v1-5_peak_gpu_algorithm](images/stable_diffusion_v1-5_benchmarking_report/sd_v1-5_peak_gpu_algorithm.png)
![sd_v1-5_peak_gpu_batch_size](images/stable_diffusion_v1-5_benchmarking_report/sd_v1-5_peak_gpu_batch_size.png)
![sd_v1-5_peak_gpu_lora_rank](images/stable_diffusion_v1-5_benchmarking_report/sd_v1-5_peak_gpu_lora_rank.png)
![sd_v1-5_peak_gpu_resolution](images/stable_diffusion_v1-5_benchmarking_report/sd_v1-5_peak_gpu_resolution.png)
- LoRA tuning reduced about 47% peak RAM and 42% peak VRAM for GPU memory, compared to full parameter fine tuning.
- Gradient checkpointing decreases about 1% peak RAM and 31% peak VRAM for GPU memory further, compared without gradient checkpointing.
- The GPU memory does not change much for different LoRA ranks.
- Larger batch sizes require more GPU memories.
- Larger resolutions require more GPU memories.
- Dreambooth+LoRA+Gradient_Checkpointing can support max batch size as 32, or max resolution as 2048, but Dreambooth can only support max batch size as 8, or max resolution as 1024.
### Fine Tuning Parameters
This section shows the percentage of trainable parameters, and tuned model sizes.
- LoRA tunes quite a few percent (only 0.1% with LoRA rank=8) of all parameters, and the tuned models are very small (only 3.1MB with LoRA rank=8).
| LoRA Rank | Trainable parameters | Total parameters | Trainable Parameter Percentage | Fine tuned model size (MB) |
|---|---|---|---|---|
| 4 | 398592 | 859919556 | 0.05% | 1.57 |
|8 | 797184 | 860318148 | 0.09% | 3.09 |
| 16 | 1594368| 861115332| 0.19%| 6.13|
| 32| 3188736| 862709700| 0.37%| 12.21|
### Fine Tuning Speed And Costs
Fine tuning speeds and costs are affected by many different factors, such as batch size, tuning parameters, image resolutions, GPUs, and datasets. In order to make the report easy to understand, we set the following values in this section:
- Hardware: 1 A100 40G
- use_lora: True
- gradient_checkpointing: True
![sd_v1-5_training_speed_batch_size](images/stable_diffusion_v1-5_benchmarking_report/sd_v1-5_training_speed_batch_size.png)
![sd_v1-5_training_speed_lora_rank](images/stable_diffusion_v1-5_benchmarking_report/sd_v1-5_training_speed_lora_rank.png)
![sd_v1-5_training_speed_resolution](images/stable_diffusion_v1-5_benchmarking_report/sd_v1-5_training_speed_resolution.png)
![sd_v1-5_training_cost_max_steps](images/stable_diffusion_v1-5_benchmarking_report/sd_v1-5_training_cost_max_steps.png)
- The fine tuning speed increases with batch sizes, decreases with resolution, but is not affected much by LoRA ranks.
- The fine tuning speed is about 11 minutes for 1k steps, and costs less than $1 in 1 A100.
### Fine Tuning Quality
In this benchmark, we mainly benchmark Dreambooth and Dreambooth+LoRA to compare fine tuning quality. We compare [subject fidelity scored (DINO)][8], how well the subject is represented in the generated images, and [prompt fidelity scores (CoCa)][9], how well the generated images match the given prompt, for a single subject, a [dog][10] from the dataset released with the original Dreambooth paper. In practice, we recommend saving checkpoints periodically and inspecting validation prompts visually. We fine tuned the unet without fine tuning the text encoder and used the following hyperparameters:
Dreambooth
- Learning rate: 5e-6
- Batch size: 1
Dreambooth+LoRA
- Learning rate: 1e-4
- Batch size: 1
![sd_v1-5_finetuning_quality_subject_fidelity](images/stable_diffusion_v1-5_benchmarking_report/sd_v1-5_finetuning_quality_subject_fidelity.png)
![sd_v1-5_finetuning_quality_prompt_fidelity](images/stable_diffusion_v1-5_benchmarking_report/sd_v1-5_finetuning_quality_prompt_fidelity.png)
- Fine tuning with Dreambooth or Dreambooth+LoRA can result in models with comparable performance. The base model produced images of the class rather than the instance.
- Dreambooth+LoRA is able to achieve the same subject fidelity score as Dreambooth if trained for more epochs.
- Increasing the number of training steps results in better subject fidelity but at the cost of prompt fidelity.
### Suggested Max Batch Sizes By Resolutions
We benchmarked and suggested max batch sizes by resolutions on 1 A100 and 1 V100 as below. This is with LoRA and gradient checkpointing enabled.
![sd_v1-5_batch_size_by_resolution](images/stable_diffusion_v1-5_benchmarking_report/sd_v1-5_batch_size_by_resolution.png)
### Fine Tuning Cost Optimization
Increasing batch size allows for more images to be considered at each training step for fine tuning. This allows models to be trained in fewer training steps. In this benchmark, we aim to show how batch size can be increased to reduce training costs while still preserving subject and prompt fidelity.
Since the training dataset consists of 5 images, we train with a batch size of 5 and reduce the number of training steps from 400 to 80. Doing so results in a model that has not learned the subject since we’ve decreased the number of training steps. Conceptually, the model is taking a more precise step at each iteration, but it is taking fewer steps. To compensate for this, we increased the learning rate from 5e-6 and observed the best results at 1e-5 for full parameter finetuning.
![sd_v1-5_subject_fidelity_batch_size_5_learning_rate](images/stable_diffusion_v1-5_benchmarking_report/sd_v1-5_subject_fidelity_batch_size_5_learning_rate.png)
![sd_v1-5_prompt_fidelity_batch_size_5_learning_rate](images/stable_diffusion_v1-5_benchmarking_report/sd_v1-5_prompt_fidelity_batch_size_5_learning_rate.png)
Comparing cost of training the “best” model for batch size 1 vs. batch size 5
![sd_v1-5_cost_batch_size](images/stable_diffusion_v1-5_benchmarking_report/sd_v1-5_cost_batch_size.png)
| Train method| Training parameters| Sample image| CoCa (prompt fidelity)| DINO (subject fidelity) | Cost of training on A100 |
|---|---|---|---|---|---|
| dreambooth| dreambooth, num_train_steps=400, batch_size=1, lr=5e-6| ![dog1](images/stable_diffusion_v1-5_benchmarking_report/sd_v1-5_dog1.png) | 0.12215| 0.76531| $0.26 |
| dreambooth | dreambooth, num_train_steps=80, batch_size=5,lr=1e-5| ![dog2](images/stable_diffusion_v1-5_benchmarking_report/sd_v1-5_dog2.png)| 0.12644| 0.74697 | $0.15 |
| dreambooth-lora| num_train_steps=500, batch_size=1, lr=1e-4, gc|![dog3](images/stable_diffusion_v1-5_benchmarking_report/sd_v1-5_dog3.png)| 0.12856| 0.78148 | $0.26|
| dreambooth-lora | num_train_steps=50, batch_size=5, lr=1e-3, gc | ![dog4](images/stable_diffusion_v1-5_benchmarking_report/sd_v1-5_dog4.png) | 0.12566 | 0.75479 | $0.09 |
A followup question is that since finetuning can be run on a single GPU, should finetuning be run on 1 V100 or A100?
Setup:
- num_train_steps=800 / batch_size
- Resolution=512
![sd_v1-5_cost_training_method_batch_size](images/stable_diffusion_v1-5_benchmarking_report/sd_v1-5_cost_training_method_batch_size.png)
- Although V100 has a lower $/hr cost than an A100, the same training setup takes longer. Even given the longer training time, the cost on V100 is still lower.
- Dreambooth+LoRA enables training with larger batch sizes, however, larger batch sizes will not necessarily mean faster training time.
- It is possible to fine tune with 1 V100 on 512 resolution with Dreambooth+LoRA.
- Dreambooth fine tuning must be run on 1 A100 at 512 resolution.
## Inference Benchmarks
We provide two serving dockers in vertex model garden for stable diffusion:
- pytorch-diffuser-serve:
- us-docker.pkg.dev/vertex-ai/vertex-vision-model-garden-dockers/pytorch-diffusers-serve
- This serving docker only serves base stable diffusion models and does not contain any optimizations yet.
- pytorch-peft-serve:
- us-docker.pkg.dev/vertex-ai/vertex-vision-model-garden-dockers/pytorch-peft-serve
- This serving docker can serve base stable diffusion models, and base stable diffusion models with fine tuned lora models, and contains optimization for serving.
We run the two serving dockers on T4/V100/A100 to generate 4 512*512 images, and compare the inference speed without network considerations as:
![sd_v1-5_inference_speed_gpu](images/stable_diffusion_v1-5_benchmarking_report/sd_v1-5_inference_speed_gpu.png)
The speed up of optimized pytorch-peft-serve is about 2x than current pytorch-diffuser-serve.
### Serving cost comparison
Pytorch-diffuser-serve (without any optimizations)
| GPU type| Time required to generate 4 512x512 images | Machine unit price ($ / hour) | Cost per image ($) |
|---|---|---|---|
| T4 | 28.6 | 0.4025| 0.00080 |
| V100 | 8.8 | 2.852| 0.00174|
| A100 | 4.2 | 4.2245 | 0.00123 |
Pytorch-peft-serve (with optimizations)
| GPU type | Time required to generate 4 512x512 images | Machine unit price ($ / hour) | Cost per image ($) |
|--- |---|---|---|
| T4 | 12.6 | 0.4025 | 0.00035 |
| V100 | 4.1 | 2.852 | 0.00081 |
| A100 | 1.7 | 4.2245 | 0.00050 |
- The optimized pytorch-peft-serve has approximately half the price per image, compared with the un-optimized pytorch-diffuser-serve.
- Serving the model with a T4 is most cost effective, however, serving with an A100 still has the best throughput and fastest predictions.
[1]: https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/model_garden/model_garden_pytorch_stable_diffusion.ipynb
[2]: https://github.com/GoogleCloudPlatform/vertex-ai-samples/tree/main/community-content/vertex_model_garden/model_oss
[3]: https://arxiv.org/abs/2208.12242
[4]: https://arxiv.org/abs/2106.09685
[5]: https://huggingface.co/datasets/Multimodal-Fatima/OxfordFlowers_train
[6]: https://huggingface.co/datasets/Multimodal-Fatima/OxfordFlowers_test_facebook_opt_6.7b_Attributes_ns_6149
[7]: https://github.com/google/dreambooth
[8]: https://arxiv.org/abs/2104.14294
[9]: https://arxiv.org/abs/2205.01917
[10]: https://github.com/google/dreambooth/tree/main/dataset/dog6
@@ -0,0 +1,50 @@
# Dockerfile for serving dockers with AutoGluon.
#
# To build:
# docker build -f model_oss/autogluon/dockerfile/serve.Dockerfile . -t ${YOUR_IMAGE_TAG}
#
# To push to gcr:
# docker tag ${YOUR_IMAGE_TAG} gcr.io/${YOUR_PROJECT}/${YOUR_IMAGE_TAG}
# docker push gcr.io/${YOUR_PROJECT}/${YOUR_IMAGE_TAG}
FROM pytorch/pytorch:2.1.2-cuda11.8-cudnn8-runtime
USER root
# AutoGluon might require libgomp for some dependencies.
RUN apt-get update && apt-get -y upgrade && apt-get install -y --no-install-recommends \
curl \
wget \
vim \
libgomp1
# Install AutoGluon and other dependencies.
RUN pip install --upgrade pip
RUN pip install autogluon==1.0.0
RUN pip install flask==3.0.0
# Dependencies needed to work with GCS.
RUN pip install absl-py==2.0.0
RUN pip install google-cloud-storage==2.7.0
# Copy scripts into the container.
COPY model_oss/autogluon /autogluon
COPY model_oss/util /autogluon/util
WORKDIR /autogluon
# Copy license.
RUN wget https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/main/LICENSE
RUN wget https://github.com/pallets/flask/blob/main/LICENSE.rst
# Expose the port the app runs on.
EXPOSE 8501
# Set the working directory to a specific path for consistency.
WORKDIR /autogluon
# Change to a non-root user for security purposes.
RUN useradd -m autogluonuser
USER autogluonuser
# Run Flask application.
CMD ["python", "serve.py"]
@@ -0,0 +1,36 @@
# Dockerfile for training dockers with Autogluon.
#
# To build:
# docker build -f model_oss/autogluon/dockerfile/train.Dockerfile . -t ${YOUR_IMAGE_TAG}
#
# To push to gcr:
# docker tag ${YOUR_IMAGE_TAG} gcr.io/${YOUR_PROJECT}/${YOUR_IMAGE_TAG}
# docker push gcr.io/${YOUR_PROJECT}/${YOUR_IMAGE_TAG}
FROM pytorch/pytorch:2.1.2-cuda11.8-cudnn8-runtime
# Install tools.
ENV DEBIAN_FRONTEND=noninteractive
ENV PIP_ROOT_USER_ACTION=ignore
RUN apt-get update && apt-get -y upgrade && apt-get install -y --no-install-recommends \
apt-utils \
curl \
wget \
git \
jq \
gnupg \
build-essential \
tesseract-ocr \
vim
# Install libraries.
RUN pip install autogluon==1.0.0
COPY model_oss/autogluon /autogluon
WORKDIR /autogluon
# Copy license.
RUN wget https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/main/LICENSE
ENTRYPOINT ["python", "train.py"]
@@ -0,0 +1,87 @@
r"""AutoGluon serving binary.
This module sets up a Flask web server for serving predictions from a
trained AutoGluon model. The server exposes two endpoints:
1. `/ping`: A health check endpoint that returns "pong" to
indicate that the server is running.
2. `/predict`: An endpoint that accepts POST requests with JSON content.
Each request should contain one or more instances for which the
predictions are desired. The endpoint returns the predictions and
associated probabilities in a JSON response.
The server expects an environment variable `model_path` that points to
the directory where the AutoGluon model artifacts are
stored. If `model_path` is not provided, it defaults to '/autogluon/models'.
"""
import json
import logging
import os
from autogluon.tabular import TabularPredictor
import flask
import pandas as pd
from util import constants
from util import fileutils
_SUCCESS_STATUS = 200
_ERROR_STATUS = 500
_PORT = 8501
app = flask.Flask(__name__)
# Check the environment variables.
model_dir = os.getenv('model_path', '/autogluon/models')
logging.info('Model directory passed by the user is: %s', model_dir)
# If the model is on GCS then copy it to a local folder first.
if model_dir.startswith(constants.GCS_URI_PREFIX):
gcs_path = model_dir[len(constants.GCS_URI_PREFIX) :]
local_model_dir = os.path.join(constants.LOCAL_MODEL_DIR, gcs_path)
logging.info('Download %s to %s', model_dir, local_model_dir)
fileutils.download_gcs_dir_to_local(model_dir, local_model_dir)
model_dir = local_model_dir
logging.info('Local model directory is: %s', model_dir)
# Load the predictor at startup.
predictor = TabularPredictor.load(model_dir)
@app.route('/ping', methods=['GET'])
def ping() -> flask.Response:
"""Health check route."""
return flask.Response('pong', status=_SUCCESS_STATUS)
@app.route('/predict', methods=['POST'])
def predict() -> flask.Response:
"""Prediction route."""
try:
# Extract JSON content from the POST request.
data = flask.request.get_json(force=True)
instances = data.get('instances', [])
# Convert instances to DataFrame.
df_to_predict = pd.DataFrame(instances)
# Perform prediction.
predictions = predictor.predict(df_to_predict).tolist()
response = {'predictions': predictions}
return flask.Response(
json.dumps(response),
status=_SUCCESS_STATUS,
mimetype='application/json',
)
except Exception as e: # pylint: disable=broad-exception-caught
return flask.Response(
json.dumps({'error': str(e)}),
status=_ERROR_STATUS,
mimetype='application/json',
)
if __name__ == '__main__':
app.run(host='0.0.0.0', port=_PORT)
@@ -0,0 +1,144 @@
"""AutoGluon training binary. """
import argparse
import json
from typing import Any
from autogluon.tabular import TabularPredictor
import pandas as pd
class BaseConfig:
def to_dict(self) -> dict[str, Any]:
return {
key: value for key, value in self.__dict__.items() if value is not None
}
class DataConfig(BaseConfig):
def __init__(self, train_data_path: Any) -> None:
self.train_data_path = train_data_path
class ProblemConfig(BaseConfig):
def __init__(self, label: Any, problem_type: Any) -> None:
self.label = label
self.problem_type = problem_type
class EvaluationConfig(BaseConfig):
def __init__(self, eval_metric: Any) -> None:
self.eval_metric = eval_metric
class TrainingConfig(BaseConfig):
"""Config for training."""
def __init__(
self,
time_limit: Any,
presets: Any,
hyperparameters: Any,
model_save_path: str,
) -> None:
self.time_limit = time_limit
self.hyperparameters = hyperparameters
self.presets = presets
self.model_save_path = model_save_path
def parse_args() -> (
tuple[DataConfig, ProblemConfig, EvaluationConfig, TrainingConfig]
):
"""Parse command line arguments."""
parser = argparse.ArgumentParser(description="AutoGluon Tabular Predictor")
# Add arguments for each config class
parser.add_argument(
"--train_data_path",
type=str,
required=True,
help="Path to the input data CSV file.",
)
parser.add_argument(
"--label", type=str, required=True, help="Target variable column name."
)
parser.add_argument(
"--problem_type",
type=str,
choices=["binary", "multiclass", "regression", "quantile"],
default=None,
help="Problem type.",
)
parser.add_argument(
"--eval_metric", type=str, default=None, help="Evaluation metric to use."
)
# Add arguments for TrainingConfig if needed
parser.add_argument(
"--time_limit",
type=int,
default=None,
help="Time limit in seconds for training.",
)
parser.add_argument(
"--presets",
type=str,
default="medium_quality",
help="Presets used for training ",
)
parser.add_argument(
"--hyperparameters",
type=json.loads,
default=None,
help="Hyperparameter dictionary in JSON format.",
)
parser.add_argument(
"--model_save_path",
type=str,
default=None,
help="Path to save the trained model.",
)
args = parser.parse_args()
data_config = DataConfig(train_data_path=args.train_data_path)
problem_config = ProblemConfig(
label=args.label, problem_type=args.problem_type
)
eval_config = EvaluationConfig(eval_metric=args.eval_metric)
training_config = TrainingConfig(
time_limit=args.time_limit,
presets=args.presets,
hyperparameters=args.hyperparameters,
model_save_path=args.model_save_path,
)
return data_config, problem_config, eval_config, training_config
def main() -> None:
data_config, problem_config, eval_config, training_config = parse_args()
# Load the training data.
data = pd.read_csv(data_config.train_data_path)
# Create a TabularPredictor.
predictor = TabularPredictor(
label=problem_config.label,
eval_metric=eval_config.eval_metric,
path=training_config.model_save_path,
)
# Fit the model
predictor.fit(
data,
presets=training_config.presets,
time_limit=training_config.time_limit,
hyperparameters=training_config.hyperparameters,
)
if __name__ == "__main__":
main()
@@ -0,0 +1,25 @@
# The provided content is a configuration file for the ZipNeRF
# PyTorch implementation.
# Sets the name of the experiment to 'test'.
Config.exp_name = 'test'
# Specifies the dataset loader, in this case, 'llff' for light field.
Config.dataset_loader = 'llff'
# Defines the near and far clipping planes for the camera view.
Config.near = 0.2
Config.far = 1e6
# Image downsampling.
Config.factor = 4
# For the model configurations.
Model.raydist_fn = 'power_transformation'
Model.opaque_background = True
# Disables the computation of density normals and RGB values, and sets
# the grid level dimension to 1 for PropMLP.
PropMLP.disable_density_normals = True
PropMLP.disable_rgb = True
PropMLP.grid_level_dim = 1
# Disable density normals for NerfMLP
NerfMLP.disable_density_normals = True
@@ -0,0 +1,21 @@
# The provided content is a configuration file for Generative
# Latent Optimization (GLO) vectors in the Pytorch implemnetation of ZipNeRF.
# Specifies the dataset loader, in this case, 'llff' for light field.
Config.dataset_loader = 'llff'
# Defines the near and far clipping planes for the camera view.
Config.near = 0.2
Config.far = 1e6
# Image downsampling.
Config.factor = 4
# For the model configurations.
Model.raydist_fn = 'power_transformation'
Model.num_glo_features = 128
Model.opaque_background = True
PropMLP.disable_density_normals = True
PropMLP.disable_rgb = True
PropMLP.grid_level_dim = 1
NerfMLP.disable_density_normals = True
@@ -0,0 +1,18 @@
# The provided content is a configuration file running ZipNeRF
# training on 8 gpu machine.
compute_environment: LOCAL_MACHINE
debug: false
distributed_type: MULTI_GPU
downcast_bf16: 'no'
gpu_ids: all
machine_rank: 0
main_training_function: main
mixed_precision: fp16
num_machines: 1
num_processes: 8
rdzv_backend: static
same_network: true
tpu_env: []
tpu_use_cluster: false
tpu_use_sudo: false
use_cpu: false
@@ -0,0 +1,120 @@
# Dockerfile for ZipNeRF base image.
#
# To build:
# docker build -f model_oss/cloudnerf/dockerfile/pytorch_cloudnerf_base.Dockerfile . -t ${YOUR_IMAGE_TAG}
#
# To push to gcr:
# docker tag ${YOUR_IMAGE_TAG} gcr.io/${YOUR_PROJECT}/${YOUR_IMAGE_TAG}
# docker push gcr.io/${YOUR_PROJECT}/${YOUR_IMAGE_TAG}
FROM pytorch/pytorch:2.1.0-cuda11.8-cudnn8-devel
USER root
ARG COLMAP_GIT_COMMIT=main
ARG CUDA_ARCHITECTURES=60;70;75;80;86
# Prevent stop building ubuntu at time zone selection.
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y --allow-releaseinfo-change && apt-get -y upgrade && apt-get install -y --no-install-recommends \
curl \
g++ \
wget \
vim \
bash \
cmake \
imagemagick \
ninja-build \
build-essential \
libboost-program-options-dev \
libboost-filesystem-dev \
libboost-graph-dev \
libboost-system-dev \
libeigen3-dev \
libflann-dev \
libfreeimage-dev \
libmetis-dev \
libgoogle-glog-dev \
libgtest-dev \
libsqlite3-dev \
libglew-dev \
qtbase5-dev \
libqt5opengl5-dev \
libcgal-dev \
libceres-dev \
git \
git-lfs \
python3-cffi \
python3-cryptography \
libffi-dev \
python-dev
# Copy license.
RUN wget https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/main/LICENSE
# Install google cloud CLI.
RUN wget -q https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-430.0.0-linux-x86.tar.gz
RUN tar xzf google-cloud-cli-430.0.0-linux-x86.tar.gz
RUN ./google-cloud-sdk/install.sh -q
# Make sure gsutil will use the default service account.
RUN echo '[GoogleCompute]\nservice_account = default' > /etc/boto.cfg
# Install deps and install gsutil.
RUN pip install gsutil==5.27
# When building colmap in colab, the link error "undefined reference.
# to '_glapi_tls_Current'" happens. A solution is to install "libglvnd"
# as described in this page https://github.com/colmap/colmap/issues/1271.
RUN git clone --depth 1 --branch v1.7.0 https://github.com/NVIDIA/libglvnd && \
apt-get install -y libxext-dev libx11-dev x11proto-gl-dev && \
cd libglvnd/ && \
apt-get install -y autoconf automake libtool && \
apt-get install -y libffi-dev && \
./autogen.sh && \
./configure && \
make -j4 && \
make install
RUN apt remove nvidia-cuda-toolkit -y \
nvidia-cuda-toolkit \
nvidia-cuda-toolkit-gcc
# Install libraries.
ENV PIP_ROOT_USER_ACTION=ignore
RUN python3 -m pip install --upgrade pip
ENV CUDA_HOME=/usr/local/cuda
RUN git clone --branch main https://github.com/SuLvXiangXin/zipnerf-pytorch.git
# Set current directory to the downloaded 'zipnerf-pytorch' repository.
WORKDIR ./zipnerf-pytorch
# Using git reset command to pin it down to a specific version.
RUN git reset --hard 4de3d21ebb9e15412d36951b56e2d713fddd812b
COPY model_oss/cloudnerf/requirements.txt requirements.txt
RUN pip install -r requirements.txt
# Install gridencoder extensions and nvdiffrast (for textured mesh).
RUN cd .. && \
TORCH_CUDA_ARCH_LIST="6.0 7.0 7.5 8.0 8.6+PTX" CXX=g++ pip install ./zipnerf-pytorch/gridencoder
# Install cuda version of torch_scatter.
RUN pip install torch-scatter==2.1.2 -f https://data.pyg.org/whl/torch-2.0.1+cu118.html
RUN pip install google-cloud-aiplatform==1.25.0
RUN pip install google-cloud-storage==2.9.0
# Build and install COLMAP.
RUN git clone --depth 1 --branch 3.8 https://github.com/colmap/colmap.git
RUN cd colmap && \
git fetch https://github.com/colmap/colmap.git ${COLMAP_GIT_COMMIT} && \
mkdir build && \
cd build && \
cmake .. -GNinja -DCMAKE_CUDA_ARCHITECTURES=${CUDA_ARCHITECTURES} && \
ninja && \
ninja install && \
cd .. && rm -rf colmap
RUN git clone --depth 1 --branch v1.0.2 https://github.com/dranjan/python-plyfile.git
RUN sed -i "20 i\sys.path.append('/workspace/zipnerf-pytorch/internal/pycolmap')" /workspace/zipnerf-pytorch/internal/datasets.py
RUN sed -i "21 i\sys.path.append('/workspace/zipnerf-pytorch/internal/pycolmap/pycolmap')" /workspace/zipnerf-pytorch/internal/datasets.py
@@ -0,0 +1,16 @@
# Dockerfile for ZipNeRF COLMAP image calibration.
#
# To build:
# docker build -f model_oss/cloudnerf/dockerfile/cloudnerf_pytorch_calibrate.Dockerfile . -t ${YOUR_IMAGE_TAG}
#
# To push to gcr:
# docker tag ${YOUR_IMAGE_TAG} gcr.io/${YOUR_PROJECT}/${YOUR_IMAGE_TAG}
# docker push gcr.io/${YOUR_PROJECT}/${YOUR_IMAGE_TAG}
FROM us-docker.pkg.dev/vertex-ai/vertex-vision-model-garden-dockers/pytorch-cloudnerf-base:20231206_0923_RC00
COPY model_oss/cloudnerf/local_colmap_and_resize.sh /workspace/zipnerf-pytorch/scripts/local_colmap_and_resize.sh
WORKDIR /workspace/zipnerf-pytorch/
ENTRYPOINT ["bash","scripts/local_colmap_and_resize.sh"]
@@ -0,0 +1,22 @@
# Dockerfile for ZipNeRF rendering.
#
# To build:
# docker build -f model_oss/cloudnerf/dockerfile/pytorch_cloudnerf_render.Dockerfile . -t ${YOUR_IMAGE_TAG}
#
# To push to gcr:
# docker tag ${YOUR_IMAGE_TAG} gcr.io/${YOUR_PROJECT}/${YOUR_IMAGE_TAG}
# docker push gcr.io/${YOUR_PROJECT}/${YOUR_IMAGE_TAG}
FROM us-docker.pkg.dev/vertex-ai/vertex-vision-model-garden-dockers/pytorch-cloudnerf-base:20231206_0923_RC00
COPY model_oss/cloudnerf/render.sh /workspace/zipnerf-pytorch/scripts/render.sh
COPY model_oss/cloudnerf/configs/360.gin /workspace/zipnerf-pytorch/configs/360.gin
COPY model_oss/cloudnerf/configs/360_glo.gin /workspace/zipnerf-pytorch/configs/360_glo.gin
COPY model_oss/cloudnerf/configs/accelerate_config.yaml /root/.cache/huggingface/accelerate/default_config.yaml
RUN sed -i '324s/.*/ keyframe_names = fp.read().splitlines()/' /workspace/zipnerf-pytorch/internal/camera_utils.py
ENV PYTHONPATH "${PYTHONPATH}:/workspace/zipnerf-pytorch/util"
WORKDIR /workspace/zipnerf-pytorch/
ENTRYPOINT ["bash", "scripts/render.sh"]
@@ -0,0 +1,21 @@
# Dockerfile for ZipNeRF training.
#
# To build:
# docker build -f model_oss/cloudnerf/dockerfile/pytorch_cloudnerf_train.Dockerfile . -t ${YOUR_IMAGE_TAG}
#
# To push to gcr:
# docker tag ${YOUR_IMAGE_TAG} gcr.io/${YOUR_PROJECT}/${YOUR_IMAGE_TAG}
# docker push gcr.io/${YOUR_PROJECT}/${YOUR_IMAGE_TAG}
FROM us-docker.pkg.dev/vertex-ai/vertex-vision-model-garden-dockers/pytorch-cloudnerf-base:20231206_0923_RC00
COPY model_oss/cloudnerf/train.sh /workspace/zipnerf-pytorch/scripts/train.sh
COPY model_oss/cloudnerf/configs/360.gin /workspace/zipnerf-pytorch/configs/360.gin
COPY model_oss/cloudnerf/configs/360_glo.gin /workspace/zipnerf-pytorch/configs/360_glo.gin
COPY model_oss/cloudnerf/configs/accelerate_config.yaml /root/.cache/huggingface/accelerate/default_config.yaml
ENV PYTHONPATH "${PYTHONPATH}:/workspace/zipnerf-pytorch/util"
WORKDIR /workspace/zipnerf-pytorch/
ENTRYPOINT ["bash", "scripts/train.sh"]
@@ -0,0 +1,144 @@
#!/bin/bash
# This script runs colmap for scale invariant feature (SIFT) extraction and
# matching to map camera extrinsics and intrinsics values for ZipNeRF,
# given a folder of images and videos
# from a GCS bucket. It uses ffmepg to extract an image from a video at
# 1fps. The folder can contain images or videos. If both images and videos
# are present, the extracted frames from the videos is added to the images
# to create the final combined image dataset.
# vv-docker:google3-begin(internal)
# TODO(b/314042136): Specify cloudnerf colmap fps.
# vv-docker:google3-end
# Initialize variables.
use_gpu=1 # Default to 1 (assuming the docker is run on a machine with GPU)
gcs_dataset_path=""
gcs_experiment_path=""
camera=""
# This loop processes command-line arguments for configuring the container.
# It supports arguments for GPU usage, dataset and experiment paths,
# and camera type.
while [[ $# -gt 0 ]]; do
case $1 in
-use_gpu)
use_gpu="$2"
if ! [[ $use_gpu =~ ^[0-9]+$ ]]; then
echo "Error: -use_gpu must be an integer."
exit 1
fi
shift # past argument
shift # past value
;;
-gcs_dataset_path)
gcs_dataset_path="$2"
shift # past argument
shift # past value
;;
-gcs_experiment_path)
gcs_experiment_path="$2"
shift # past argument
shift # past value
;;
-camera)
camera="$2"
if [[ $camera != "OPENCV" && $camera != "OPENCV_FISHEYE" ]]; then
echo "Error: -camera must be either 'OPENCV' or 'OPENCV_FISHEYE'."
exit 1
fi
shift # past argument
shift # past value
;;
*) # unknown option
echo "Unknown option: $1" >&2
exit 1
;;
esac
done
local_folder="dataset_content"
images_folder="dataset_images"
images_subfolder="images"
output_folder="$images_folder/$images_subfolder"
# Create the local folder if it doesn't exist
mkdir -p "$local_folder"
mkdir -p "$output_folder"
# Download the content from the GCS URI
gsutil -m cp -r "$gcs_dataset_path"/* "$local_folder/"
# Process files in the local folder
for file in "$local_folder"/*; do
if [[ -f "$file" ]]; then
# Check if the file is an image (e.g., jpg, png, etc.)
if file --mime-type "$file" | grep -q "image"; then
# Copy the image to the "images" subfolder within the "dataset_images" folder
cp "$file" "$output_folder/$(basename "$file")"
elif file --mime-type "$file" | grep -q "video"; then
# Use FFmpeg to extract an image every 30 frames from the video
ffmpeg -i "$file" -vf "select='not(mod(n,30))'" "$output_folder/$(basename "$file" ."${file##*.}")_%03d.jpg"
else
echo "Skipping unsupported file: $file"
fi
fi
done
# Run COLMAP Feature extraction
colmap feature_extractor \
--database_path "$local_folder"/database.db \
--image_path "$output_folder" \
--ImageReader.single_camera 1 \
--ImageReader.camera_model "$camera" \
--SiftExtraction.use_gpu "$use_gpu"
# Run COLMAP Feature matching
colmap exhaustive_matcher \
--database_path "$local_folder"/database.db \
--SiftMatching.use_gpu "$use_gpu"
# Bundle adjustment. The default Mapper tolerance is unnecessarily large,
# decreasing it speeds up bundle adjustment steps.
mkdir -p "$local_folder"/sparse
colmap mapper \
--database_path "$local_folder"/database.db \
--image_path "$output_folder" \
--output_path "$local_folder"/sparse \
--Mapper.ba_global_function_tolerance=0.000001
# Downsample images at 1/2, 1/4, 1/8 scales. Save feature matching to
# sqlite database.
# All input and output images:
# $gcs_dataset_path
# $gcs_experiment_path/data/images
# Downsampled output images:
# $gcs_experiment_path/data/images_2/
# $gcs_experiment_path/data/images_4/
# $gcs_experiment_path/data/images_8/
# COLMAP sparse reconstruction files: project.ini, images.bin,
# cameras.bin, points3D.bin
# $gcs_experiment_path/data/sparse/0/
cp -r "$output_folder" "$images_folder"/images_2
pushd "$images_folder"/images_2
ls | xargs -P 8 -I {} mogrify -resize 50% {}
popd
gsutil -m cp -r "$images_folder"/images_2/* "$gcs_experiment_path"/data/images_2
cp -r "$output_folder" "$images_folder"/images_4
pushd "$images_folder"/images_4
ls | xargs -P 8 -I {} mogrify -resize 25% {}
popd
gsutil -m cp -r "$images_folder"/images_4/* "$gcs_experiment_path"/data/images_4
cp -r "$output_folder" "$images_folder"/images_8
pushd "$images_folder"/images_8
ls | xargs -P 8 -I {} mogrify -resize 12.5% {}
popd
gsutil -m cp "$images_folder"/images_8/* "$gcs_experiment_path"/data/images_8
# Copy images and sparse reconstruction files to gcs experiment folder.
gsutil -m cp "$images_folder"/images/* "$gcs_experiment_path"/data/images
gsutil -m cp -r "$local_folder"/sparse "$gcs_experiment_path"/data
gsutil -m cp "$local_folder"/database.db "$gcs_experiment_path"/data
echo "Processing complete."
@@ -0,0 +1,117 @@
#!/bin/bash
# This script runs rendering for ZipNeRF given an experiment folder
# from a GCS bucket with colmap dataset.
# Initialize associative array for arguments.
declare -A args
# vv-docker:google3-begin(internal)
# TODO(b/311468174): Pass gin config file from gcs bucket.
# vv-docker:google3-end
# Function to parse named arguments.
parse_args() {
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-gcs_experiment_path|-gin_config_file|-gcs_keyframes_file)
args[$key]="$2"
shift # past argument
shift # past value
;;
-training_job_name)
training_job_name="$2"
shift # past argument
shift # past value
;;
-rendering_job_name)
rendering_job_name="$2"
shift # past argument
shift # past value
;;
-render_path_frames|-factor|-render_video_fps)
args[$key]="$2"
if ! [[ ${args[$key]} =~ ^[0-9]+$ ]]; then
echo "Error: $key must be an integer."
exit 1
fi
shift # past argument
shift # past value
;;
*)
echo "Unknown option: $1" >&2
exit 1
;;
esac
done
}
# Function to create a directory if it doesn't exist.
create_dir_if_not_exists() {
local dir_path=$1
if [[ ! -d "$dir_path" ]]; then
echo "Creating folder: $dir_path"
mkdir "$dir_path"
else
echo "Folder $dir_path already exists."
fi
}
# Function to launch rendering.
launch_rendering() {
local keyframes_file=$1
local render_bindings=(
"--gin_configs=${args[-gin_config_file]}"
"--gin_bindings=Config.data_dir='${DATASET_PATH}'"
"--gin_bindings=Config.exp_name='${EXPERIMENT}'"
"--gin_bindings=Config.render_path=True"
"--gin_bindings=Config.render_path_frames=${args[-render_path_frames]}"
"--gin_bindings=Config.render_video_fps=${args[-render_video_fps]}"
"--gin_bindings=Config.factor=${args[-factor]}"
)
if [[ -n $keyframes_file ]]; then
render_bindings+=("--gin_bindings=Config.render_spline_keyframes='${keyframes_file}'")
fi
accelerate launch render.py "${render_bindings[@]}"
}
# Parse arguments.
parse_args "$@"
# Extract folder names and paths.
scene_folder_name=$(basename "${args[-gcs_experiment_path]}")
local_dataset_path="local_dataset"
local_experiment_path="exp"
exp_folder_name=$(basename "${args[-gcs_experiment_path]}")
DATASET_PATH="$local_experiment_path/$exp_folder_name/data"
CHECKPOINTS_PATH="$local_experiment_path/$exp_folder_name/checkpoints"
OUTPUT_RENDER_PATH="$local_experiment_path/$scene_folder_name/render"
EXPERIMENT=$exp_folder_name
# Create necessary directories.
create_dir_if_not_exists "$local_dataset_path"
create_dir_if_not_exists "$local_experiment_path"
create_dir_if_not_exists "$local_experiment_path/$exp_folder_name"
create_dir_if_not_exists "$CHECKPOINTS_PATH"
# Create the file log_render.txt in the exp folder.
touch "$local_experiment_path/$exp_folder_name/log_render.txt"
# Copy experiment from GCS bucket to local
gsutil -m cp -r "${args[-gcs_experiment_path]}/data" "$local_experiment_path/$exp_folder_name" || exit 1
gsutil -m cp -r "${args[-gcs_experiment_path]}/checkpoints/${training_job_name}/*" "$CHECKPOINTS_PATH" || exit 1
# Check and copy keyframes file.
if [[ -n ${args[-gcs_keyframes_file]} ]]; then
keyframes_file_basename=$(basename "${args[-gcs_keyframes_file]}")
local_keyframes_file="$local_dataset_path/$keyframes_file_basename"
gsutil cp "${args[-gcs_keyframes_file]}" "$local_keyframes_file" || exit 1
echo "Local keyframe file: $local_keyframes_file"
launch_rendering "$local_keyframes_file"
else
launch_rendering ""
fi
# Copy rendered data back to GCS.
gsutil -m cp -r "$OUTPUT_RENDER_PATH" "${args[-gcs_experiment_path]}/render/${rendering_job_name}"
@@ -0,0 +1,24 @@
--find-links https://download.pytorch.org/whl/torch_stable.html
torch==2.0.1+cu118
numpy==1.26.1
absl_py==2.0.0
accelerate==0.24.0
gin_config==0.5.0
imageio==2.31.6
imageio-ffmpeg==0.4.9
matplotlib==3.8.0
mediapy==1.1.9
ninja==1.11.1.1
opencv_contrib_python==4.8.1.78
opencv_python==4.8.1.78
Pillow==10.3.0
rawpy==0.18.1
scipy==1.11.3
scikit-image==0.22.0
scikit-learn==1.5.0
tensorboard==2.15.0
tensorboardX==2.6.2.2
tqdm==4.66.3
trimesh==4.0.1
xatlas==0.0.8
@@ -0,0 +1,94 @@
#!/bin/bash
# Initialize variables.
training_job_name=""
gcs_experiment_path=""
gin_config_file="configs/360.gin"
factor=4
max_training_steps=25000
# Parse named arguments.
while [[ $# -gt 0 ]]; do
case $1 in
-training_job_name)
training_job_name="$2"
shift # past argument
shift # past value
;;
-gcs_experiment_path)
gcs_experiment_path="$2"
shift # past argument
shift # past value
;;
-gin_config_file)
gin_config_file="$2"
shift # past argument
shift # past value
;;
-factor)
factor="$2"
if ! [[ $factor =~ ^[0-9]+$ ]]; then
echo "Error: -factor must be an integer."
exit 1
fi
shift # past argument
shift # past value
;;
-max_training_steps)
max_training_steps="$2"
if ! [[ $max_training_steps =~ ^[0-9]+$ ]]; then
echo "Error: -max_training_steps must be an integer."
exit 1
fi
shift # past argument
shift # past value
;;
*) # unknown option
echo "Unknown option: $1" >&2
exit 1
;;
esac
done
# Function to create a directory if it doesn't exist.
create_dir_if_not_exists() {
local dir_path=$1
if [[ ! -d "$dir_path" ]]; then
echo "Creating folder: $dir_path"
mkdir "$dir_path"
else
echo "Folder $dir_path already exists."
fi
}
# Extract folder names and paths.
scene_folder_name=$(basename "${gcs_experiment_path}")
local_dataset_path="local_dataset"
local_experiment_path="exp"
DATASET_PATH="$local_experiment_path/$scene_folder_name/data"
EXPERIMENT=$scene_folder_name
# Create necessary directories.
create_dir_if_not_exists "$local_dataset_path"
create_dir_if_not_exists "$local_experiment_path"
create_dir_if_not_exists "$local_experiment_path/$scene_folder_name"
# Copy experiment from GCS bucket to local.
gsutil -m cp -r "${gcs_experiment_path}/data" "$local_experiment_path/$scene_folder_name" || exit 1
echo "GCS Experiment: $gcs_experiment_path"
echo "Gin Config File: $gin_config_file"
echo "Factor: $factor"
echo "Scene: $scene_folder_name"
echo "Local Dataset: $DATASET_PATH"
echo "Local Experiment: $EXPERIMENT"
accelerate launch train.py --gin_configs="$gin_config_file" \
--gin_bindings="Config.data_dir = '${DATASET_PATH}'" \
--gin_bindings="Config.exp_name = '${EXPERIMENT}'" \
--gin_bindings="Config.factor = ${factor}" \
--gin_bindings="Config.max_steps = ${max_training_steps}"
gsutil -m rm -r "${gcs_experiment_path}/checkpoints/${training_job_name}"
gsutil -m cp -r "$local_experiment_path/$scene_folder_name/config.gin" "${gcs_experiment_path}/${training_job_name}_config.gin"
gsutil -m cp -r "$local_experiment_path/$scene_folder_name/checkpoints/*/*" "${gcs_experiment_path}/checkpoints/${training_job_name}"
@@ -0,0 +1,623 @@
"""Library with functions to use for data conversion."""
import json
import os
import random
from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Tuple, Union
import uuid
from absl import logging
import apache_beam as beam
import cv2
import numpy as np
import pandas as pd
import PIL
from PIL import Image
import tensorflow as tf
import yaml
from util import constants
from util import fileutils
from apache_beam.options import pipeline_options
REFORMATTED_CSV_SUFFIX = '-reformatted.csv'
LABEL_MAP_NAME = 'label_map.yaml'
_SPLIT_RATIO_ERROR_THRESHOLD = 1e-5
# Internal constant. Only for distinguishing rows without ML use.
ML_USE_UNASSIGNED = 'unassigned'
ALL_ML_USES = (
constants.ML_USE_TRAINING,
constants.ML_USE_VALIDATION,
constants.ML_USE_TEST,
ML_USE_UNASSIGNED,
)
COLUMN_NAME_ML_USE = 'ml_use'
COLUMN_NAME_GCS_FILE_PATH = 'gcs_file_path'
COLUMN_NAME_LABEL = 'label'
COLUMN_NAME_START_SEC = 'start_sec'
COLUMN_NAME_END_SEC = 'end_sec'
# Output filenames
TRAIN_TFRECORD_NAME = 'train.tfrecord'
VALIDATION_TFRECORD_NAME = 'val.tfrecord'
TEST_TFRECORD_NAME = 'test.tfrecord'
# Jsonl keys
JSON_GCS_URI_KEY = 'imageGcsUri'
JSON_RESOURCE_LABEL_KEY = 'dataItemResourceLabels'
JSON_ML_USE_KEY = 'aiplatform.googleapis.com/ml_use'
# I/O parameters
READ_CHUNK_SIZE = 1024 * 1024 * 1024 # 1GB
class WriteToTFRecord(beam.DoFn):
"""DoFn to write TF examples to sharded TF record files."""
def __init__(
self,
output_prefix: str,
num_shards: int,
convert_fn: Callable[[Dict[str, Any]], tf.train.Example],
):
self.output_prefix = output_prefix
self.num_shards = num_shards
self.writer: list[tf.io.TFRecordWriter] = []
self.sharded_files: list[str] = []
self.convert_fn = convert_fn
self.success_counter = beam.metrics.Metrics.counter(
self.__class__.__name__, 'Success'
)
self.failure_counter = beam.metrics.Metrics.counter(
self.__class__.__name__, 'Failure'
)
def start_bundle(self):
logging.info('Start writing TF Record to %s.', self.output_prefix)
unique_str = uuid.uuid4().hex
for i in range(self.num_shards):
uri = f'{self.output_prefix}-{i}-{unique_str}'
self.sharded_files.append(uri)
self.writer.append(tf.io.TFRecordWriter(uri))
def process(self, data: Dict[str, Any]) -> Iterable[Tuple[int, str]]:
try:
example = self.convert_fn(data)
data = example.SerializeToString()
idx = hash(data) % self.num_shards
self.writer[idx].write(data)
self.success_counter.inc()
yield (idx, self.sharded_files[idx])
# pylint: disable-next=broad-exception-caught
except Exception as err:
logging.error('Failed to process %s', data)
logging.exception(err)
self.failure_counter.inc()
def finish_bundle(self):
logging.info('Finish writing TF Record to %s.', self.output_prefix)
for writer in self.writer:
writer.close()
self.writer = []
def convert_to_feature(
value: Union[List[Union[int, float, bytes]], int, float, bytes],
value_type: Optional[str] = None,
) -> tf.train.Feature:
"""Converts the given python object to a tf.train.Feature.
This is copied from tensorflow_models/official/vision/data/tfrecord_lib.py.
Args:
value: int, float, bytes or a list of them.
value_type: optional, if specified, forces the feature to be of the given
type. Otherwise, type is inferred automatically. Can be one of ['bytes',
'int64', 'float', 'bytes_list', 'int64_list', 'float_list']
Returns:
feature: A tf.train.Feature object.
"""
if value_type is None:
element = value[0] if isinstance(value, list) else value
if isinstance(element, bytes):
value_type = 'bytes'
elif isinstance(element, (int, np.integer)):
value_type = 'int64'
elif isinstance(element, (float, np.floating)):
value_type = 'float'
else:
raise ValueError(
'Cannot convert type {} to feature'.format(type(element))
)
if isinstance(value, list):
value_type = value_type + '_list'
if value_type == 'int64':
return tf.train.Feature(int64_list=tf.train.Int64List(value=[value]))
elif value_type == 'int64_list':
value = np.asarray(value).astype(np.int64).reshape(-1)
return tf.train.Feature(int64_list=tf.train.Int64List(value=value))
elif value_type == 'float':
return tf.train.Feature(float_list=tf.train.FloatList(value=[value]))
elif value_type == 'float_list':
value = np.asarray(value).astype(np.float32).reshape(-1)
return tf.train.Feature(float_list=tf.train.FloatList(value=value))
elif value_type == 'bytes':
return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value]))
elif value_type == 'bytes_list':
return tf.train.Feature(bytes_list=tf.train.BytesList(value=value))
else:
raise ValueError('Unknown value_type parameter - {}'.format(value_type))
def convert_to_string_feature(
value: str, encoding: str = 'utf-8'
) -> tf.train.Feature:
"""Returns a bytes_list from an encoded string."""
return convert_to_feature(value.encode(encoding))
def convert_to_list_string_feature(
lst: list[str], encoding: str = 'utf-8'
) -> tf.train.Feature:
"""Returns a bytes_list from a list of encoded strings."""
return convert_to_feature([value.encode(encoding) for value in lst])
def create_ml_use_array_with_split(
total_size: int,
split_ratio: Sequence[float],
) -> list[str]:
"""Create randomized list of 'training', 'validation', 'test'.
The list of will be of length total_size with ratios according to train_size,
validation_size, and test_size.
Args:
total_size: Length of sequence to return
split_ratio: Proportions to split into 'training', 'validation', and 'test'
Returns:
List containing 'training', 'validation', and 'test'
"""
train_size, validation_size, _ = split_ratio
num_train = round(train_size * total_size)
num_validation = round(validation_size * total_size)
num_test = total_size - num_train - num_validation
ml_use_row = (
[constants.ML_USE_TRAINING] * num_train
+ [constants.ML_USE_VALIDATION] * num_validation
+ [constants.ML_USE_TEST] * num_test
)
random.shuffle(ml_use_row)
return ml_use_row
def format_ml_use_column(df: pd.DataFrame):
df[COLUMN_NAME_ML_USE].replace(
# We need to support non-standard ML uses other than documented ones,
# since they are used by some existing datasets.
[r'(?i)^train(ing)?$', r'(?i)^test$', r'(?i)^validat(ion|e)$'],
[
constants.ML_USE_TRAINING,
constants.ML_USE_TEST,
constants.ML_USE_VALIDATION,
],
inplace=True,
regex=True,
)
def insert_missing_ml_use(df: pd.DataFrame) -> None:
"""For every row that does not have ml_use as the first column, insert a column containing 'unassigned' to the front.
Args:
df: The DataFrame to process. The first column should be 'ml_use'.
"""
df[COLUMN_NAME_ML_USE].fillna(ML_USE_UNASSIGNED, inplace=True)
rows_to_fill = ~df[COLUMN_NAME_ML_USE].isin(ALL_ML_USES)
df.loc[rows_to_fill] = df[rows_to_fill].shift(
axis=1, fill_value=ML_USE_UNASSIGNED
)
def replace_unassigned_ml_use(
ml_uses: List[str],
split_ratio: Sequence[float],
):
"""Replace `unassigned` in ml_uses with `training`, `validation`, and `test` with ratios according to split_ratio.
Args:
ml_uses: List of ml_use string values.
split_ratio: Proportions to split into `training`, `validation`, and `test`.
"""
unassigned_indices = [
i for i, ml_use in enumerate(ml_uses) if ml_use == ML_USE_UNASSIGNED
]
ml_use_arr = create_ml_use_array_with_split(
len(unassigned_indices), split_ratio
)
for unassigned_index, ml_use in zip(unassigned_indices, ml_use_arr):
ml_uses[unassigned_index] = ml_use
def merge_seq_into_dicts(
key: str, values: Sequence[Any], dicts: Sequence[Dict[Any, Any]]
):
"""Merges a list of values into a list of dicts, inserted with the given key.
Args:
key: Key to insert or overwrite in the dictionary.
values: A list of values to insert.
dicts: A list of dictionaries. Each value will be inserted into the
corresponding dictionary. The original value will be overwritten if the
key already existed.
Raises:
ValueError: The values and dicts have different lengths.
"""
if len(values) != len(dicts):
raise ValueError(
f'Length of values and dicts must match, got {len(values)} and'
f' {len(dicts)}'
)
for val, d in zip(values, dicts):
d[key] = val
def drop_invalid_rows(df: pd.DataFrame) -> int:
"""Drops DataFrame rows missing the gcs_file_path column or the label column.
Args:
df: The DataFrame to process in place.
Returns:
The number of rows dropped.
"""
original_rows = df.shape[0]
df.dropna(subset=[COLUMN_NAME_GCS_FILE_PATH, COLUMN_NAME_LABEL], inplace=True)
dropped_num = original_rows - df.shape[0]
if dropped_num > 0:
df.reset_index(drop=True, inplace=True)
return dropped_num
def check_split_ratio(split_ratio: Sequence[float]):
"""Checks if the give split ratio is valid.
Args:
split_ratio: Proportions to split into 'training', 'validation', and 'test'
Raises:
ValueError: Must have valid entries, correct length, and sum to 1.
"""
if len(split_ratio) != 3:
raise ValueError('split_ratio must contain exactly 3 values.')
if abs(sum(split_ratio) - 1) > _SPLIT_RATIO_ERROR_THRESHOLD:
raise ValueError('split_ratio must sum to 1.')
if not all([0 <= val <= 1 for val in split_ratio]):
raise ValueError('Entries of split_ratio must be in the range [0, 1].')
def check_num_shard(num_shard: Sequence[int]):
"""Checks if the number of shards is valid.
Args:
num_shard: The number of shards for each tfrecord.
Raises:
ValueError: Must have valid entries and correct length.
"""
if len(num_shard) != 3:
raise ValueError('num_shard must contain exactly 3 values.')
if not all([val >= 1 for val in num_shard]):
raise ValueError('Shards must be at least 1.')
def create_label_map_yaml(meta_data_path: str, output_dir: str) -> None:
"""Generate label_map.yaml from meta_data.yaml.
Args:
meta_data_path: Path to a meta_data.yaml file.
output_dir: Directory to output label_map.yaml.
"""
tf.io.gfile.copy(
meta_data_path, os.path.join(output_dir, LABEL_MAP_NAME), overwrite=True
)
def reformat_bbox(
bbox: Sequence[int], img_width: int, img_height: int
) -> Tuple[float, float, float, float]:
"""Converts XYWH unnormalized bounding box with to a normalized XYXY bounding box.
Args:
bbox: Relative bounding box with unnormalized coordinates as [x, y, width,
height].
img_width: Image's pixel width.
img_height: Image's pixel height.
Returns:
Absolute bounding box with normalized coordinates as
[xmin, ymin, xmax, ymax].
"""
x, y, width, height = bbox
xmin = x / img_width
ymin = y / img_height
xmax = (x + width) / img_width
ymax = (y + height) / img_height
return xmin, ymin, xmax, ymax
def encode_image(
filepath: str,
output_shape: Optional[Sequence[int]] = None,
image_format: str = 'png',
) -> Tuple[bytes, Sequence[int]]:
"""Encodes an image at the given path.
Args:
filepath: Path to the image.
output_shape: The output shape of the image, (height, width).
image_format: The format of the output image.
Returns:
The encoded image data in bytes and the shape of the image, (height, width).
Raises:
IOError: The image file is corrupt.
"""
filepath = fileutils.force_gcs_fuse_path(filepath)
with open(filepath, 'rb') as f:
# If an output_shape is specified, resize the image and set data to the new
# bytes.
try:
img = Image.open(f)
except PIL.UnidentifiedImageError as e:
raise IOError(f'Failed to open {filepath}') from e
try:
if output_shape is not None:
rgb_img = img.resize((output_shape[1], output_shape[0])).convert('RGB')
else:
rgb_img = img.convert('RGB')
rgb_img = np.array(rgb_img)
_, data = cv2.imencode(f'.{image_format}', rgb_img)
data = data.tobytes()
return data, rgb_img.shape
except cv2.error as e:
raise IOError(f'Failed to encode {filepath}') from e
finally:
img.close()
def encode_video(
filepath: str,
start_sec: float,
end_sec: float,
output_fps: int = 5,
output_shape: Optional[Sequence[int]] = None,
image_format: str = 'jpg',
) -> Sequence[bytes]:
"""Encodes a video clip at the given path with start and end timestamps.
Args:
filepath: Path to the video.
start_sec: Start timestamp of the video clip in seconds.
end_sec: End timestamp of the video clip in seconds.
output_fps: The output frame rate per second.
output_shape: The output shape of each frame, (height, width).
image_format: The format of the encoded frames.
Returns:
A list of the encoded frames data in bytes.
Raises:
IOError if the video file is corrupt.
"""
filepath = fileutils.force_gcs_fuse_path(filepath)
video = None
try:
video = cv2.VideoCapture(filepath)
frames = []
frame_interval = 1 / output_fps
total_frames = video.get(cv2.CAP_PROP_FRAME_COUNT)
original_fps = video.get(cv2.CAP_PROP_FPS)
if not original_fps:
# 0 or None indicates the video is invalid
raise IOError(f'Failed to load {filepath}')
video_length = total_frames / original_fps
start_sec = max(start_sec, 0)
end_sec = min(end_sec, video_length)
for t in np.arange(start_sec, end_sec, frame_interval):
frame_idx = min(total_frames - 1, round(t * original_fps))
video.set(cv2.CAP_PROP_POS_FRAMES, frame_idx)
ret, frame = video.read()
if not ret:
raise IOError(f'Failed to load {filepath} at frame {frame_idx}')
if output_shape is not None:
frame = cv2.resize(frame, (output_shape[1], output_shape[0]))
_, data = cv2.imencode(f'.{image_format}', frame)
frames.append(data.tobytes())
except cv2.error as e:
raise IOError(f'Failed to load {filepath}') from e
finally:
if video:
video.release()
return frames
def create_label_map(
labels: Sequence[str],
) -> Tuple[Sequence[int], Dict[int, str]]:
"""Creates a label map from a sequence of label strings.
Args:
labels: The sequence of labels to create label map from. Must not contain
invalid values, which means data without labels should be filtered first.
Returns:
The integer labels and the mapping from integers to the original strings.
"""
inverse_label_map: Dict[str, int] = dict()
num_labels = 0
for label in labels:
if label not in inverse_label_map:
num_labels += 1
inverse_label_map[label] = num_labels
int_labels = [inverse_label_map[label] for label in labels]
label_map = {value: key for key, value in inverse_label_map.items()}
return int_labels, label_map
def write_label_map(output_file: str, label_map: Dict[int, str]) -> None:
"""Writes a label map to the output file, which can be a GCS uri."""
with tf.io.gfile.GFile(output_file, 'w') as f:
yaml.dump({'label_map': label_map}, f)
def detectron_json_to_image_rows(input_json: str) -> list[Dict[str, Any]]:
"""Converts a Detectron JSON file to a list of image rows.
Args:
input_json: A path to a Detectron JSON or JSONL file.
Returns:
A list of dictionaries, where each dictionary contains Detectron format
entry.
Raises:
ValueError: If the input JSON is invalid.
"""
image_rows = []
with tf.io.gfile.GFile(input_json, 'r') as f:
for line in f:
json_data = json.loads(line)
if isinstance(json_data, dict):
image_rows.append(json_data)
elif isinstance(json_data, list):
image_rows.extend(json_data)
else:
raise ValueError(
'The input JSON is invalid. Dict or list is expected, but got '
f'{type(json_data)}.'
)
return image_rows
def coco_json_to_image_rows(
input_json: str,
) -> List[Dict[str, Any]]:
"""Converts a COCO JSON file to a list of image rows.
Args:
input_json: A path to a COCO JSON or JSONL file.
Returns:
A list of dictionaries, where each dictionary contains COCO format entry.
Raises:
ValueError: If the input JSON is invalid.
"""
with tf.io.gfile.GFile(input_json, 'r') as f:
coco_json = json.load(f)
if 'annotations' not in coco_json:
raise ValueError('"annotations" is not in the dataset.')
if 'images' not in coco_json:
raise ValueError('"images" is not in the dataset.')
images = coco_json['images']
return images
def partition_by_ml_use(element: Dict[str, Any], num_partitions: int) -> int:
"""Beam partition function to split data by ml_use."""
del num_partitions
try:
partition = ALL_ML_USES.index(element[COLUMN_NAME_ML_USE])
except Exception as e:
raise ValueError(f'Invalid ML use: {element[COLUMN_NAME_ML_USE]}') from e
return partition
def run_beam_pipeline(pipeline: Any) -> None:
"""Runs a beam pipeline. Works in both internal and docker environment."""
options = pipeline_options.PipelineOptions([
'--runner=FlinkRunner',
'--faster_copy',
'--max_parallelism', '8',
])
p = beam.Pipeline(options=options)
pipeline(p)
result = p.run()
result.wait_until_finish()
for counter in result.metrics().query()['counters']:
logging.info('%s counter: %s.', counter.key.metric.name, counter)
logging.info('Completing beam pipeline.')
def beam_convert_tfexamples(
root: beam.Pipeline,
data_list: Sequence[Dict[str, Any]],
convert_fn: Callable[[Dict[str, Any]], tf.train.Example],
output_dir: str,
num_shards: Sequence[int],
) -> None:
"""Constructs beam pipelines to convert train, val, test TF Examples."""
names = [TRAIN_TFRECORD_NAME, VALIDATION_TFRECORD_NAME, TEST_TFRECORD_NAME]
split_data = (
root
| 'Create PCollection' >> beam.Create(data_list)
| 'Data split' >> beam.Partition(partition_by_ml_use, 3)
)
for i in range(3):
ml_use: str = ALL_ML_USES[i]
num_shard = num_shards[i]
output_prefix = os.path.join(output_dir, names[i])
_ = (
split_data[i]
| f'Convert {ml_use} TF Examples'
>> beam.ParDo(WriteToTFRecord(output_prefix, num_shard, convert_fn))
| f'Group {ml_use} TF Record files' >> beam.GroupBy(lambda x: x[0])
| f'Merge {ml_use} TF Record files'
>> beam.Map(merge_tfrecords_func(output_prefix, num_shard))
)
def merge_tfrecords_func(output_prefix: str, num_shard: int) -> ...:
"""Returns a function to merge sharded worker output into expected shards."""
output_prefix = fileutils.force_gcs_fuse_path(output_prefix)
def merge_tfrecords(worker_output: Tuple[int, Sequence[Tuple[int, str]]]):
idx = worker_output[0]
files: Sequence[str] = np.unique([x[1] for x in worker_output[1]])
output_file = f'{output_prefix}-{idx:05d}-of-{num_shard:05d}'
with open(output_file, 'wb') as f:
for file in files:
logging.info('Merging %s.', file)
file = fileutils.force_gcs_fuse_path(file)
with open(file, 'rb') as fin:
while True:
data = fin.read(READ_CHUNK_SIZE)
if not data:
break
f.write(data)
os.remove(file)
return merge_tfrecords
@@ -0,0 +1,111 @@
r"""Converts COCO labels as yamls for model garden playground (IOD).
"""
import os
import urllib.request
from absl import app
from absl import flags
import tensorflow as tf
import yaml
from object_detection.utils import label_map_util
_CONVERT_LABEL_TYPE_COCO_80 = 'coco_80'
_CONVERT_LABEL_TYPE_COCO_91 = 'coco_91'
_CONVERT_LABEL_TYPE = flags.DEFINE_enum(
'convert_label_type',
None,
[
_CONVERT_LABEL_TYPE_COCO_80,
_CONVERT_LABEL_TYPE_COCO_91,
],
'Different types of label type conversion.',
required=True,
)
_TEMPORARY_PATH = flags.DEFINE_string(
'temporary_path',
None,
'The tempory path.',
required=True,
)
_OUTPUT_YAML_FILEPATH = flags.DEFINE_string(
'output_yaml_filepath',
None,
'The output yaml filepath.',
required=True,
)
def convert_coco_label_map_91(
output_yaml_filepath: str,
) -> None:
"""Converts coco label map 91."""
input_proto_filepath = 'https://raw.githubusercontent.com/tensorflow/models/master/research/object_detection/data/mscoco_label_map.pbtxt'
local_input_proto_filepath = os.path.join(
_TEMPORARY_PATH.value, 'mscoco_label_map.pbtxt'
)
with open(local_input_proto_filepath, 'w') as writer:
contents = (
urllib.request.urlopen(input_proto_filepath).read().decode('utf-8')
)
writer.write(contents)
label_map = label_map_util.load_labelmap(local_input_proto_filepath)
label_map_dict = label_map_util.get_label_map_dict(
label_map, use_display_name=True
)
swapped_label_map_dict = {v: k for k, v in label_map_dict.items()}
print(swapped_label_map_dict)
# Saves new label maps as yamls.
with tf.io.gfile.GFile(output_yaml_filepath, 'w') as writer:
writer.write(yaml.dump(swapped_label_map_dict))
def convert_coco_label_map_80(
output_yaml_filepath: str,
) -> None:
"""Converts coco label map 80."""
# Loads label maps from texts.
input_text_filepath = 'https://gist.githubusercontent.com/AruniRC/7b3dadd004da04c80198557db5da4bda/raw/2f10965ace1e36c4a9dca76ead19b744f5eb7e88/ms_coco_classnames.txt'
local_input_text_filepath = os.path.join(
_TEMPORARY_PATH.value, 'ms_coco_classnames.txt'
)
with open(local_input_text_filepath, 'w') as writer:
contents = (
urllib.request.urlopen(input_text_filepath).read().decode('utf-8')
)
writer.write(contents)
with open(local_input_text_filepath, 'r') as file:
content = file.read()
label_map = yaml.safe_load(content)
# Removes background in label maps.
new_label_map = {}
for k, v in label_map.items():
if k == 0:
continue
new_label_map[k - 1] = v
print(new_label_map)
# Saves new label maps as yamls.
with tf.io.gfile.GFile(output_yaml_filepath, 'w') as writer:
writer.write(yaml.dump(new_label_map))
def main(_) -> None:
if _CONVERT_LABEL_TYPE.value == _CONVERT_LABEL_TYPE_COCO_80:
convert_coco_label_map_80(_OUTPUT_YAML_FILEPATH.value)
elif _CONVERT_LABEL_TYPE.value == _CONVERT_LABEL_TYPE_COCO_91:
convert_coco_label_map_91(
_OUTPUT_YAML_FILEPATH.value,
)
else:
print('Not supported convert label type: ', _CONVERT_LABEL_TYPE.value)
if __name__ == '__main__':
app.run(main)
@@ -0,0 +1,86 @@
r"""Converts ImageNet label texts as yamls for model garden playground.
# ImageNet1K will have label maps with background.
"""
import urllib.request
from absl import app
from absl import flags
import tensorflow as tf
import yaml
_INPUT_TEXT_FILEPATH = flags.DEFINE_string(
'input_text_filepath',
None,
'The input text filepath.',
required=True,
)
_ADD_BACKGROUND_LABEL = flags.DEFINE_boolean(
'add_background_label',
None,
'Whether or not add background labels.',
required=True,
)
_ADD_IDS = flags.DEFINE_boolean(
'add_ids',
None,
'Whether or not add ids.',
required=True,
)
_OUTPUT_YAML_FILEPATH = flags.DEFINE_string(
'output_yaml_filepath',
None,
'The output yaml filepath.',
required=True,
)
def convert_imagenet_label_map_from_text_to_yaml(
input_text_filepath: str,
add_background_label: bool,
add_ids: bool,
output_yaml_filepath: str,
) -> None:
"""Converts imagenet label map from text to yamls."""
label_map = {}
# Shifts all keys by 1, and add 0 as 'background'.
if add_background_label:
label_map = yaml.safe_load(
urllib.request.urlopen(input_text_filepath).read()
)
new_label_map = {}
for key, value in label_map.items():
new_label_map[key + 1] = value
new_label_map[0] = 'background'
label_map = new_label_map
# Adds maps from id to each line.
if add_ids:
lines = urllib.request.urlopen(input_text_filepath).readlines()
current_id = 0
for line in lines:
label_map[current_id] = line.decode('ascii').strip()
print(label_map[current_id])
current_id += 1
# Saves new label maps as yamls.
with tf.io.gfile.GFile(output_yaml_filepath, 'w') as writer:
writer.write(yaml.dump(label_map))
def main(_) -> None:
convert_imagenet_label_map_from_text_to_yaml(
_INPUT_TEXT_FILEPATH.value,
_ADD_BACKGROUND_LABEL.value,
_ADD_IDS.value,
_OUTPUT_YAML_FILEPATH.value,
)
if __name__ == '__main__':
app.run(main)
@@ -0,0 +1,199 @@
"""Converts ICN CSV/JSONL files to TFRecord with apache beam."""
import json
from os import path
from typing import Any, Dict, Sequence, Union, cast
from absl import logging
import apache_beam as beam
import pandas as pd
import tensorflow as tf
from data_converter import common_lib
_COLUMN_NAMES = [
common_lib.COLUMN_NAME_ML_USE,
common_lib.COLUMN_NAME_GCS_FILE_PATH,
common_lib.COLUMN_NAME_LABEL,
]
_JSON_GCS_URI_KEY = 'imageGcsUri'
_JSON_CLASS_ANNOTATION_KEY = 'classificationAnnotation'
_JSON_RESOURCE_LABEL_KEY = 'dataItemResourceLabels'
_JSON_CLASS_NAME_KEY = 'displayName'
_JSON_ML_USE_KEY = 'aiplatform.googleapis.com/ml_use'
def build_tf_example(element: Dict[str, Union[str, int]]) -> tf.train.Example:
"""Builds a TF Example from an image uri and label.
Args:
element: A dict with the keys gcs_file_path and label.
Returns:
The created TF Example.
"""
image_uri = cast(str, element[common_lib.COLUMN_NAME_GCS_FILE_PATH])
label = cast(int, element[common_lib.COLUMN_NAME_LABEL])
image_bytes, shape = common_lib.encode_image(image_uri, image_format='jpeg')
features = tf.train.Features(
feature={
'image/encoded': common_lib.convert_to_feature(image_bytes),
'image/format': common_lib.convert_to_string_feature('jpeg'),
'image/height': common_lib.convert_to_feature(shape[0]),
'image/width': common_lib.convert_to_feature(shape[1]),
'image/class/label': common_lib.convert_to_feature(label),
},
)
return tf.train.Example(features=features)
def _run_convert_pipeline(
output_dir: str, df: pd.DataFrame, num_shards: Sequence[int]
) -> None:
"""Starts a Beam pipeline to write DataFrame as TF Records.
Args:
output_dir: TF Records output directory.
df: DataFrame to convert from.
num_shards: Number of shards for train/validation/test TFRecord files.
"""
images_list = df.to_dict('records')
def pipeline(root: beam.Pipeline):
common_lib.beam_convert_tfexamples(
root,
images_list,
build_tf_example,
output_dir,
num_shards,
)
common_lib.run_beam_pipeline(pipeline)
def _convert_df_to_tfrecord(
df: pd.DataFrame,
output_dir: str,
split_ratio: Sequence[float],
num_shard: Sequence[int],
) -> None:
"""Converts a DataFrame into three separate tfrecords for training, validation, and testing into output_dir.
Args:
df: DataFrame to convert.
output_dir: The directory to save TFRecords and label_map.yaml.
split_ratio: List specifying the training, validation, and testing splits
for unassigned TFRecords.
num_shard: Number of shards for train/validation/test TFRecord files.
"""
# Replaces ml_use with common_lib string constants for consistency.
common_lib.format_ml_use_column(df)
common_lib.insert_missing_ml_use(df)
# Ignores invalid rows.
dropped_row_num = common_lib.drop_invalid_rows(df)
if dropped_row_num > 0:
logging.warning('Ignored %d invalid rows.', dropped_row_num)
common_lib.replace_unassigned_ml_use(
df[common_lib.COLUMN_NAME_ML_USE], split_ratio
)
# Converts labels to integers as required by training.
new_labels, label_map = common_lib.create_label_map(
df[common_lib.COLUMN_NAME_LABEL]
)
df[common_lib.COLUMN_NAME_LABEL] = new_labels
label_map_path = path.join(output_dir, common_lib.LABEL_MAP_NAME)
logging.info('Writing label map to %s.', label_map_path)
common_lib.write_label_map(label_map_path, label_map)
_run_convert_pipeline(output_dir, df, num_shard)
def convert_csv_to_tfrecord(
input_csv: str,
output_dir: str,
split_ratio: Sequence[float] = (0.8, 0.1, 0.1),
num_shard: Sequence[int] = (10, 10, 10),
) -> None:
"""Parses input_csv file into three separate tfrecords for training, validation, and testing into output_dir.
The csv format is shown in
https://cloud.google.com/vertex-ai/docs/image-data/classification/prepare-data#csv.
If an ml_use column is not provided, one will be created.
label_map.yaml containing the label map will be placed in output_dir.
Args:
input_csv: Name of the csv file.
output_dir: The directory to save TFRecords and label_map.yaml.
split_ratio: List specifying the training, validation, and testing splits
for unassigned TFRecords.
num_shard: Number of shards for train/validation/test TFRecord files.
"""
with tf.io.gfile.GFile(input_csv, 'r') as f:
df: pd.DataFrame = pd.read_csv(
f, header=None, names=_COLUMN_NAMES, on_bad_lines='warn'
)
_convert_df_to_tfrecord(df, output_dir, split_ratio, num_shard)
def convert_jsonl_to_tfrecord(
input_jsonl: str,
output_dir: str,
split_ratio: Sequence[float] = (0.8, 0.1, 0.1),
num_shard: Sequence[int] = (10, 10, 10),
) -> None:
"""Parses input_jsonl file into three separate tfrecords for training, validation, and testing into output_dir.
The JSONL format is shown in
https://cloud.google.com/vertex-ai/docs/image-data/classification/prepare-data#json-lines.
If an ml_use column is not provided, one will be created.
label_map.yaml containing the label map will be placed in output_dir.
Args:
input_jsonl: Name of the JSONL file.
output_dir: The directory to save TFRecords and label_map.yaml.
split_ratio: List specifying the training, validation, and testing splits
for unassigned TFRecords.
num_shard: Number of shards for train/validation/test TFRecord files.
"""
df_rows = []
with tf.io.gfile.GFile(input_jsonl, 'r') as f:
lines = f.read().rstrip().splitlines()
for i, line in enumerate(lines, 1):
try:
item: Dict[str, Any] = json.loads(line)
gcs_uri = item.get(_JSON_GCS_URI_KEY)
label = item.get(_JSON_CLASS_ANNOTATION_KEY, {}).get(_JSON_CLASS_NAME_KEY)
if not gcs_uri or not label:
logging.warning('Invalid JSON at line %d, skipped.', i)
continue
ml_use = item.get(_JSON_RESOURCE_LABEL_KEY, {}).get(
_JSON_ML_USE_KEY, common_lib.ML_USE_UNASSIGNED
)
except (json.JSONDecodeError, AttributeError):
logging.warning('Invalid JSON at line %d, skipped.', i)
continue
df_rows.append([ml_use, gcs_uri, label])
df = pd.DataFrame(
data=df_rows,
columns=[
common_lib.COLUMN_NAME_ML_USE,
common_lib.COLUMN_NAME_GCS_FILE_PATH,
common_lib.COLUMN_NAME_LABEL,
],
)
_convert_df_to_tfrecord(df, output_dir, split_ratio, num_shard)
@@ -0,0 +1,430 @@
"""Converts IOD dataset files to TFRecord with apache beam."""
import collections
import json
from os import path
from typing import Any, Dict, Sequence
from absl import logging
import apache_beam as beam
import pandas as pd
import tensorflow as tf
from data_converter import common_lib
from util import constants
COLUMN_NAME_LABEL_INT = 'label_int'
_COLUMN_NAME_XMIN = 'X_MIN'
_COLUMN_NAME_YMIN = 'Y_MIN'
_COLUMN_NAME_XMAX = 'X_MAX'
_COLUMN_NAME_YMAX = 'Y_MAX'
COLUMN_NAMES = [
common_lib.COLUMN_NAME_ML_USE,
common_lib.COLUMN_NAME_GCS_FILE_PATH,
common_lib.COLUMN_NAME_LABEL,
_COLUMN_NAME_XMIN,
_COLUMN_NAME_YMIN,
'XMAX_NOT_USED',
'YMIN_NOT_USED',
_COLUMN_NAME_XMAX,
_COLUMN_NAME_YMAX,
'XMIN_NOT_USED',
'YMAX_NOT_USED',
]
_BOUNDING_BOX_COLUMNS = [
_COLUMN_NAME_XMIN,
_COLUMN_NAME_YMIN,
_COLUMN_NAME_XMAX,
_COLUMN_NAME_YMAX,
]
_JSON_BBOX_ANNOTATIONS_KEY = 'boundingBoxAnnotations'
_JSON_DISPLAY_NAME_KEY = 'displayName'
_JSON_X_MIN_KEY = 'xMin'
_JSON_X_MAX_KEY = 'xMax'
_JSON_Y_MIN_KEY = 'yMin'
_JSON_Y_MAX_KEY = 'yMax'
def build_tf_example(image_row: Dict[str, Any]) -> tf.train.Example:
"""Builds a TF Example from an image row.
Args:
image_row: A dictionary containing information about the image, such as its
GCS uri, labels, and bounding box coordinates.
Returns:
A tf.train.Example containing the encoded image and optionally a
bounding box and label.
"""
image_uri = image_row[common_lib.COLUMN_NAME_GCS_FILE_PATH]
image_bytes, shape = common_lib.encode_image(image_uri, image_format='jpeg')
feature = {
'image/encoded': common_lib.convert_to_feature(image_bytes),
'image/format': common_lib.convert_to_string_feature('jpeg'),
'image/height': common_lib.convert_to_feature(shape[0]),
'image/width': common_lib.convert_to_feature(shape[1]),
'image/source_id': common_lib.convert_to_string_feature(image_uri),
'image/object/bbox/xmin': common_lib.convert_to_feature(
image_row[_COLUMN_NAME_XMIN]
),
'image/object/bbox/ymin': common_lib.convert_to_feature(
image_row[_COLUMN_NAME_YMIN]
),
'image/object/bbox/xmax': common_lib.convert_to_feature(
image_row[_COLUMN_NAME_XMAX]
),
'image/object/bbox/ymax': common_lib.convert_to_feature(
image_row[_COLUMN_NAME_YMAX]
),
'image/object/class/text': common_lib.convert_to_list_string_feature(
image_row[common_lib.COLUMN_NAME_LABEL]
),
'image/object/class/label': common_lib.convert_to_feature(
image_row[COLUMN_NAME_LABEL_INT]
),
}
return tf.train.Example(features=tf.train.Features(feature=feature))
def _run_convert_pipeline(
output_dir: str,
image_rows: Sequence[Dict[str, Any]],
num_shards: Sequence[int],
) -> None:
"""Starts a Beam pipeline to write DataFrame as TF Records.
Args:
output_dir: TF Records output directory.
image_rows: Contains all necessary information to create a TF Example.
num_shards: Number of shards for train/validation/test TFRecord files.
"""
def pipeline(root: beam.Pipeline):
common_lib.beam_convert_tfexamples(
root,
image_rows,
build_tf_example,
output_dir,
num_shards,
)
common_lib.run_beam_pipeline(pipeline)
def _convert_df_to_tfrecord(
df: pd.DataFrame,
output_dir: str,
split_ratio: Sequence[float],
num_shard: Sequence[int],
) -> None:
"""Converts a DataFrame into three separate tfrecords for training, validation, and testing into output_dir.
Args:
df: DataFrame to convert.
output_dir: The directory to save TFRecords and label_map.yaml.
split_ratio: List specifying the training, validation, and testing splits
for unassigned TFRecords.
num_shard: Number of shards for train/validation/test TFRecord files.
"""
# Replaces ml_use with common_lib string constants for consistency.
common_lib.format_ml_use_column(df)
common_lib.insert_missing_ml_use(df)
# Specify bounding box columns to be numeric.
df[_BOUNDING_BOX_COLUMNS] = df[_BOUNDING_BOX_COLUMNS].apply(pd.to_numeric)
# Ignores invalid rows.
dropped_row_num = common_lib.drop_invalid_rows(df)
dropped_row_num += drop_rows_without_bbox(df)
if dropped_row_num > 0:
logging.warning('Ignored %d invalid rows.', dropped_row_num)
# Converts labels to integers as required by training.
int_labels, label_map = common_lib.create_label_map(
df[common_lib.COLUMN_NAME_LABEL]
)
df[COLUMN_NAME_LABEL_INT] = int_labels
label_map_path = path.join(output_dir, common_lib.LABEL_MAP_NAME)
logging.info('Writing label map to %s.', label_map_path)
common_lib.write_label_map(label_map_path, label_map)
image_rows = _condense_bounding_boxes(df.to_dict(orient='records'))
ml_uses = [row[common_lib.COLUMN_NAME_ML_USE] for row in image_rows]
common_lib.replace_unassigned_ml_use(ml_uses, split_ratio)
common_lib.merge_seq_into_dicts(
common_lib.COLUMN_NAME_ML_USE, ml_uses, image_rows
)
_run_convert_pipeline(output_dir, image_rows, num_shard)
def _condense_bounding_boxes(
image_rows: Sequence[Dict[str, Any]]
) -> Sequence[Dict[str, Any]]:
"""Gather all the bounding boxes in an image and put them in the same dictionary.
Args:
image_rows: List of dictionaries, each containing information about the
image, such as its GCS uri, labels, and bounding box coordinates.
Returns:
List of dictionaries such that each contains all the bounding boxes for a
given gcs_file_path.
Raises:
RuntimeError: This is raised when the input data contains images that have
annotations in different ml_use classes.
"""
output = {}
for image_row in image_rows:
ml_use = image_row[common_lib.COLUMN_NAME_ML_USE]
gcs_file_path = image_row[common_lib.COLUMN_NAME_GCS_FILE_PATH]
label = image_row[common_lib.COLUMN_NAME_LABEL]
xmin = image_row[_COLUMN_NAME_XMIN]
ymin = image_row[_COLUMN_NAME_YMIN]
xmax = image_row[_COLUMN_NAME_XMAX]
ymax = image_row[_COLUMN_NAME_YMAX]
label_int = image_row[COLUMN_NAME_LABEL_INT]
if gcs_file_path in output:
d = output[gcs_file_path]
if ml_use != common_lib.ML_USE_UNASSIGNED:
if d[common_lib.COLUMN_NAME_ML_USE] == common_lib.ML_USE_UNASSIGNED:
d[common_lib.COLUMN_NAME_ML_USE] = ml_use
elif ml_use != d[common_lib.COLUMN_NAME_ML_USE]:
raise RuntimeError(
f'Image {gcs_file_path} can only be placed in one of'
f' training/validation/test. It is currently in {ml_use} and'
f' {d[common_lib.COLUMN_NAME_ML_USE]}.'
)
d[common_lib.COLUMN_NAME_LABEL].append(label)
d[_COLUMN_NAME_XMIN].append(xmin)
d[_COLUMN_NAME_YMIN].append(ymin)
d[_COLUMN_NAME_XMAX].append(xmax)
d[_COLUMN_NAME_YMAX].append(ymax)
d[COLUMN_NAME_LABEL_INT].append(label_int)
else:
output[gcs_file_path] = {
common_lib.COLUMN_NAME_ML_USE: ml_use,
common_lib.COLUMN_NAME_GCS_FILE_PATH: gcs_file_path,
common_lib.COLUMN_NAME_LABEL: [label],
_COLUMN_NAME_XMIN: [xmin],
_COLUMN_NAME_YMIN: [ymin],
_COLUMN_NAME_XMAX: [xmax],
_COLUMN_NAME_YMAX: [ymax],
COLUMN_NAME_LABEL_INT: [label_int],
}
return list(output.values())
def convert_csv_to_tfrecord(
input_csv: str,
output_dir: str,
split_ratio: Sequence[float] = (0.8, 0.1, 0.1),
num_shard: Sequence[int] = (10, 10, 10),
) -> None:
"""Parses input_csv file into three separate tfrecords for training, validation, and testing into output_dir.
The csv format is shown in
https://cloud.google.com/vertex-ai/docs/image-data/object-detection/prepare-data#csv.
If an ml_use column is not provided, one will be created.
label_map.yaml containing the label map will be placed in output_dir.
Args:
input_csv: Name of the csv file.
output_dir: The directory to save TFRecords and label_map.yaml.
split_ratio: List specifying the train, validation, and test splits for
unassigned TFRecords.
num_shard: Number of shards for train/validation/test TFRecord files.
"""
with tf.io.gfile.GFile(input_csv, 'r') as f:
df: pd.DataFrame = pd.read_csv(
f, header=None, names=COLUMN_NAMES, on_bad_lines='warn'
)
_convert_df_to_tfrecord(df, output_dir, split_ratio, num_shard)
def drop_rows_without_bbox(df: pd.DataFrame) -> int:
"""Drops DataFrame rows without bounding_boxes.
Args:
df: The DataFrame to process in place.
Returns:
The number of rows dropped.
"""
invalid_rows = df.index[~(df[_BOUNDING_BOX_COLUMNS].notnull().all(axis=1))]
dropped_num = len(invalid_rows)
if dropped_num > 0:
invalid_df = df.loc[invalid_rows].to_dict(orient='records')
for entry in invalid_df:
logging.warning('Skipping entry due to missing bounding box: %s.', entry)
df.drop(invalid_rows, inplace=True)
df.reset_index(drop=True, inplace=True)
return dropped_num
def convert_coco_json_categories_to_label_map(
categories: Sequence[Dict[str, Any]]
) -> Dict[int, str]:
return {category['id']: category['name'] for category in categories}
def convert_coco_json_to_tfrecord(
input_coco_json: str,
output_dir: str,
split_ratio: Sequence[float] = (0.8, 0.1, 0.1),
num_shard: Sequence[int] = (10, 10, 10),
) -> None:
"""Parses input_csv file into three separate tfrecords for training, validation, and testing into output_dir.
The COCO json format is shown here: https://cocodataset.org/#format-data.
label_map.yaml containing the label map will be placed in output_dir.
Args:
input_coco_json: Name of coco json file.
output_dir: The directory to save TFRecords and label_map.yaml.
split_ratio: List specifying the train, validation, and test splits for
dataset.
num_shard: Number of shards for train/validation/test TFRecord files.
"""
with tf.io.gfile.GFile(input_coco_json, 'r') as f:
coco_json = json.load(f)
# Writes label map from coco json categories.
label_map = convert_coco_json_categories_to_label_map(
coco_json[constants.COCO_JSON_CATEGORIES]
)
label_map_path = path.join(output_dir, common_lib.LABEL_MAP_NAME)
logging.info('Writes label map to %s.', label_map_path)
common_lib.write_label_map(label_map_path, label_map)
img_to_anns = collections.defaultdict(list)
imgs = {}
if constants.COCO_JSON_ANNOTATIONS in coco_json:
for ann in coco_json[constants.COCO_JSON_ANNOTATIONS]:
img_to_anns[ann[constants.COCO_JSON_ANNOTATION_IMAGE_ID]].append(ann)
if constants.COCO_JSON_IMAGES in coco_json:
for img in coco_json[constants.COCO_JSON_IMAGES]:
imgs[img[constants.COCO_JSON_IMAGE_ID]] = img
df_rows = []
for image_id, annotations in img_to_anns.items():
img = imgs[image_id]
for ann in annotations:
xmin, ymin, xmax, ymax = common_lib.reformat_bbox(
ann[constants.COCO_ANNOTATION_BBOX],
img[constants.COCO_JSON_IMAGE_WIDTH],
img[constants.COCO_JSON_IMAGE_HEIGHT],
)
df_rows.append([
common_lib.ML_USE_UNASSIGNED,
img[constants.COCO_JSON_IMAGE_COCO_URL],
label_map[ann[constants.COCO_JSON_ANNOTATION_CATEGORY_ID]],
xmin,
ymin,
xmax,
ymin,
xmax,
ymax,
xmin,
ymax,
ann[constants.COCO_JSON_ANNOTATION_CATEGORY_ID],
])
df = pd.DataFrame(
data=df_rows,
columns=COLUMN_NAMES + [COLUMN_NAME_LABEL_INT],
)
# Replaces ml_use with common_lib string constants for consistency.
common_lib.format_ml_use_column(df)
common_lib.insert_missing_ml_use(df)
# Species bounding box columns to be numeric.
df[_BOUNDING_BOX_COLUMNS] = df[_BOUNDING_BOX_COLUMNS].apply(pd.to_numeric)
# Ignores invalid rows.
dropped_row_num = common_lib.drop_invalid_rows(df)
dropped_row_num += drop_rows_without_bbox(df)
if dropped_row_num > 0:
logging.warning('Ignored %d invalid rows.', dropped_row_num)
image_rows = _condense_bounding_boxes(df.to_dict(orient='records'))
ml_uses = [row[common_lib.COLUMN_NAME_ML_USE] for row in image_rows]
common_lib.replace_unassigned_ml_use(ml_uses, split_ratio)
common_lib.merge_seq_into_dicts(
common_lib.COLUMN_NAME_ML_USE, ml_uses, image_rows
)
_run_convert_pipeline(output_dir, image_rows, num_shard)
def convert_jsonl_to_tfrecord(
input_jsonl: str,
output_dir: str,
split_ratio: Sequence[float] = (0.8, 0.1, 0.1),
num_shard: Sequence[int] = (10, 10, 10),
) -> None:
"""Parses input_jsonl file into three separate tfrecords for training, validation, and testing into output_dir.
The JSONL format is shown in
https://cloud.google.com/vertex-ai/docs/image-data/object-detection/prepare-data#json-lines.
If an ml_use column is not provided, one will be created.
label_map.yaml containing the label map will be placed in output_dir.
Args:
input_jsonl: Name of the JSONL file.
output_dir: The directory to save TFRecords and label_map.yaml.
split_ratio: List specifying the training, validation, and testing splits
for unassigned TFRecords.
num_shard: Number of shards for train/validation/test TFRecord files.
"""
df_rows = []
with tf.io.gfile.GFile(input_jsonl, 'r') as f:
lines = f.read().rstrip().splitlines()
for i, line in enumerate(lines, start=1):
try:
item: Dict[str, Any] = json.loads(line)
except (json.JSONDecodeError, AttributeError):
logging.warning('Invalid JSON at line %d skipped.', i)
continue
gcs_uri = item.get(common_lib.JSON_GCS_URI_KEY)
if not gcs_uri:
logging.warning(
'Invalid JSON at line %d skipped. Missing gcs_uri_key.', i
)
continue
ml_use = item.get(common_lib.JSON_RESOURCE_LABEL_KEY, {}).get(
common_lib.JSON_ML_USE_KEY, common_lib.ML_USE_UNASSIGNED
)
for bbox in item.get(_JSON_BBOX_ANNOTATIONS_KEY, []):
label = bbox.get(_JSON_DISPLAY_NAME_KEY)
xmin = bbox.get(_JSON_X_MIN_KEY)
ymin = bbox.get(_JSON_Y_MIN_KEY)
xmax = bbox.get(_JSON_X_MAX_KEY)
ymax = bbox.get(_JSON_Y_MAX_KEY)
df_rows.append([ml_use, gcs_uri, label, xmin, ymin, xmax, ymax])
df = pd.DataFrame(
data=df_rows,
columns=[
common_lib.COLUMN_NAME_ML_USE,
common_lib.COLUMN_NAME_GCS_FILE_PATH,
common_lib.COLUMN_NAME_LABEL,
_COLUMN_NAME_XMIN,
_COLUMN_NAME_YMIN,
_COLUMN_NAME_XMAX,
_COLUMN_NAME_YMAX,
],
)
_convert_df_to_tfrecord(df, output_dir, split_ratio, num_shard)
@@ -0,0 +1,328 @@
"""Python script to convert different file formats for ISG to tfrecords."""
import hashlib
import os
from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
from absl import logging
import apache_beam as beam
from apache_beam.io import tfrecordio
import cv2
import numpy as np
from pycocotools import coco
import tensorflow as tf
import yaml
from data_converter import common_lib
from util import constants
from util import fileutils
_IMAGE_FORMAT = 'PNG'
def build_tf_example(
image_info: dict[str, Union[str, int]],
segmentation_image: List[List[int]],
output_shape: Optional[Tuple[int, int]] = None,
) -> tf.train.Example:
"""Encodes an image and its segmentation mask into a tf.train.Example.
Args:
image_info: A dictionary containing information about the image, such as its
file name, height, and width.
segmentation_image: 2D image in list of lists having category ids.
output_shape: The desired output shape of the image. If None, the original
image shape will be used.
Returns:
A tf.train.Example containing the encoded image and segmentation mask.
Raises:
IOError: If image cannot be found in the path.
"""
file_name = image_info[constants.COCO_JSON_FILE_NAME]
height = int(image_info[constants.COCO_JSON_IMAGE_HEIGHT])
width = int(image_info[constants.COCO_JSON_IMAGE_WIDTH])
segmentation_image = np.expand_dims(
np.asarray(segmentation_image, dtype=np.int32), axis=-1
)
_, encoded_seg = cv2.imencode(f'.{_IMAGE_FORMAT.lower()}', segmentation_image)
encoded_seg = encoded_seg.tobytes()
encoded_img, _ = common_lib.encode_image(
image_info[constants.COCO_JSON_IMAGE_COCO_URL],
output_shape=output_shape,
image_format=_IMAGE_FORMAT.lower(),
)
key = hashlib.sha256(encoded_img).hexdigest()
return tf.train.Example(
features=tf.train.Features(
feature={
'image/height': common_lib.convert_to_feature(height),
'image/width': common_lib.convert_to_feature(width),
'image/filename': common_lib.convert_to_string_feature(file_name),
'image/sha256': common_lib.convert_to_string_feature(key),
'image/encoded': common_lib.convert_to_feature(encoded_img),
'image/format': common_lib.convert_to_string_feature(
_IMAGE_FORMAT
),
'image/segmentation/class/encoded': common_lib.convert_to_feature(
encoded_seg
),
'image/segmentation/class/format': (
common_lib.convert_to_string_feature(_IMAGE_FORMAT)
),
'image/segmentation/class/height': common_lib.convert_to_feature(
height
),
'image/segmentation/class/width': common_lib.convert_to_feature(
width
),
}
)
)
class AcquireTFExampleDoFn(beam.DoFn):
"""Beam DoFn to build TF Examples from a single row of image_info data."""
# These tags will be used to tag the outputs of this DoFn.
output_tag_train = constants.ML_USE_TRAINING
output_tag_validation = constants.ML_USE_VALIDATION
output_tag_test = constants.ML_USE_TEST
valid_ml_use_set = set(
[output_tag_train, output_tag_validation, output_tag_test]
)
def __init__(self, output_shape: Optional[Tuple[int, int]] = None):
self.acquired_examples_counter = beam.metrics.Metrics.counter(
self.__class__.__name__, 'Success'
)
self.failure_counter = beam.metrics.Metrics.counter(
self.__class__.__name__, 'Failure'
)
self.output_shape = output_shape
def process(
self,
row: Tuple[str, Dict[str, Union[str, int]], List[List[int]]],
) -> Iterator[tf.train.Example]:
ml_use, image_info, annotation_info = row
if ml_use not in self.valid_ml_use_set:
logging.warning('ml_use invalid: %s', ml_use)
self.failure_counter.inc()
return
try:
tf_example = build_tf_example(
image_info, annotation_info, self.output_shape
)
except IOError as e:
logging.warning('Failed to build TF Example: %s', e)
self.failure_counter.inc()
else:
self.acquired_examples_counter.inc()
yield beam.pvalue.TaggedOutput(ml_use, tf_example)
def _define_data_conversion_pipeline(
root: beam.Pipeline,
ml_use_rows: List[str],
image_rows: List[Dict[str, Union[str, int]]],
segmentation_rows: List[List[List[int]]],
output_dir: str,
output_shape: Optional[Tuple[int, int]],
num_shard_list: List[int],
):
"""Define a data conversion pipeline.
Args:
root: A Beam pipeline.
ml_use_rows: List containing the ml_use.
image_rows: List of dictionaries containing information about the image,
such as its file name, height, and width.
segmentation_rows: List of 2D images of integers representing segmentation
masks.
output_dir: Directory where the output TFRecords will be written.
output_shape: Desired output shape of the image. If None, the original image
shape will be used.
num_shard_list: Number of shards to write to each output TFRecord.
Returns:
A Beam pipeline.
"""
train, validation, test = (
root
| 'Load ml use and image rows to beam'
>> beam.Create(zip(ml_use_rows, image_rows, segmentation_rows))
| 'Build TF Examples'
>> beam.ParDo(AcquireTFExampleDoFn(output_shape)).with_outputs(
AcquireTFExampleDoFn.output_tag_train,
AcquireTFExampleDoFn.output_tag_validation,
AcquireTFExampleDoFn.output_tag_test,
)
)
# Save each split to TFRecord.
_ = train | 'Save train split to TFRecord' >> tfrecordio.WriteToTFRecord(
os.path.join(output_dir, common_lib.TRAIN_TFRECORD_NAME),
coder=beam.coders.ProtoCoder(tf.train.Example),
num_shards=num_shard_list[0],
)
_ = (
validation
| 'Save validation split to TFRecord'
>> tfrecordio.WriteToTFRecord(
os.path.join(output_dir, common_lib.VALIDATION_TFRECORD_NAME),
coder=beam.coders.ProtoCoder(tf.train.Example),
num_shards=num_shard_list[1],
)
)
_ = test | 'Save test split to TFRecord' >> tfrecordio.WriteToTFRecord(
os.path.join(output_dir, common_lib.TEST_TFRECORD_NAME),
coder=beam.coders.ProtoCoder(tf.train.Example),
num_shards=num_shard_list[2],
)
def _image_info_to_segmentation_image(
img: Dict[str, Any],
coco_dataset: coco.COCO,
label_id_by_category_id: Dict[int, int],
) -> List[List[int]]:
"""Convert image information to a segmentation image.
Args:
img: The image information.
coco_dataset: The COCO dataset.
label_id_by_category_id: The mapping from label id used for training to
category_id defined in dataset.
Returns:
The segmentation image.
Raises:
ValueError: If the mask size does not match the image or if a pixel has
multiple labels.
"""
seg_img = np.zeros(
shape=(
img[constants.COCO_JSON_IMAGE_HEIGHT],
img[constants.COCO_JSON_IMAGE_WIDTH],
),
dtype=np.int32,
)
for ann in coco_dataset.imgToAnns[img[constants.COCO_JSON_IMAGE_ID]]:
new_category_id = ann[constants.COCO_JSON_ANNOTATION_CATEGORY_ID]
binary_mask = coco_dataset.annToMask(ann)
if seg_img.shape != binary_mask.shape:
raise ValueError(
'Binary mask does not have the same shape as image. image_id:'
f' {img["id"]}'
)
boolean_mask = binary_mask == 1
if (seg_img[boolean_mask] != 0).any():
raise ValueError(
'Error: Some pixels have more than one label in image_id:'
f' {img["id"]}.'
)
seg_img[boolean_mask] = label_id_by_category_id[new_category_id]
return seg_img.tolist()
def get_input_rows(
coco_dataset: coco.COCO,
split_ratio: List[float],
label_id_by_category_id: Dict[int, int],
) -> Tuple[List[str], List[Dict[str, Union[str, int]]], List[List[List[int]]]]:
"""Get input rows for training and validation.
Args:
coco_dataset: The COCO dataset.
split_ratio: The split ratio for training and validation.
label_id_by_category_id: The mapping from label id used for training to
category_id defined in dataset.
Returns:
- A list of ml_use strings.
- A list of image informations.
- A list of segmentation images for the corresponding images.
"""
image_rows = coco_dataset.dataset[constants.COCO_JSON_IMAGES]
segmentation_rows = [
_image_info_to_segmentation_image(
img, coco_dataset, label_id_by_category_id
)
for img in image_rows
]
ml_use_rows = common_lib.create_ml_use_array_with_split(
len(image_rows), split_ratio
)
return ml_use_rows, image_rows, segmentation_rows
def beam_build_tfrecord_from_coco_json(
input_json: str,
output_dir: str,
split_ratio: List[float],
num_shard_list: List[int],
output_shape: Optional[Tuple[int, int]] = None,
) -> None:
"""Builds TFRecord files from COCO dataset.
The output file names are `_TRAIN_TFRECORD_NAME`, `_VALIDATION_TFRECORD_NAME`,
and `_TEST_TFRECORD_NAME`.
Args:
input_json: Path to a COCO JSON or JSONL file.
output_dir: Directory to output the TFRecord files.
split_ratio: List of how to split entries to train, validation, and test
TFRecords.
num_shard_list: List of the number of shards for each TFRecord file.
output_shape: The desired output shape of the image. If None, the original
image shape will be used.
"""
# `coco` cannot access gcs uri. Use gcsfuse, it is faster.
input_json = fileutils.force_gcs_fuse_path(input_json)
coco_dataset = coco.COCO(input_json)
label_map = {}
label_id_by_category_id = {}
for idx, category in enumerate(
coco_dataset.dataset[constants.COCO_JSON_CATEGORIES], start=1
):
label_map[idx] = category[constants.COCO_JSON_CATEGORY_NAME]
label_id_by_category_id[category[constants.COCO_JSON_CATEGORY_ID]] = idx
label_map_path = os.path.join(output_dir, common_lib.LABEL_MAP_NAME)
logging.info('Writing label map to %s.', label_map_path)
common_lib.write_label_map(label_map_path, label_map)
with tf.io.gfile.GFile(
os.path.join(output_dir, 'label_id_by_category_id.yaml'), 'w'
) as f:
yaml.dump(label_id_by_category_id, f)
ml_use_rows, image_rows, segmentation_rows = get_input_rows(
coco_dataset, split_ratio, label_id_by_category_id
)
def pipeline(root):
_define_data_conversion_pipeline(
root,
ml_use_rows,
image_rows,
segmentation_rows,
output_dir,
output_shape,
num_shard_list,
)
logging.info('Beginning beam pipeline to acquire tfrecords.')
common_lib.run_beam_pipeline(pipeline)
@@ -0,0 +1,166 @@
r"""Python script to convert user input data to training docker format.
Note: the training format is designed to be tfrecord as in the design doc.
If there are training efficiency issues for pytorch algorithms, we will also
support pytorch formats as well.
"""
from absl import app
from absl import flags
from absl import logging
from data_converter import common_lib
from data_converter import data_converter_icn_lib
from data_converter import data_converter_iod_lib
from data_converter import data_converter_isg_lib
from data_converter import data_converter_vcn_lib
from util import constants
_INPUT_FILE_PATH = flags.DEFINE_string(
'input_file_path',
None,
'Input file path.',
required=True,
)
_INPUT_FILE_TYPE = flags.DEFINE_enum(
'input_file_type',
None,
[
constants.INPUT_FILE_TYPE_CSV,
constants.INPUT_FILE_TYPE_JSONL,
constants.INPUT_FILE_TYPE_COCO_JSON,
],
'Input file type.',
required=True,
)
_OBJECTIVE = flags.DEFINE_enum(
'objective',
None,
[
constants.OBJECTIVE_IMAGE_CLASSIFICATION,
constants.OBJECTIVE_IMAGE_OBJECT_DETECTION,
constants.OBJECTIVE_IMAGE_SEGMENTATION,
constants.OBJECTIVE_VIDEO_CLASSIFICATION,
],
'The objective of this training job.',
required=True,
)
_OUTPUT_DIR = flags.DEFINE_string(
'output_dir',
None,
'The output directory for converted data and label map files.',
required=True,
)
_SPLIT_RATIO = flags.DEFINE_list(
'split_ratio',
'0.8,0.1,0.1',
'Proportion of data to split into train/validation/test.',
)
_NUM_SHARD = flags.DEFINE_list(
'num_shard', '10,10,10', 'The number of shards for train/validation/test.'
)
_OUTPUT_FPS = flags.DEFINE_integer(
'output_fps', 5, 'For videos only. The output frames rate per second.'
)
def main(_) -> None:
logging.info(
(
'Start data converter on: %s (type: %s) with split: %s for %s'
' (shard=%s), and output to %s.'
),
_INPUT_FILE_PATH.value,
_INPUT_FILE_TYPE.value,
_SPLIT_RATIO.value,
_OBJECTIVE.value,
_NUM_SHARD.value,
_OUTPUT_DIR.value,
)
split_ratio = list(map(float, _SPLIT_RATIO.value))
num_shard = list(map(int, _NUM_SHARD.value))
common_lib.check_split_ratio(split_ratio)
common_lib.check_num_shard(num_shard)
if (
_OBJECTIVE.value == constants.OBJECTIVE_IMAGE_OBJECT_DETECTION
and _INPUT_FILE_TYPE.value == constants.INPUT_FILE_TYPE_CSV
):
data_converter_iod_lib.convert_csv_to_tfrecord(
_INPUT_FILE_PATH.value,
_OUTPUT_DIR.value,
split_ratio,
num_shard,
)
elif (
_OBJECTIVE.value == constants.OBJECTIVE_IMAGE_OBJECT_DETECTION
and _INPUT_FILE_TYPE.value == constants.INPUT_FILE_TYPE_JSONL
):
data_converter_iod_lib.convert_jsonl_to_tfrecord(
_INPUT_FILE_PATH.value, _OUTPUT_DIR.value, split_ratio, num_shard
)
elif (
_OBJECTIVE.value == constants.OBJECTIVE_IMAGE_OBJECT_DETECTION
and _INPUT_FILE_TYPE.value == constants.INPUT_FILE_TYPE_COCO_JSON
):
data_converter_iod_lib.convert_coco_json_to_tfrecord(
_INPUT_FILE_PATH.value,
_OUTPUT_DIR.value,
split_ratio,
num_shard,
)
elif _OBJECTIVE.value == constants.OBJECTIVE_IMAGE_SEGMENTATION:
data_converter_isg_lib.beam_build_tfrecord_from_coco_json(
_INPUT_FILE_PATH.value,
_OUTPUT_DIR.value,
split_ratio,
num_shard,
)
elif (
_OBJECTIVE.value == constants.OBJECTIVE_IMAGE_CLASSIFICATION
and _INPUT_FILE_TYPE.value == constants.INPUT_FILE_TYPE_CSV
):
data_converter_icn_lib.convert_csv_to_tfrecord(
_INPUT_FILE_PATH.value,
_OUTPUT_DIR.value,
split_ratio,
num_shard,
)
elif (
_OBJECTIVE.value == constants.OBJECTIVE_IMAGE_CLASSIFICATION
and _INPUT_FILE_TYPE.value == constants.INPUT_FILE_TYPE_JSONL
):
data_converter_icn_lib.convert_jsonl_to_tfrecord(
_INPUT_FILE_PATH.value, _OUTPUT_DIR.value, split_ratio, num_shard
)
elif (
_OBJECTIVE.value == constants.OBJECTIVE_VIDEO_CLASSIFICATION
and _INPUT_FILE_TYPE.value == constants.INPUT_FILE_TYPE_CSV
):
data_converter_vcn_lib.convert_csv_to_tfrecord(
_INPUT_FILE_PATH.value,
_OUTPUT_DIR.value,
_OUTPUT_FPS.value,
split_ratio,
num_shard,
)
elif (
_OBJECTIVE.value == constants.OBJECTIVE_VIDEO_CLASSIFICATION
and _INPUT_FILE_TYPE.value == constants.INPUT_FILE_TYPE_JSONL
):
data_converter_vcn_lib.convert_jsonl_to_tfrecord(
_INPUT_FILE_PATH.value,
_OUTPUT_DIR.value,
_OUTPUT_FPS.value,
split_ratio,
num_shard,
)
else:
raise NotImplementedError(
f'File format {_INPUT_FILE_TYPE.value} is not supported for'
f' {_OBJECTIVE.value}.'
)
if __name__ == '__main__':
app.run(main)
@@ -0,0 +1,289 @@
"""Converts VCN CSV/JSONL files to TFRecord with apache beam."""
import json
from os import path
from typing import Any, Dict, Iterator, Sequence, Union, cast
from absl import logging
import apache_beam as beam
from apache_beam.io import tfrecordio
import numpy as np
import pandas as pd
import tensorflow as tf
from data_converter import common_lib
from util import constants
_COLUMN_NAMES = [
common_lib.COLUMN_NAME_ML_USE,
common_lib.COLUMN_NAME_GCS_FILE_PATH,
common_lib.COLUMN_NAME_LABEL,
common_lib.COLUMN_NAME_START_SEC,
common_lib.COLUMN_NAME_END_SEC,
]
_JSON_GCS_URI_KEY = 'videoGcsUri'
_JSON_CLASS_ANNOTATION_KEY = 'timeSegmentAnnotations'
_JSON_CLASS_NAME_KEY = 'displayName'
_JSON_START_TIME_KEY = 'startTime'
_JSON_END_TIME_KEY = 'endTime'
_JSON_RESOURCE_LABEL_KEY = 'dataItemResourceLabels'
_JSON_ML_USE_KEY = 'aiplatform.googleapis.com/ml_use'
def build_tf_example(
video_uri: str,
label: int,
start_sec: float,
end_sec: float,
output_fps: int,
) -> tf.train.SequenceExample:
"""Builds a TF Example from a video clip.
Args:
video_uri: GCS URI to the video file.
label: Class label as an integer.
start_sec: Start timestamp of the video clip in seconds.
end_sec: End timestamp of the video clip in seconds.
output_fps: The output frame rate per second.
Returns:
The created TF Example.
"""
frame_bytes = common_lib.encode_video(
video_uri, start_sec, end_sec, output_fps, image_format='jpg'
)
seq_example = tf.train.SequenceExample()
seq_example.context.feature['clip/label/index'].int64_list.value[:] = [label]
for frame in frame_bytes:
seq_example.feature_lists.feature_list.get_or_create(
'image/encoded'
).feature.add().bytes_list.value[:] = [frame]
return seq_example
class AcquireTFExampleDoFn(beam.DoFn):
"""Beam DoFn to build TF Examples from a DataFrame row dict for VCN."""
def __init__(self, output_fps: int):
self._success_counter = beam.metrics.Metrics.counter(
self.__class__.__name__, 'Success'
)
self._failure_counter = beam.metrics.Metrics.counter(
self.__class__.__name__, 'Failure'
)
self._output_fps = output_fps
def process(
self, element: Dict[str, Union[float, int, str]]
) -> Iterator[tf.train.SequenceExample]:
ml_use: str = cast(str, element[common_lib.COLUMN_NAME_ML_USE])
video_uri: str = cast(str, element[common_lib.COLUMN_NAME_GCS_FILE_PATH])
try:
label: int = int(element[common_lib.COLUMN_NAME_LABEL])
start_sec: float = float(element[common_lib.COLUMN_NAME_START_SEC])
end_sec: float = float(element[common_lib.COLUMN_NAME_END_SEC])
tf_example = build_tf_example(
video_uri,
label,
start_sec,
end_sec,
self._output_fps,
)
self._success_counter.inc()
yield beam.pvalue.TaggedOutput(ml_use, tf_example)
except (ValueError, IOError) as err:
logging.error('Failed to process %s', video_uri)
logging.exception(err)
self._failure_counter.inc()
def _run_convert_pipeline(
output_dir: str,
df: pd.DataFrame,
num_shards: Sequence[int],
output_fps: int,
) -> None:
"""Starts a Beam pipeline to write DataFrame as TF Records.
Args:
output_dir: TF Records output directory.
df: DataFrame to convert from.
num_shards: Number of shards for train/validation/test TFRecord files.
output_fps: The output frame rate per second.
"""
clip_list = df.to_dict('records')
def pipeline(root):
train, val, test = (
root
| 'Create PCollection' >> beam.Create(clip_list)
| 'Convert to TF Example'
>> beam.ParDo(AcquireTFExampleDoFn(output_fps)).with_outputs(
constants.ML_USE_TRAINING,
constants.ML_USE_VALIDATION,
constants.ML_USE_TEST,
)
)
_ = train | 'Save train TF Record' >> tfrecordio.WriteToTFRecord(
path.join(output_dir, common_lib.TRAIN_TFRECORD_NAME),
coder=beam.coders.ProtoCoder(tf.train.Example),
num_shards=num_shards[0],
)
_ = val | 'Save val TF Record' >> tfrecordio.WriteToTFRecord(
path.join(output_dir, common_lib.VALIDATION_TFRECORD_NAME),
coder=beam.coders.ProtoCoder(tf.train.Example),
num_shards=num_shards[1],
)
_ = test | 'Save test TF Record' >> tfrecordio.WriteToTFRecord(
path.join(output_dir, common_lib.TEST_TFRECORD_NAME),
coder=beam.coders.ProtoCoder(tf.train.Example),
num_shards=num_shards[2],
)
common_lib.run_beam_pipeline(pipeline)
def _convert_df_to_tfrecord(
df: pd.DataFrame,
output_dir: str,
split_ratio: Sequence[float],
num_shard: Sequence[int],
output_fps: int,
) -> None:
"""Converts a DataFrame into three separate tfrecords for training, validation, and testing into output_dir.
Args:
df: DataFrame to convert.
output_dir: The directory to save TFRecords and label_map.yaml.
split_ratio: List specifying the training, validation, and testing splits
for unassigned TFRecords.
num_shard: Number of shards for train/validation/test TFRecord files.
output_fps: The output frame rate per second.
"""
# Replaces ml_use with common_lib string constants for consistency.
common_lib.format_ml_use_column(df)
common_lib.insert_missing_ml_use(df)
# Ignores invalid rows.
dropped_row_num = common_lib.drop_invalid_rows(df)
if dropped_row_num > 0:
logging.warning('Ignored %d invalid rows.', dropped_row_num)
common_lib.replace_unassigned_ml_use(
df[common_lib.COLUMN_NAME_ML_USE], split_ratio
)
# Converts labels to integers as required by training.
new_labels, label_map = common_lib.create_label_map(
df[common_lib.COLUMN_NAME_LABEL]
)
df[common_lib.COLUMN_NAME_LABEL] = new_labels
label_map_path = path.join(output_dir, common_lib.LABEL_MAP_NAME)
logging.info('Writing label map to %s.', label_map_path)
common_lib.write_label_map(label_map_path, label_map)
# Missing start / end times are treated as 0, inf, respectively.
df[common_lib.COLUMN_NAME_START_SEC].fillna(0, inplace=True)
df[common_lib.COLUMN_NAME_END_SEC].fillna(np.inf, inplace=True)
_run_convert_pipeline(output_dir, df, num_shard, output_fps)
def convert_csv_to_tfrecord(
input_csv: str,
output_dir: str,
output_fps: int,
split_ratio: Sequence[float] = (0.8, 0.1, 0.1),
num_shard: Sequence[int] = (10, 10, 10),
) -> None:
"""Parses input_csv file into three separate tfrecords for training, validation, and testing into output_dir.
The csv format is shown in
https://cloud.google.com/vertex-ai/docs/video-data/classification/prepare-data#csv
If an ml_use column is not provided, one will be created.
label_map.yaml containing the label map will be placed in output_dir.
Args:
input_csv: Name of the csv file.
output_dir: The directory to save TFRecords and label_map.yaml.
output_fps: The output frame rate per second.
split_ratio: List specifying the training, validation, and testing splits
for unassigned TFRecords.
num_shard: Number of shards for train/validation/test TFRecord files.
"""
with tf.io.gfile.GFile(input_csv, 'r') as f:
df: pd.DataFrame = pd.read_csv(
f, header=None, names=_COLUMN_NAMES, on_bad_lines='warn'
)
_convert_df_to_tfrecord(df, output_dir, split_ratio, num_shard, output_fps)
def convert_jsonl_to_tfrecord(
input_jsonl: str,
output_dir: str,
output_fps: int,
split_ratio: Sequence[float] = (0.8, 0.1, 0.1),
num_shard: Sequence[int] = (10, 10, 10),
) -> None:
"""Parses input_jsonl file into three separate tfrecords for training, validation, and testing into output_dir.
The JSONL format is shown in
https://cloud.google.com/vertex-ai/docs/video-data/classification/prepare-data#jsonl.
If an ml_use column is not provided, one will be created.
label_map.yaml containing the label map will be placed in output_dir.
Args:
input_jsonl: Name of the JSONL file.
output_dir: The directory to save TFRecords and label_map.yaml.
output_fps: The output frame rate per second.
split_ratio: List specifying the training, validation, and testing splits
for unassigned TFRecords.
num_shard: Number of shards for train/validation/test TFRecord files.
"""
df_rows = []
with tf.io.gfile.GFile(input_jsonl, 'r') as f:
lines = f.read().rstrip().splitlines()
for i, line in enumerate(lines, 1):
try:
item: Dict[str, Any] = json.loads(line)
gcs_uri = item.get(_JSON_GCS_URI_KEY)
if not gcs_uri:
logging.warning('Invalid JSON at line %d, skipped.', i)
continue
annotations = item.get(_JSON_CLASS_ANNOTATION_KEY, [])
ml_use = item.get(_JSON_RESOURCE_LABEL_KEY, {}).get(
_JSON_ML_USE_KEY, common_lib.ML_USE_UNASSIGNED
)
for j, annotation in enumerate(annotations):
label = annotation.get(_JSON_CLASS_NAME_KEY)
if not label:
logging.warning('Invalid annotation #%d at line %d, skipped.', j, i)
continue
# The example in external documentation uses strings like "1.0s", so we
# need to remove the "s" suffix.
start_time = annotation.get(_JSON_START_TIME_KEY, '0').removesuffix('s')
end_time = annotation.get(_JSON_END_TIME_KEY, 'inf').removesuffix('s')
df_rows.append([ml_use, gcs_uri, label, start_time, end_time])
except (json.JSONDecodeError, AttributeError):
logging.warning('Invalid JSON at line %d, skipped.', i)
continue
df = pd.DataFrame(
data=df_rows,
columns=_COLUMN_NAMES,
)
_convert_df_to_tfrecord(df, output_dir, split_ratio, num_shard, output_fps)
@@ -0,0 +1,50 @@
FROM python:3.9
ENV DEBIAN_FRONTEND=noninteractive
# Install basic libs.
RUN apt-get update && apt-get install -y --no-install-recommends \
cmake \
curl \
wget \
sudo \
gnupg \
python3-opencv \
lsb-release \
ca-certificates \
build-essential \
git \
vim \
screen \
libportaudio2 \
libusb-1.0-0-dev \
openjdk-17-jre
# Add gcsfuse distribution URL as a package source and import its public key.
RUN echo "deb https://packages.cloud.google.com/apt gcsfuse-`lsb_release -c -s` main" | sudo tee /etc/apt/sources.list.d/gcsfuse.list
RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
# Install gcsfuse.
RUN apt-get update && apt-get install -y --no-install-recommends gcsfuse
# Install google cloud SDK.
RUN wget -q https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-359.0.0-linux-x86_64.tar.gz
RUN tar xzf google-cloud-sdk-359.0.0-linux-x86_64.tar.gz
RUN ./google-cloud-sdk/install.sh -q
# Make sure gsutil will use the default service account.
RUN echo '[GoogleCompute]\nservice_account = default' > /etc/boto.cfg
# Install required libs.
RUN pip install --upgrade pip
RUN pip install pyyaml==5.4.1
RUN pip install pycocotools==2.0.6
RUN pip install opencv-python-headless==4.7.0.72
RUN pip install numpy==1.24.2
RUN pip install pandas==1.5.3
RUN pip install Pillow==9.4.0
RUN pip install apache-beam[gcp]==2.45.0
RUN pip install object-detection==0.0.3
RUN pip install google-cloud-storage==1.42.3
RUN pip install gcsfs==2021.10.1
RUN pip install pylint==2.17.2
@@ -0,0 +1,23 @@
FROM gcr.io/automl-migration-test/automl-vision-data-converter-base:latest
# Copy license.
RUN wget https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/main/LICENSE
COPY model_oss/data_converter /automl_vision/data_converter
COPY model_oss/util /automl_vision/util
WORKDIR /automl_vision
ENV PYTHONPATH "${PYTHONPATH}:/automl_vision"
# Run pylint to validate code.
COPY .pylintrc /automl_vision/.pylintrc
RUN find . -type f -name "*.py" | xargs pylint --rcfile=./.pylintrc --errors-only
ENTRYPOINT ["python3","data_converter/data_converter_main.py"]
CMD ["--input_file_path=YOUR_INPUT_FILE",\
"--input_file_type=csv",\
"--objective=iod",\
"--output_dir=YOUR_OUTPUT_DIR",\
"--num_shard=10,10,10",\
"--split_ratio=0.8,0.1,0.1"]
@@ -0,0 +1,90 @@
# Dockerfile for Detectron2 serving.
#
# To build:
# docker build -f model_oss/detectron2/dockerfile/serving.Dockerfile . -t ${YOUR_IMAGE_TAG}
#
# To push to gcr:
# docker tag ${YOUR_IMAGE_TAG} gcr.io/${YOUR_PROJECT}/${YOUR_IMAGE_TAG}
# docker push gcr.io/${YOUR_PROJECT}/${YOUR_IMAGE_TAG}
FROM pytorch/torchserve:0.7.0-cpu
USER root
# Install tools.
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
wget \
vim
# run and update some basic packages software packages, including security libs
RUN apt-get update && apt-get install -y \
software-properties-common && \
add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
apt-get update && apt-get install -y \
gcc-9 g++-9 apt-transport-https ca-certificates gnupg curl
# Install gcloud tools for gsutil as well as debugging
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | \
tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | \
apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && \
apt-get update -y && apt-get install google-cloud-sdk -y
USER model-server
# install detectron2 dependencies
RUN python3 -m pip install --upgrade pip
RUN python3 -m pip install --user numpy==1.24.2
RUN python3 -m pip install --user opencv-python==4.7.0.72
RUN python3 -m pip install --user 'git+https://github.com/facebookresearch/detectron2.git@v0.6'
# Install GCS storage library.
RUN pip install google-cloud-storage==2.6.0
# For mask encoding.
RUN pip install --upgrade pycocotools==2.0.6
ARG MODEL_NAME=detectron2_serving
ENV MODEL_NAME="${MODEL_NAME}"
# health and prediction listener ports
ARG AIP_HTTP_PORT=7080
ENV AIP_HTTP_PORT="${AIP_HTTP_PORT}"
ARG MODEL_MGMT_PORT=7081
# expose health and prediction listener ports from the image
EXPOSE "${AIP_HTTP_PORT}"
EXPOSE "${MODEL_MGMT_PORT}"
EXPOSE 8080 8081 8082 7070 7071
# create torchserve configuration file
USER root
RUN echo "service_envelope=json\n" \
"inference_address=http://0.0.0.0:${AIP_HTTP_PORT}\n" \
"management_address=http://0.0.0.0:${MODEL_MGMT_PORT}" >> /home/model-server/config.properties
USER model-server
# Copy license.
RUN wget https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/main/LICENSE
# Copy model artifacts.
COPY ./model_oss/detectron2/handler.py /home/model-server/handler.py
WORKDIR /home/model-server/
# Create model archive file packaging model artifacts and dependencies.
# Note(lavrai): The model `.pth` file and `cfg.yaml` file will be set by the
# customer as an environment variable and will be later loaded by the
# `handler.py` file.
RUN torch-model-archiver \
--model-name="${MODEL_NAME}" \
--version=1.0 \
--handler=/home/model-server/handler.py \
--export-path=/home/model-server/model-store \
-f
# run Torchserve HTTP serve to respond to prediction requests
CMD ["ls", "-ltr", "/home/model-server/model-store/", ";", \
"torchserve", "--start", "--ts-config=/home/model-server/config.properties", \
"--models", "${MODEL_NAME}=${MODEL_NAME}.mar", \
"--model-store", "/home/model-server/model-store"]
@@ -0,0 +1,100 @@
# Dockerfile for Detectron2 training.
#
# To build:
# docker build -f model_oss/detectron2/dockerfile/train.Dockerfile . -t ${YOUR_IMAGE_TAG}
#
# To push to gcr:
# docker tag ${YOUR_IMAGE_TAG} gcr.io/${YOUR_PROJECT}/${YOUR_IMAGE_TAG}
# docker push gcr.io/${YOUR_PROJECT}/${YOUR_IMAGE_TAG}
FROM nvidia/cuda:11.1.1-cudnn8-devel-ubuntu18.04
# Using an older system (18.04) to avoid opencv incompatibility (issue#3524).
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y \
python3.7 python3.7-dev python3.7-distutils \
python3-opencv ca-certificates git wget sudo ninja-build \
curl wget vim
# Make python3 available for python3.7.
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2
RUN update-alternatives --config python3
# Make python available for python3.7.
RUN ln -sv /usr/bin/python3.7 /usr/bin/python
# Create a non-root user.
ARG USER_ID=1000
RUN useradd -m --no-log-init --system --uid ${USER_ID} appuser -g sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER appuser
WORKDIR /home/appuser
ENV PATH="/home/appuser/.local/bin:${PATH}"
RUN wget https://bootstrap.pypa.io/pip/get-pip.py && \
python3.7 get-pip.py --user && \
rm get-pip.py
# Important! Otherwise, it uses existing numpy from host-modules
# which throws error.
RUN pip install --user numpy==1.20.3
# Install dependencies:
# See https://pytorch.org/ for other options if you use
# a different version of CUDA.
RUN pip install --user tensorboard==2.11.0
# cmake from apt-get is too old.
RUN pip install --user cmake==3.25.2
RUN pip install --user torch==1.10.0+cu111 torchvision==0.11.0+cu111 -f https://download.pytorch.org/whl/torch_stable.html
RUN pip install --user setuptools==59.5.0
RUN pip install --user opencv-python==4.7.0.72
RUN pip install --user cloudml-hypertune==0.1.0.dev6
RUN pip install --user fvcore==0.1.5.post20221221
# Install detectron2.
RUN git clone -b v0.6 https://github.com/facebookresearch/detectron2 detectron2_repo
# Set FORCE_CUDA because during `docker build` cuda is not accessible.
ENV FORCE_CUDA="1"
# This will by default build detectron2 for all common cuda
# architectures and take a lot more time,
# because inside `docker build`, there is no way to tell
# which architecture will be used.
ARG TORCH_CUDA_ARCH_LIST="Kepler;Kepler+Tesla;Maxwell;Maxwell+Tegra;Pascal;Volta;Turing"
ENV TORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST}"
RUN pip install --user -e detectron2_repo
# Set a fixed model cache directory.
ENV FVCORE_CACHE="/tmp"
# Copy license.
RUN wget https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/main/LICENSE
# Copy model-garden detectron2 files to '/home/appuser/trainer' folder.
ADD ./model_oss/detectron2 /home/appuser/trainer
################ Copy plain_train_net.py to task.py and
# then modify it using sed commands. ###################
# Src: https://github.com/facebookresearch/detectron2/blob/v0.6/tools/plain_train_net.py
RUN sudo cp /home/appuser/detectron2_repo/tools/plain_train_net.py /home/appuser/trainer/task.py
# Make additional changes to task.py.
# Note(lavrai): Start adding SED commands from end of file towards the top
# so that the line numbers do not keep changing for the source file.
# For entry-point:
RUN sudo sed -i "214 d" /home/appuser/trainer/task.py
RUN sudo sed -i "213 a\ default_arg_parser = default_argument_parser()" /home/appuser/trainer/task.py
RUN sudo sed -i "214 a\ extended_parser = trainer_utils.extend_parser_arguments(default_arg_parser)" /home/appuser/trainer/task.py
RUN sudo sed -i "215 a\ args = extended_parser.parse_args()" /home/appuser/trainer/task.py
# For main() function:
RUN sudo sed -i "192 a\ trainer_utils.register_dataset(args)" /home/appuser/trainer/task.py
# For setup() function:
RUN sudo sed -i "184 a\ cfg.SOLVER.BASE_LR = args.lr" /home/appuser/trainer/task.py
RUN sudo sed -i "185 a\ cfg.OUTPUT_DIR = args.output_dir" /home/appuser/trainer/task.py
RUN sudo sed -i "186 a\ cfg.MODEL.WEIGHTS = model_zoo.get_checkpoint_url(config_file_copy)" /home/appuser/trainer/task.py
RUN sudo sed -i "182 a\ config_file_copy = args.config_file" /home/appuser/trainer/task.py
RUN sudo sed -i "183 a\ args.config_file = model_zoo.get_config_file(args.config_file)" /home/appuser/trainer/task.py
# For new import:
RUN sudo sed -i "27 a\from detectron2 import model_zoo" /home/appuser/trainer/task.py
RUN sudo sed -i "21 a\import trainer_utils" /home/appuser/trainer/task.py
ENV PYTHONPATH /home/appuser/trainer
ENTRYPOINT ["python", "-m", "trainer.task"]
@@ -0,0 +1,154 @@
"""Custom handler for Detectron2 serving."""
import io
import json
import os
from typing import Any, List, Tuple
import cv2
from detectron2.config import get_cfg
from detectron2.engine import DefaultPredictor
from google.cloud import storage
import numpy as np
import pycocotools.mask as mask_util
import torch
def get_bucket_and_blob_name(gcs_filepath: str) -> Tuple[str, str]:
"""Gets bucket and blob name from gcs path."""
# The gcs path is of the form gs://<bucket-name>/<blob-name>
gs_suffix = gcs_filepath.split("gs://", 1)[1]
return tuple(gs_suffix.split("/", 1))
def download_gcs_file(src_file_path: str, dst_file_path: str):
"""Downloads gcs-file to local folder."""
src_bucket_name, src_blob_name = get_bucket_and_blob_name(src_file_path)
client = storage.Client()
src_bucket = client.get_bucket(src_bucket_name)
src_blob = src_bucket.blob(src_blob_name)
src_blob.download_to_filename(dst_file_path)
class ModelHandler:
"""Custom model handler for Detectron2."""
def __init__(self):
self.error = None
self._batch_size = 0
self.initialized = False
self.predictor = None
self.test_threshold = 0.5
def initialize(self, context: Any):
"""Initialize."""
print("context.system_properties: ", context.system_properties)
print("context.manifest: ", context.manifest)
self.manifest = context.manifest
properties = context.system_properties
# Get threshold from environment variable.
# This will be set by customer.
self.test_threshold = float(os.environ.get("TEST_THRESHOLD"))
print("test_threshold: ", self.test_threshold)
# Get model and config file location from environment variables.
# These will be set by customer when doing model upload.
gcs_model_file = os.environ["MODEL_PTH_FILE"]
gcs_config_file = os.environ["CONFIG_YAML_FILE"]
print("Copying gcs_model_file: ", gcs_model_file)
print("Copying gcs_config_file: ", gcs_config_file)
# Copy these files from GCS location to local file.
# Note(lavrai): GCSFuse path does not seem to work here for now.
model_file = "./model.pth"
config_file = "./cfg.yaml"
download_gcs_file(src_file_path=gcs_model_file, dst_file_path=model_file)
if not os.path.exists(model_file):
raise RuntimeError("Missing model_file: %s" % model_file)
download_gcs_file(src_file_path=gcs_config_file, dst_file_path=config_file)
if not os.path.exists(config_file):
raise RuntimeError("Missing config_file: %s" % config_file)
# Set up config file.
cfg = get_cfg()
cfg.merge_from_file(config_file)
cfg.MODEL.WEIGHTS = model_file
cfg.MODEL.DEVICE = (
cfg.MODEL.DEVICE + str(properties.get("gpu_id"))
if torch.cuda.is_available()
else "cpu"
)
cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = self.test_threshold
# Build predictor from config.
self.predictor = DefaultPredictor(cfg)
self._batch_size = context.system_properties["batch_size"]
self.initialized = True
def preprocess(self, batch: List[Any]) -> List[Any]:
"""Preprocess raw input and return as list of images."""
print("Running pre-processing.")
images = []
for request in batch:
request_data = request.get("data")
input_bytes = io.BytesIO(request_data)
img = cv2.imdecode(np.fromstring(input_bytes.read(), np.uint8), 1)
images.append(img)
return images
def inference(self, model_input: List[Any]) -> List[Any]:
"""Runs inference."""
print("Running model-inference.")
return [self.predictor(image) for image in model_input]
def postprocess(self, inference_result: List[Any]) -> List[Any]:
"""Post process inference result."""
response_list = []
print("Num inference_items are:", len(inference_result))
for inference_item in inference_result:
predictions = inference_item["instances"].to("cpu")
print("Predictions are:", predictions)
boxes = None
if predictions.has("pred_boxes"):
boxes = predictions.pred_boxes.tensor.numpy().tolist()
scores = None
if predictions.has("scores"):
scores = predictions.scores.numpy().tolist()
classes = None
if predictions.has("pred_classes"):
classes = predictions.pred_classes.numpy().tolist()
masks_rle = None
if predictions.has("pred_masks"):
# Do run length encoding, else the mask output becomes huge.
masks_rle = [
mask_util.encode(np.asfortranarray(mask))
for mask in predictions.pred_masks
]
for rle in masks_rle:
rle["counts"] = rle["counts"].decode("utf-8")
response = {
"classes": classes,
"scores": scores,
"boxes": boxes,
"masks_rle": masks_rle,
}
response_list.append(json.dumps(response))
print("response_list: ", response_list)
return response_list
def handle(self, data: Any, context: Any) -> List[Any]: # pylint: disable=unused-argument
"""Runs preprocess, inference, and post-processing."""
model_input = self.preprocess(data)
model_out = self.inference(model_input)
output = self.postprocess(model_out)
print("Done handling input.")
return output
_service = ModelHandler()
def handle(data: Any, context: Any) -> List[Any]:
if not _service.initialized:
_service.initialize(context)
if data is None:
return None
return _service.handle(data, context)
@@ -0,0 +1,97 @@
"""Detectron2 trainer helper functions."""
import argparse
from detectron2.data.datasets import register_coco_instances
def extend_parser_arguments(
parser: argparse.ArgumentParser,
) -> argparse.ArgumentParser:
"""Adds additional model-garden related arguments."""
parser.add_argument(
"--train_dataset_name",
required=False,
default="",
type=str,
help=(
"The training dataset name for registration. "
"For example: 'balloon_train'."
),
)
parser.add_argument(
"--train_coco_json_file",
required=False,
default="",
type=str,
help="The path to the training coco-json format file.",
)
parser.add_argument(
"--train_image_root",
required=False,
default="",
type=str,
help="The path to the root folder containing the training images.",
)
parser.add_argument(
"--val_dataset_name",
required=False,
default="",
type=str,
help=(
"The validation dataset name for registration. "
"For example: 'balloon_val'."
),
)
parser.add_argument(
"--val_coco_json_file",
required=False,
default="",
type=str,
help="The path to the validation coco-json format file.",
)
parser.add_argument(
"--val_image_root",
required=False,
default="",
type=str,
help="The path to the root folder containing the validation images.",
)
parser.add_argument(
"--output_dir",
required=True,
type=str,
help="The path to the output directory.",
)
# Add hyper-parameter tuning related variables.
parser.add_argument(
"--lr",
type=float,
default=0.00025,
help="The learning rate to be tuned.",
)
parser.add_argument(
"--hp_eval_task",
type=str,
choices=["bbox", "segm"],
default="bbox",
help="The task choice for HP tuning.",
)
return parser
def register_dataset(args: argparse.Namespace):
"""Register the input dataset in Detectron2 Coco format."""
if args.train_dataset_name:
register_coco_instances(
name=args.train_dataset_name,
metadata={},
json_file=args.train_coco_json_file,
image_root=args.train_image_root,
)
if args.val_dataset_name:
register_coco_instances(
name=args.val_dataset_name,
metadata={},
json_file=args.val_coco_json_file,
image_root=args.val_image_root,
)

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