@@ -555,14 +555,14 @@ def prepare_framework_container_def(model, instance_type, s3_operations):
555
555
return sagemaker .container_def (deploy_image , model .model_data , deploy_env )
556
556
557
557
558
- def model_config (instance_type , model , role = None , image = None ):
558
+ def model_config (model , instance_type = None , role = None , image = None ):
559
559
"""Export Airflow model config from a SageMaker model
560
560
561
561
Args:
562
- instance_type (str): The EC2 instance type to deploy this Model to. For
563
- example, 'ml.p2.xlarge'
564
562
model (sagemaker.model.FrameworkModel): The SageMaker model to export
565
563
Airflow config from
564
+ instance_type (str): The EC2 instance type to deploy this Model to. For
565
+ example, 'ml.p2.xlarge'
566
566
role (str): The ``ExecutionRoleArn`` IAM Role ARN for the model
567
567
image (str): An container image to use for deploying the model
568
568
@@ -577,7 +577,7 @@ def model_config(instance_type, model, role=None, image=None):
577
577
if isinstance (model , sagemaker .model .FrameworkModel ):
578
578
container_def = prepare_framework_container_def (model , instance_type , s3_operations )
579
579
else :
580
- container_def = model .prepare_container_def (instance_type )
580
+ container_def = model .prepare_container_def ()
581
581
base_name = utils .base_name_from_image (container_def ["Image" ])
582
582
model .name = model .name or utils .name_from_base (base_name )
583
583
@@ -599,10 +599,10 @@ def model_config(instance_type, model, role=None, image=None):
599
599
600
600
601
601
def model_config_from_estimator (
602
- instance_type ,
603
602
estimator ,
604
603
task_id ,
605
604
task_type ,
605
+ instance_type = None ,
606
606
role = None ,
607
607
image = None ,
608
608
name = None ,
@@ -612,8 +612,6 @@ def model_config_from_estimator(
612
612
"""Export Airflow model config from a SageMaker estimator
613
613
614
614
Args:
615
- instance_type (str): The EC2 instance type to deploy this Model to. For
616
- example, 'ml.p2.xlarge'
617
615
estimator (sagemaker.model.EstimatorBase): The SageMaker estimator to
618
616
export Airflow config from. It has to be an estimator associated
619
617
with a training job.
@@ -625,6 +623,8 @@ def model_config_from_estimator(
625
623
task_type (str): Whether the task is from SageMakerTrainingOperator or
626
624
SageMakerTuningOperator. Values can be 'training', 'tuning' or None
627
625
(which means training job is not from any task).
626
+ instance_type (str): The EC2 instance type to deploy this Model to. For
627
+ example, 'ml.p2.xlarge'
628
628
role (str): The ``ExecutionRoleArn`` IAM Role ARN for the model
629
629
image (str): An container image to use for deploying the model
630
630
name (str): Name of the model
@@ -665,7 +665,7 @@ def model_config_from_estimator(
665
665
)
666
666
model .name = name
667
667
668
- return model_config (instance_type , model , role , image )
668
+ return model_config (model , instance_type , role , image )
669
669
670
670
671
671
def transform_config (
@@ -912,10 +912,10 @@ def transform_config_from_estimator(
912
912
SageMakerTransformOperator in Airflow.
913
913
"""
914
914
model_base_config = model_config_from_estimator (
915
- instance_type = instance_type ,
916
915
estimator = estimator ,
917
916
task_id = task_id ,
918
917
task_type = task_type ,
918
+ instance_type = instance_type ,
919
919
role = role ,
920
920
image = image ,
921
921
name = model_name ,
@@ -995,7 +995,7 @@ def deploy_config(model, initial_instance_count, instance_type, endpoint_name=No
995
995
dict: Deploy config that can be directly used by
996
996
SageMakerEndpointOperator in Airflow.
997
997
"""
998
- model_base_config = model_config (instance_type , model )
998
+ model_base_config = model_config (model , instance_type )
999
999
1000
1000
production_variant = sagemaker .production_variant (
1001
1001
model .name , instance_type , initial_instance_count
0 commit comments