Following the notebook (just using different data) at GoogleCloudPlatform/ai-platform-samples/blob/master/notebooks/samples/explanations/tf2/ai-explanations-tabular.ipynb
using TF2.2 and 1.0.5 release of explainable_ai_sdk python 3.7. AI Platform Notebook instance.
When calling load_model_from_ai_platform(proj,model,version) the error is raised.
AttributeError: module 'google.auth.credentials' has no attribute 'CredentialsWithQuotaProject'
Not sure if this is due to a mistake I have made or a package dependency.
thanks,
jim
Here is the full error message:
AttributeError Traceback (most recent call last)
in
2 PROJECT_ID = 'jwtfxpipe'
3 print('model {} version {}'.format(MODEL,VERSION))
----> 4 remote_ig_model = explainable_ai_sdk.load_model_from_ai_platform(PROJECT_ID, MODEL, VERSION)
5 ig_response = remote_ig_model.explain([prediction_json])
6 print('OK@',time.asctime())
/opt/conda/lib/python3.7/site-packages/explainable_ai_sdk/model/model_factory.py in load_model_from_ai_platform(project, model, version, credentials)
56 if version:
57 endpoint = os.path.join(endpoint, 'versions', version)
---> 58 return _MODEL_REGISTRY[_REMOTE_MODEL_KEY](endpoint, credentials)
59
60
/opt/conda/lib/python3.7/site-packages/explainable_ai_sdk/model/ai_platform_model.py in init(self, endpoint, credentials)
48 self._credentials = credentials
49 self._endpoint = endpoint
---> 50 self._explanation_metadata = self._get_explanation_metadata()
51 self._modality_input_list_map = utils.get_modality_input_list_map(
52 self._explanation_metadata)
/opt/conda/lib/python3.7/site-packages/explainable_ai_sdk/model/ai_platform_model.py in _get_explanation_metadata(self)
103
104 """
--> 105 explanation_md_uri = self._get_explanation_metadata_uri()
106
107 md = explain_metadata.ExplainMetadata.from_file(explanation_md_uri)
/opt/conda/lib/python3.7/site-packages/explainable_ai_sdk/model/ai_platform_model.py in _get_explanation_metadata_uri(self)
83 gcs bucket uri.
84 """
---> 85 gcs_uri = self._get_deployment_uri()
86 match = re.search('gs://(?P<bucket_name>[^/])[/](?P.*)',
87 gcs_uri)
/opt/conda/lib/python3.7/site-packages/explainable_ai_sdk/model/ai_platform_model.py in _get_deployment_uri(self)
63 """
64 response = http_utils.make_get_request_to_ai_platform(
---> 65 self._endpoint, self._credentials)
66
67 if 'deploymentUri' not in response:
/opt/conda/lib/python3.7/site-packages/explainable_ai_sdk/model/http_utils.py in make_get_request_to_ai_platform(uri_params_str, credentials, timeout_ms)
93 Request results in json format.
94 """
---> 95 headers = _get_request_header(credentials)
96 ai_platform_endpoint = (
97 os.getenv('CLOUDSDK_API_ENDPOINT_OVERRIDES_ML') or
/opt/conda/lib/python3.7/site-packages/explainable_ai_sdk/model/http_utils.py in _get_request_header(credentials)
40 # If credentials is not given, use the default credentials
41 if credentials is None:
---> 42 credentials, _ = google.auth.default()
43
44 # Refresh credentials in case it has been expired.
/opt/conda/lib/python3.7/site-packages/google/auth/_default.py in default(scopes, request)
306 scopes (Sequence[str]): The list of scopes for the credentials. If
307 specified, the credentials will automatically be scoped if
--> 308 necessary.
309 request (google.auth.transport.Request): An object used to make
310 HTTP requests. This is used to detect whether the application
/opt/conda/lib/python3.7/site-packages/google/auth/_default.py in _get_gae_credentials()
178 explicit_file = os.environ.get(environment_vars.CREDENTIALS)
179
--> 180 _LOGGER.debug(
181 "Checking %s for explicit credentials as part of auth process...", explicit_file
182 )
/opt/conda/lib/python3.7/site-packages/google/auth/app_engine.py in
79
80 class Credentials(
---> 81 credentials.Scoped, credentials.Signing, credentials.CredentialsWithQuotaProject
82 ):
83 """App Engine standard environment credentials.
AttributeError: module 'google.auth.credentials' has no attribute 'CredentialsWithQuotaProject'