Skip to content
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

feat: Add XAI SDK integration to TensorFlow models with LIT integration #917

Merged
merged 5 commits into from
Jan 19, 2022

Conversation

taiseiak
Copy link
Contributor

Add automatic addition of feature attribution for TensorFlow 2 models in the LIT integration on Vertex Notebooks. Detects for Vertex Notebooks by looking for the same environment variable to check for Vertex Notebooks as the LIT library does.

Fixes b/210943910 🦕

go/local-explanations-lit-xai-notebook

Add automatic addition of feature attribution for TensorFlow 2 models in the LIT integration on Vertex Notebooks. Detects for Vertex Notebooks by looking for the same enviornment variable to check for Vertex Notebooks as the LIT library does.
@taiseiak taiseiak requested a review from a team as a code owner December 17, 2021 03:59
@Ark-kun
Copy link
Contributor

Ark-kun commented Dec 18, 2021

In the future, would it be possible to add the automatic addition of feature attribution for TensorFlow 2 models imported using Model.upload_tensorflow_saved_model?

@taiseiak
Copy link
Contributor Author

Where is Models.upload_tensorflow_model? I cannot find it.

google/cloud/aiplatform/explain/lit.py Outdated Show resolved Hide resolved
google/cloud/aiplatform/explain/lit.py Show resolved Hide resolved
google/cloud/aiplatform/explain/lit.py Show resolved Hide resolved
google/cloud/aiplatform/explain/lit.py Show resolved Hide resolved
google/cloud/aiplatform/explain/lit.py Show resolved Hide resolved
google/cloud/aiplatform/explain/lit.py Outdated Show resolved Hide resolved
@taiseiak
Copy link
Contributor Author

taiseiak commented Jan 4, 2022

Documentation: https://cloud.google.com/python/docs/reference/aiplatform/latest/google.cloud.aiplatform.Model#google_cloud_aiplatform_Model_upload_tensorflow_saved_model

Code:

def upload_tensorflow_saved_model(

I think this is possible, but I don't know if we should do this automatically. We charge users for using explanations on uploaded models. I think having a parameter that sets up explanation metadata or having a function that utilizes the XAI SDK to create metadata would be better. Would those suffice?

@Ark-kun
Copy link
Contributor

Ark-kun commented Jan 4, 2022

Documentation: https://cloud.google.com/python/docs/reference/aiplatform/latest/google.cloud.aiplatform.Model#google_cloud_aiplatform_Model_upload_tensorflow_saved_model
Code:

def upload_tensorflow_saved_model(

I think this is possible, but I don't know if we should do this automatically. We charge users for using explanations on uploaded models. I think having a parameter that sets up explanation metadata or having a function that utilizes the XAI SDK to create metadata would be better. Would those suffice?

I have couple of questions:

  1. Are users charged extra when XAI metadata is added to a model?
  2. Is there an easy way for a user to add explanation metadata to a model that would fit most users?

@taiseiak
Copy link
Contributor Author

taiseiak commented Jan 6, 2022

Documentation: https://cloud.google.com/python/docs/reference/aiplatform/latest/google.cloud.aiplatform.Model#google_cloud_aiplatform_Model_upload_tensorflow_saved_model
Code:

def upload_tensorflow_saved_model(

I think this is possible, but I don't know if we should do this automatically. We charge users for using explanations on uploaded models. I think having a parameter that sets up explanation metadata or having a function that utilizes the XAI SDK to create metadata would be better. Would those suffice?

I have couple of questions:

  1. Are users charged extra when XAI metadata is added to a model?
  2. Is there an easy way for a user to add explanation metadata to a model that would fit most users?
  1. Currently, no. However, this will change in the future. When a user deploys a model to an endpoint with explanation metadata, they will be charged for the explainer GKE pod for that endpoint. Users are also charged extra for using the explain call also as it takes computation time to calculate explanations.
  2. The most easy way right now is to use the XAI SDK (https://github.com/GoogleCloudPlatform/explainable_ai_sdk). This SDK has many convenience methods for generating metadata. This is what I used to generate metadata for this PR.

@taiseiak taiseiak requested a review from sasha-gitg January 10, 2022 18:16
google/cloud/aiplatform/explain/lit.py Outdated Show resolved Hide resolved
google/cloud/aiplatform/explain/lit.py Show resolved Hide resolved
tests/unit/aiplatform/test_explain_lit.py Show resolved Hide resolved
@taiseiak taiseiak requested a review from sasha-gitg January 12, 2022 20:23
@sasha-gitg sasha-gitg added the automerge Merge the pull request once unit tests and other checks pass. label Jan 19, 2022
@gcf-merge-on-green gcf-merge-on-green bot merged commit ea2b5cf into googleapis:main Jan 19, 2022
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Jan 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants