@@ -83,15 +83,16 @@ def test_pytorch_training_model_registration_and_creation_without_custom_inferen
83
83
inputs = TrainingInput (s3_data = input_path )
84
84
85
85
instance_count = ParameterInteger (name = "InstanceCount" , default_value = 1 )
86
- instance_type = ParameterString (name = "InstanceType" , default_value = "ml.m5.xlarge" )
87
86
87
+ # If image_uri is not provided, the instance_type should not be a pipeline variable
88
+ # since instance_type is used to retrieve image_uri in compile time (PySDK)
88
89
pytorch_estimator = PyTorch (
89
90
entry_point = entry_point ,
90
91
role = role ,
91
92
framework_version = "1.5.0" ,
92
93
py_version = "py3" ,
93
94
instance_count = instance_count ,
94
- instance_type = instance_type ,
95
+ instance_type = "ml.m5.xlarge" ,
95
96
sagemaker_session = pipeline_session ,
96
97
)
97
98
train_step_args = pytorch_estimator .fit (inputs = inputs )
@@ -140,7 +141,7 @@ def test_pytorch_training_model_registration_and_creation_without_custom_inferen
140
141
)
141
142
pipeline = Pipeline (
142
143
name = pipeline_name ,
143
- parameters = [instance_count , instance_type ],
144
+ parameters = [instance_count ],
144
145
steps = [step_train , step_model_regis , step_model_create , step_fail ],
145
146
sagemaker_session = pipeline_session ,
146
147
)
@@ -203,15 +204,16 @@ def test_pytorch_training_model_registration_and_creation_with_custom_inference(
203
204
inputs = TrainingInput (s3_data = input_path )
204
205
205
206
instance_count = ParameterInteger (name = "InstanceCount" , default_value = 1 )
206
- instance_type = ParameterString (name = "InstanceType" , default_value = "ml.m5.xlarge" )
207
207
208
+ # If image_uri is not provided, the instance_type should not be a pipeline variable
209
+ # since instance_type is used to retrieve image_uri in compile time (PySDK)
208
210
pytorch_estimator = PyTorch (
209
211
entry_point = entry_point ,
210
212
role = role ,
211
213
framework_version = "1.5.0" ,
212
214
py_version = "py3" ,
213
215
instance_count = instance_count ,
214
- instance_type = instance_type ,
216
+ instance_type = "ml.m5.xlarge" ,
215
217
sagemaker_session = pipeline_session ,
216
218
output_kms_key = kms_key ,
217
219
)
@@ -267,7 +269,7 @@ def test_pytorch_training_model_registration_and_creation_with_custom_inference(
267
269
)
268
270
pipeline = Pipeline (
269
271
name = pipeline_name ,
270
- parameters = [instance_count , instance_type ],
272
+ parameters = [instance_count ],
271
273
steps = [step_train , step_model_regis , step_model_create , step_fail ],
272
274
sagemaker_session = pipeline_session ,
273
275
)
@@ -400,7 +402,6 @@ def test_model_registration_with_drift_check_baselines_and_model_metrics(
400
402
pipeline_name ,
401
403
):
402
404
instance_count = ParameterInteger (name = "InstanceCount" , default_value = 1 )
403
- instance_type = ParameterString (name = "InstanceType" , default_value = "ml.m5.xlarge" )
404
405
405
406
# upload model data to s3
406
407
model_local_path = os .path .join (DATA_DIR , "mxnet_mnist/model.tar.gz" )
@@ -488,10 +489,12 @@ def test_model_registration_with_drift_check_baselines_and_model_metrics(
488
489
),
489
490
)
490
491
customer_metadata_properties = {"key1" : "value1" }
492
+ # If image_uri is not provided, the instance_type should not be a pipeline variable
493
+ # since instance_type is used to retrieve image_uri in compile time (PySDK)
491
494
estimator = XGBoost (
492
495
entry_point = "training.py" ,
493
496
source_dir = os .path .join (DATA_DIR , "sip" ),
494
- instance_type = instance_type ,
497
+ instance_type = "ml.m5.xlarge" ,
495
498
instance_count = instance_count ,
496
499
framework_version = "0.90-2" ,
497
500
sagemaker_session = pipeline_session ,
@@ -524,7 +527,6 @@ def test_model_registration_with_drift_check_baselines_and_model_metrics(
524
527
parameters = [
525
528
model_uri_param ,
526
529
metrics_uri_param ,
527
- instance_type ,
528
530
instance_count ,
529
531
],
530
532
steps = [step_model_register ],
@@ -606,13 +608,14 @@ def test_model_registration_with_tensorflow_model_with_pipeline_model(
606
608
)
607
609
inputs = TrainingInput (s3_data = input_path )
608
610
instance_count = ParameterInteger (name = "InstanceCount" , default_value = 1 )
609
- instance_type = ParameterString (name = "InstanceType" , default_value = "ml.m5.xlarge" )
610
611
612
+ # If image_uri is not provided, the instance_type should not be a pipeline variable
613
+ # since instance_type is used to retrieve image_uri in compile time (PySDK)
611
614
tensorflow_estimator = TensorFlow (
612
615
entry_point = entry_point ,
613
616
role = role ,
614
617
instance_count = instance_count ,
615
- instance_type = instance_type ,
618
+ instance_type = "ml.m5.xlarge" ,
616
619
framework_version = tf_full_version ,
617
620
py_version = tf_full_py_version ,
618
621
sagemaker_session = pipeline_session ,
@@ -645,10 +648,7 @@ def test_model_registration_with_tensorflow_model_with_pipeline_model(
645
648
)
646
649
pipeline = Pipeline (
647
650
name = pipeline_name ,
648
- parameters = [
649
- instance_count ,
650
- instance_type ,
651
- ],
651
+ parameters = [instance_count ],
652
652
steps = [step_train , step_register_model ],
653
653
sagemaker_session = pipeline_session ,
654
654
)
0 commit comments