Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,35 +30,35 @@ def make_model(
container_spec = {"image_uri": container_spec_image_uri, "command": [], "args": []}

# The explainabilty method and corresponding parameters
parameters = aiplatform.gapic.ExplanationParameters({"xrai_attribution": { "step_count": 1}})
parameters = aiplatform_v1beta1.ExplanationParameters({"xrai_attribution": { "step_count": 1}})

# The input tensor for feature attribution to the output
# For single input model, y = f(x), this will be the serving input layer.
input_metadata = aiplatform.gapic.ExplanationMetadata.InputMetadata({
input_metadata = aiplatform_v1beta1.ExplanationMetadata.InputMetadata({
"input_tensor_name": input_tensor_name,
# Input is image data
"modality": "image",
})

# The output tensor to explain
# For single output model, y = f(x), this will be the serving output layer.
output_metadata = aiplatform.gapic.ExplanationMetadata.OutputMetadata({
output_metadata = aiplatform_v1beta1.ExplanationMetadata.OutputMetadata({
"output_tensor_name": output_tensor_name
})

# Assemble the explanation metadata
metadata = aiplatform.gapic.ExplanationMetadata(
metadata = aiplatform_v1beta1.ExplanationMetadata(
inputs={'image': input_metadata},
outputs={'prediction' : output_metadata}
)

# Assemble the explanation specification
explanation_spec = aiplatform.gapic.ExplanationSpec(
explanation_spec = aiplatform_v1beta1.ExplanationSpec(
parameters=parameters,
metadata=metadata
)

model = aiplatform.gapic.Model(display_name=display_name,
model = aiplatform_v1beta1.Model(display_name=display_name,
# The Cloud Storage location of the custom model
artifact_uri=artifact_uri,
explanation_spec=explanation_spec,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ def make_model(
container_spec = {"image_uri": container_spec_image_uri, "command": [], "args": []}

# The explainabilty method and corresponding parameters
parameters = aiplatform.gapic.ExplanationParameters({"xrai_attribution": { "step_count": 1}})
parameters = aiplatform_v1beta1.ExplanationParameters({"xrai_attribution": { "step_count": 1}})

# The input tensor for feature attribution to the output
# For single input model, y = f(x), this will be the serving input layer.
input_metadata = aiplatform.gapic.ExplanationMetadata.InputMetadata({
input_metadata = aiplatform_v1beta1.ExplanationMetadata.InputMetadata({
"input_tensor_name": input_tensor_name,
# Input is tabular data
"modality": "numeric",
Expand All @@ -46,23 +46,23 @@ def make_model(

# The output tensor to explain
# For single output model, y = f(x), this will be the serving output layer.
output_metadata = aiplatform.gapic.ExplanationMetadata.OutputMetadata({
output_metadata = aiplatform_v1beta1.ExplanationMetadata.OutputMetadata({
"output_tensor_name": output_tensor_name
})

# Assemble the explanation metadata
metadata = aiplatform.gapic.ExplanationMetadata(
metadata = aiplatform_v1beta1.ExplanationMetadata(
inputs={'features': input_metadata},
outputs={'prediction' : output_metadata}
)

# Assemble the explanation specification
explanation_spec = aiplatform.gapic.ExplanationSpec(
explanation_spec = aiplatform_v1beta1.ExplanationSpec(
parameters=parameters,
metadata=metadata
)

model = aiplatform.gapic.Model(display_name=display_name,
model = aiplatform_v1beta1.Model(display_name=display_name,
# The Cloud Storage location of the custom model
artifact_uri=artifact_uri,
explanation_spec=explanation_spec,
Expand Down
20 changes: 16 additions & 4 deletions .sample_configs/process_configs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ cancel_custom_job_sample: {}
cancel_data_labeling_job_sample: {}
cancel_hyperparameter_tuning_job_sample: {}
cancel_training_pipeline_sample: {}
create_batch_prediction_job_bigquery_sample: {}
create_batch_prediction_job_bigquery_sample:
gapic_module_child: aiplatform_v1beta1
namespace: null
create_batch_prediction_job_custom_image_explain_sample: {}
create_batch_prediction_job_custom_tabular_explain_sample: {}
create_batch_prediction_job_sample: {}
create_batch_prediction_job_tabular_explain_sample: {}
create_batch_prediction_job_tabular_forecasting_sample: {}
create_batch_prediction_job_tabular_forecasting_sample:
gapic_module_child: aiplatform_v1beta1
namespace: null
create_batch_prediction_job_text_classification_sample: {}
create_batch_prediction_job_text_entity_extraction_sample: {}
create_batch_prediction_job_text_sentiment_analysis_sample: {}
Expand Down Expand Up @@ -138,6 +142,8 @@ explain_sample:
approximation_error: This is the approximation error.
attributions: Feature attributions.
explain_tabular_sample:
gapic_module_child: aiplatform_v1beta1
namespace: null
api_endpoint: us-central1-prediction-aiplatform.googleapis.com
max_depth: 2
resource_name: endpoint
Expand All @@ -152,6 +158,8 @@ export_model_sample:
lro_metadata:
- output_info
export_model_tabular_classification_sample:
gapic_module_child: aiplatform_v1beta1
namespace: null
lro_metadata:
- output_info
export_model_video_action_recognition_sample:
Expand Down Expand Up @@ -338,8 +346,12 @@ update_model_sample: {}
update_specialist_pool_sample: {}
upload_model_custom_container_sample:
timeout: 1800
upload_model_explain_image_managed_container_sample: {}
upload_model_explain_tabular_managed_container_sample: {}
upload_model_explain_image_managed_container_sample:
gapic_module_child: aiplatform_v1beta1
namespace: null
upload_model_explain_tabular_managed_container_sample:
gapic_module_child: aiplatform_v1beta1
namespace: null
upload_model_managed_container_sample:
timeout: 1800
upload_model_sample:
Expand Down
1 change: 1 addition & 0 deletions samples/snippets/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def teardown_data_labeling_job(capsys, shared_state, data_labeling_job_client):
helpers.wait_for_job_state(
get_job_method=data_labeling_job_client.get_data_labeling_job,
name=shared_state["data_labeling_job_name"],
expected_state='FAILED',
timeout=400,
freq=10,
)
Expand Down