-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Project proposal for Firebase ML Publisher custom component #69
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,45 @@ | ||||||||||||||||||
#### SIG TFX-Addons | ||||||||||||||||||
# Project Proposal | ||||||||||||||||||
|
||||||||||||||||||
**Your name:** Chansung Park | ||||||||||||||||||
|
||||||||||||||||||
**Your email:** [email protected] | ||||||||||||||||||
|
||||||||||||||||||
**Your company/organization:** Individual(ML GDE) | ||||||||||||||||||
|
||||||||||||||||||
**Project name:** [Firebase ML Publisher](https://github.com/tensorflow/tfx-addons/issues/59) | ||||||||||||||||||
|
||||||||||||||||||
## Project Description | ||||||||||||||||||
This project defines a custom TFX component to publish/update ML models from TFX Pusher to [Firebase ML](https://firebase.google.com/products/ml). The input model from TFX Pusher is assumed to be a TFLite format. | ||||||||||||||||||
|
||||||||||||||||||
## Project Category | ||||||||||||||||||
Component | ||||||||||||||||||
|
||||||||||||||||||
## Project Use-Case(s) | ||||||||||||||||||
This project helps users to publish trained models directly from TFX Pusher component to Firebase ML. | ||||||||||||||||||
|
||||||||||||||||||
With Firebase ML, we can guarantee that mobile devices can be equipped with the latest ML model without explicitly embedding binary in the project compiling stage. We can even A/B test different versions of a model with Google Analytics when the model is published on Firebase ML. | ||||||||||||||||||
|
||||||||||||||||||
## Project Implementation | ||||||||||||||||||
Firebase ML Publisher component will be implemented as Python function-based component. You can find the [actual source code](https://github.com/sayakpaul/Dual-Deployments-on-Vertex-AI/blob/main/custom_components/firebase_publisher.py) in my personal project. | ||||||||||||||||||
|
||||||||||||||||||
The implementation details | ||||||||||||||||||
- Define a custom Python function-based TFX component. It takes the following parameters from a previous component. | ||||||||||||||||||
- The URI of the pushed model from TFX Pusher component. | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why Pushed model? Why not a Trained Model directly? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is an option I guess? My understanding is that TFX Trainer just saved the trained model, and Pusher manages the different versions(correct me if I am wrong). Since there are more after Trainer's job is done. For example, we don't know if the trained model is good enough, so we add Evaluator component with Resolver node. When the model passes thresholds defined in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AFAIK, trainer could generate tflite models, and evaluator could handle tflite models. From pusher perspective, Pushed model type artifacts are for archiving already pushed models. We don't have infra validator which supports tflite models for now, but we could have this in the future. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree w the conclusion reached. Let's make sure to modify the proposal w the new interface. |
||||||||||||||||||
- Requirements from Firebase ML (credential JSON file path, Firebase temporary-use GCS bucket). Please find more information from [Before you begin section](https://firebase.google.com/docs/ml/manage-hosted-models#before_you_begin) in the official Firebase document. | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would avoid overall setting credential JSON file path in the component. User can login locally via There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure how I can do that. but still, we can make this parameter Optional. What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When using Kubernetes on GKE, you can use Workload identity to set up your pods to automatically auth as the user (see: https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity) Otherwise, you can set it up using https://github.com/tensorflow/tfx/blob/master/tfx/orchestration/kubeflow/kubeflow_dag_runner.py#L78 (which is preferred over setting a GCS path) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am currently working on implementing this component, but I can't get it working correctly in Vertex AI Pipeline environment. Just like your comments, I thought Default Application Credential should work OK, but I get the error message like below by complaining to include I gave appropriate permissions to the Service Account which is Do you have any clue?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can figure this out as we merge the implementation as it's hard to debug without the code |
||||||||||||||||||
- Meta information to manage published model for Firebase ML such as `display name` and `tags`. | ||||||||||||||||||
- Download the Firebase credential file and pushed TFLite model file. | ||||||||||||||||||
- Initialize Firebase Admin with the credential and Firebase temporary-use GCS bucket. | ||||||||||||||||||
- Search if any models with the same `display name` has already been published. | ||||||||||||||||||
- if yes, update the existing Firebase ML mode, then publish it | ||||||||||||||||||
- if no, create a new Firebase ML model, then publish it | ||||||||||||||||||
- Return `tfx.dsl.components.OutputDict(result=str)` to indicate if the job went successful, and if the job was about creating a new Firebase ML model or updating the exisitng Firebase ML model. | ||||||||||||||||||
|
||||||||||||||||||
## Project Dependencies | ||||||||||||||||||
The implementation will use the following libraries. | ||||||||||||||||||
- [Firebase Admin Python SDK](https://github.com/firebase/firebase-admin-python) | ||||||||||||||||||
- [Python Client for Google Cloud Storage](https://github.com/googleapis/python-storage) | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we get the versions of the PyPi deps here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The versions are 5.0.2 and 1.42.0 respectively.
Suggested change
|
||||||||||||||||||
|
||||||||||||||||||
## Project Team | ||||||||||||||||||
**Project Leader** : Chansung Park, deep-diver, [email protected] | ||||||||||||||||||
1. Sayak Paul, sayakpaul, [email protected] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: consider using tfx.io_utils instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion. I will take a look at it when polishing the code.