@@ -328,7 +328,7 @@ def attach(cls, training_job_name, sagemaker_session=None, model_channel_name='m
328328 return estimator
329329
330330 def deploy (self , initial_instance_count , instance_type , accelerator_type = None , endpoint_name = None ,
331- use_compiled_model = False , update_endpoint = False , ** kwargs ):
331+ model_name = None , use_compiled_model = False , update_endpoint = False , ** kwargs ):
332332 """Deploy the trained model to an Amazon SageMaker endpoint and return a ``sagemaker.RealTimePredictor`` object.
333333
334334 More information:
@@ -344,6 +344,8 @@ def deploy(self, initial_instance_count, instance_type, accelerator_type=None, e
344344 For more information: https://docs.aws.amazon.com/sagemaker/latest/dg/ei.html
345345 endpoint_name (str): Name to use for creating an Amazon SageMaker endpoint. If not specified, the name of
346346 the training job is used.
347+ model_name (str): Name to use for creating an Amazon SageMaker model. If not specified, the name of
348+ the training job is used.
347349 use_compiled_model (bool): Flag to select whether to use compiled (optimized) model. Default: False.
348350 update_endpoint (bool): Flag to update the model in an existing Amazon SageMaker endpoint.
349351 If True, this will deploy a new EndpointConfig to an already existing endpoint and delete resources
@@ -363,6 +365,7 @@ def deploy(self, initial_instance_count, instance_type, accelerator_type=None, e
363365 """
364366 self ._ensure_latest_training_job ()
365367 endpoint_name = endpoint_name or self .latest_training_job .name
368+ model_name = model_name or self .latest_training_job .name
366369 self .deploy_instance_type = instance_type
367370 if use_compiled_model :
368371 family = '_' .join (instance_type .split ('.' )[:- 1 ])
@@ -372,6 +375,7 @@ def deploy(self, initial_instance_count, instance_type, accelerator_type=None, e
372375 model = self ._compiled_models [family ]
373376 else :
374377 model = self .create_model (** kwargs )
378+ model .name = model_name
375379 return model .deploy (
376380 instance_type = instance_type ,
377381 initial_instance_count = initial_instance_count ,
0 commit comments