@@ -328,7 +328,7 @@ def attach(cls, training_job_name, sagemaker_session=None, model_channel_name='m
328
328
return estimator
329
329
330
330
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 ):
332
332
"""Deploy the trained model to an Amazon SageMaker endpoint and return a ``sagemaker.RealTimePredictor`` object.
333
333
334
334
More information:
@@ -344,6 +344,8 @@ def deploy(self, initial_instance_count, instance_type, accelerator_type=None, e
344
344
For more information: https://docs.aws.amazon.com/sagemaker/latest/dg/ei.html
345
345
endpoint_name (str): Name to use for creating an Amazon SageMaker endpoint. If not specified, the name of
346
346
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.
347
349
use_compiled_model (bool): Flag to select whether to use compiled (optimized) model. Default: False.
348
350
update_endpoint (bool): Flag to update the model in an existing Amazon SageMaker endpoint.
349
351
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
363
365
"""
364
366
self ._ensure_latest_training_job ()
365
367
endpoint_name = endpoint_name or self .latest_training_job .name
368
+ model_name = model_name or self .latest_training_job .name
366
369
self .deploy_instance_type = instance_type
367
370
if use_compiled_model :
368
371
family = '_' .join (instance_type .split ('.' )[:- 1 ])
@@ -372,6 +375,7 @@ def deploy(self, initial_instance_count, instance_type, accelerator_type=None, e
372
375
model = self ._compiled_models [family ]
373
376
else :
374
377
model = self .create_model (** kwargs )
378
+ model .name = model_name
375
379
return model .deploy (
376
380
instance_type = instance_type ,
377
381
initial_instance_count = initial_instance_count ,
0 commit comments