Skip to content

Commit 96ac976

Browse files
authored
chore: update sample configs to keep some samples in v1beta1 (googleapis#225)
* chore: update sample configs to keep some samples in v1beta1
1 parent efc00ed commit 96ac976

4 files changed

Lines changed: 29 additions & 16 deletions

File tree

.sample_configs/param_handlers/upload_model_explain_image_managed_container_sample.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,35 +30,35 @@ def make_model(
3030
container_spec = {"image_uri": container_spec_image_uri, "command": [], "args": []}
3131

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

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

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

4949
# Assemble the explanation metadata
50-
metadata = aiplatform.gapic.ExplanationMetadata(
50+
metadata = aiplatform_v1beta1.ExplanationMetadata(
5151
inputs={'image': input_metadata},
5252
outputs={'prediction' : output_metadata}
5353
)
5454

5555
# Assemble the explanation specification
56-
explanation_spec = aiplatform.gapic.ExplanationSpec(
56+
explanation_spec = aiplatform_v1beta1.ExplanationSpec(
5757
parameters=parameters,
5858
metadata=metadata
5959
)
6060

61-
model = aiplatform.gapic.Model(display_name=display_name,
61+
model = aiplatform_v1beta1.Model(display_name=display_name,
6262
# The Cloud Storage location of the custom model
6363
artifact_uri=artifact_uri,
6464
explanation_spec=explanation_spec,

.sample_configs/param_handlers/upload_model_explain_tabular_managed_container_sample.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ def make_model(
3131
container_spec = {"image_uri": container_spec_image_uri, "command": [], "args": []}
3232

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

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

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

5353
# Assemble the explanation metadata
54-
metadata = aiplatform.gapic.ExplanationMetadata(
54+
metadata = aiplatform_v1beta1.ExplanationMetadata(
5555
inputs={'features': input_metadata},
5656
outputs={'prediction' : output_metadata}
5757
)
5858

5959
# Assemble the explanation specification
60-
explanation_spec = aiplatform.gapic.ExplanationSpec(
60+
explanation_spec = aiplatform_v1beta1.ExplanationSpec(
6161
parameters=parameters,
6262
metadata=metadata
6363
)
6464

65-
model = aiplatform.gapic.Model(display_name=display_name,
65+
model = aiplatform_v1beta1.Model(display_name=display_name,
6666
# The Cloud Storage location of the custom model
6767
artifact_uri=artifact_uri,
6868
explanation_spec=explanation_spec,

.sample_configs/process_configs.yaml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@ cancel_custom_job_sample: {}
1414
cancel_data_labeling_job_sample: {}
1515
cancel_hyperparameter_tuning_job_sample: {}
1616
cancel_training_pipeline_sample: {}
17-
create_batch_prediction_job_bigquery_sample: {}
17+
create_batch_prediction_job_bigquery_sample:
18+
gapic_module_child: aiplatform_v1beta1
19+
namespace: null
1820
create_batch_prediction_job_custom_image_explain_sample: {}
1921
create_batch_prediction_job_custom_tabular_explain_sample: {}
2022
create_batch_prediction_job_sample: {}
2123
create_batch_prediction_job_tabular_explain_sample: {}
22-
create_batch_prediction_job_tabular_forecasting_sample: {}
24+
create_batch_prediction_job_tabular_forecasting_sample:
25+
gapic_module_child: aiplatform_v1beta1
26+
namespace: null
2327
create_batch_prediction_job_text_classification_sample: {}
2428
create_batch_prediction_job_text_entity_extraction_sample: {}
2529
create_batch_prediction_job_text_sentiment_analysis_sample: {}
@@ -138,6 +142,8 @@ explain_sample:
138142
approximation_error: This is the approximation error.
139143
attributions: Feature attributions.
140144
explain_tabular_sample:
145+
gapic_module_child: aiplatform_v1beta1
146+
namespace: null
141147
api_endpoint: us-central1-prediction-aiplatform.googleapis.com
142148
max_depth: 2
143149
resource_name: endpoint
@@ -152,6 +158,8 @@ export_model_sample:
152158
lro_metadata:
153159
- output_info
154160
export_model_tabular_classification_sample:
161+
gapic_module_child: aiplatform_v1beta1
162+
namespace: null
155163
lro_metadata:
156164
- output_info
157165
export_model_video_action_recognition_sample:
@@ -338,8 +346,12 @@ update_model_sample: {}
338346
update_specialist_pool_sample: {}
339347
upload_model_custom_container_sample:
340348
timeout: 1800
341-
upload_model_explain_image_managed_container_sample: {}
342-
upload_model_explain_tabular_managed_container_sample: {}
349+
upload_model_explain_image_managed_container_sample:
350+
gapic_module_child: aiplatform_v1beta1
351+
namespace: null
352+
upload_model_explain_tabular_managed_container_sample:
353+
gapic_module_child: aiplatform_v1beta1
354+
namespace: null
343355
upload_model_managed_container_sample:
344356
timeout: 1800
345357
upload_model_sample:

samples/snippets/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ def teardown_data_labeling_job(capsys, shared_state, data_labeling_job_client):
117117
helpers.wait_for_job_state(
118118
get_job_method=data_labeling_job_client.get_data_labeling_job,
119119
name=shared_state["data_labeling_job_name"],
120+
expected_state='FAILED',
120121
timeout=400,
121122
freq=10,
122123
)

0 commit comments

Comments
 (0)