Model Collection

This module contains code related to Amazon SageMaker Collections in the Model Registry.

Use these methods to help you create and maintain your Collections.

class sagemaker.collection.Collection(sagemaker_session)

Bases: object

Sets up an Amazon SageMaker Collection.

Initializes a Collection instance.

A Collection is a logical grouping of Model Groups.

Parameters

sagemaker_session (sagemaker.session.Session) – A Session object which manages interactions between Amazon SageMaker APIs and other AWS services needed. If unspecified, a session is created using the default AWS configuration chain.

create(collection_name, parent_collection_name=None)

Creates a Collection.

Parameters
  • collection_name (str) – The name of the Collection to create.

  • parent_collection_name (str) – The name of the parent Collection. Is None if the Collection is created at the root level.

delete(collections)

Deletes a list of Collections.

Parameters

collections (List[str]) – A list of Collections to delete. Only deletes a Collection if it is empty.

add_model_groups(collection_name, model_groups)

Adds a list of Model Groups to a Collection.

Parameters
  • collection_name (str) – The name of the Collection.

  • model_groups (List[str]) – The names of the Model Groups to add to the Collection.

remove_model_groups(collection_name, model_groups)

Removes a list of Model Groups from a Collection.

Parameters
  • collection_name (str) – The name of the Collection.

  • model_groups (List[str]) – The names of the Model Groups to remove.

move_model_group(source_collection_name, model_group, destination_collection_name)

Moves a Model Group from one Collection to another.

Parameters
  • source_collection_name (str) – The name of the source Collection.

  • model_group (str) – The name of the Model Group to move.

  • destination_collection_name (str) – The name of the destination Collection.

list_collection(collection_name=None)

Lists the contents of the specified Collection.

If there is no Collection with the name collection_name, lists all the Collections at the root level.

Parameters

collection_name (str) – The name of the Collection whose contents are listed.