how to access/set up a model registry ?


based on aws docs/examples (, one can create/register model that is generated by your training pipeline. first we need to create a model package group ( sample code below). is model registry already set up by default in our account or do we have to create it as well? can you have more than one model registry in an account. I don't see , in the code below, where we are passing the model registry info. I am assuming , we simply create multiple training jobs and save the models in its own model group. is there a sample code/repo, where there are multiple training steps that calls same model registry with a different group name ( i can use it as a sample). also, once the model is registered, how do i set up such that, a model can be accepted or declined, before promoting. can we set this up via code , please point me to any examples.

import time
group_name = "mygroup"
input_dict = { "ModelPackageGroupName" : group_name}

response =  client.create_model_package_group(**input_dict)
print('result :  {}'.format(response['ModelPackageGroupArn']))

1 Answer


Model package group and model registry are 2 different things. Model registry is already in your account but you have to create a model package group where you will have model packages (different versions of the model). see this notebook about using model registry. Your code above is basically creating a model group/model package group in model registry, and in that model group you will have the different versions of your model.

I don't have an example in mind, but you can easily have a code where you create different models and add them in the model groups accordingly. Following the notebook shared above , you would just add the same code but adapt it to another model group assuming that you have to two trainings happening each with a different purpose.

To summarize: model registry = N model groups and each model group = N model versions (model packages). Suppose you are doing a sentiment analysis task where you have different models per customer. You could create a Model Package Group per customer and in each group register Model Package Versions for each model created.

You can automate the testing of your model before registering into the model group by for example checking the loss metric. You can use SageMaker projects for an example that includes a pipeline. Check this example. You could basically have a conditional step in your pipeline.

Hope this helps and if I answered your question, please accept it.

Thank you

answered 19 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions