Description
Is your feature request related to a problem? Please describe.
Deployment is a 3-steps process:
(1) Create the model in SM
(2) Create endpoint configuration
(3) Create endpoint
Assume that I decouple (a) model training and the final model evaluation via, e.g., batch transform from (b) the model deployment. For (a) I already created and registered a model in SM. For (b) the deployment, I need to reference the name of the registred model.
Based on my understanding of 2.x SM Python API, the user has no option to cover the decoupled deployment process just by using the SM Python SDK alone:
-
The SDK provides methods via the Session object to cover steps (2) and (3) of the deployment process:
create_endpoint_config()
,create_endpoint()
.create_endpoint_config()
requires the model name as a parameter -
However, no method seems to be available which allows me to retrieve the list of model names via the SM Python SDK.
I need to create an additional SM client using boto3 in my current process to deploy models in a decoupled fashion:
import sagemaker
session = sagemaker.Session()
sm_client = session.boto_session.client("sagemaker")
# Assume I like to create an endpoint for the last model created
model_name = sm_client.list_models()["Models"][1]["ModelName"]
session.create_endpoint_config(name = "test-config",
model_name = model_name,
initial_instance_count = 1,
instance_type = "ml.m5.large")
session.create_endpoint(endpoint_name = "test-endpoint",
config_name = "test-config",
wait = False)
To provide support for a fully decoupled deployment process using the SM Python SDK, I would vote for a list_models()
method in the Session class. This method returns the list of names of all available models in SM. The user can retrieve the desired model name from this list and use it as a parameter in create_endpoint_config()
. This eliminates the need to create an extra boto3 SM client.