Skip to content

Instantly share code, notes, and snippets.

@gleeb
Created August 8, 2022 10:00
Show Gist options
  • Save gleeb/2bffab5715fc50620bf6c3599a418b2c to your computer and use it in GitHub Desktop.
Save gleeb/2bffab5715fc50620bf6c3599a418b2c to your computer and use it in GitHub Desktop.
Sagemaker create model from registry
import boto3
from datetime import datetime
sm_client = boto3.client('sagemaker', region_name='us-east-1')
model_name = 'titanic-survival-v1'
print("Model name : {}".format(model_name))
container_list = [{'ModelPackageName': 'arn:aws:sagemaker:us-east-1:...:model-package/titanic-survival/3'}]
create_model_response = sm_client.create_model(
ModelName = model_name,
ExecutionRoleArn = 'arn:aws:iam::...:role/service-role/AmazonSageMaker-ExecutionRole-XYZ',
Containers = container_list
)
print("Model arn : {}".format(create_model_response["ModelArn"]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment