From 76881d4b98308074747cfd03dc0a3e8358a340d8 Mon Sep 17 00:00:00 2001 From: Yu-Han Liu Date: Fri, 12 Feb 2021 15:17:37 -0800 Subject: [PATCH 1/2] chore: update sample configs to keep some samples in v1beta1 --- ..._explain_image_managed_container_sample.py | 12 +++++------ ...xplain_tabular_managed_container_sample.py | 12 +++++------ .sample_configs/process_configs.yaml | 20 +++++++++++++++---- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/.sample_configs/param_handlers/upload_model_explain_image_managed_container_sample.py b/.sample_configs/param_handlers/upload_model_explain_image_managed_container_sample.py index 6710c55080..10995aaed6 100644 --- a/.sample_configs/param_handlers/upload_model_explain_image_managed_container_sample.py +++ b/.sample_configs/param_handlers/upload_model_explain_image_managed_container_sample.py @@ -30,11 +30,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 image data "modality": "image", @@ -42,23 +42,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={'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, diff --git a/.sample_configs/param_handlers/upload_model_explain_tabular_managed_container_sample.py b/.sample_configs/param_handlers/upload_model_explain_tabular_managed_container_sample.py index 5c23bccd75..77156e516b 100644 --- a/.sample_configs/param_handlers/upload_model_explain_tabular_managed_container_sample.py +++ b/.sample_configs/param_handlers/upload_model_explain_tabular_managed_container_sample.py @@ -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", @@ -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, diff --git a/.sample_configs/process_configs.yaml b/.sample_configs/process_configs.yaml index a671cf8710..a432750270 100644 --- a/.sample_configs/process_configs.yaml +++ b/.sample_configs/process_configs.yaml @@ -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: {} @@ -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 @@ -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: @@ -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: From 9fce20ffea1d9c567fd8f145038aa3c9271f6709 Mon Sep 17 00:00:00 2001 From: Yu-Han Liu Date: Sun, 14 Feb 2021 11:54:55 -0800 Subject: [PATCH 2/2] data labeling jobs end with FAILED state --- samples/snippets/conftest.py | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/snippets/conftest.py b/samples/snippets/conftest.py index 2d2dd2fa78..d40fcf987d 100644 --- a/samples/snippets/conftest.py +++ b/samples/snippets/conftest.py @@ -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, )