sagemaker.core.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.

Classes

Collection(sagemaker_session)

Sets up an Amazon SageMaker Collection.

class sagemaker.core.collection.Collection(sagemaker_session)[source]#

Bases: object

Sets up an Amazon SageMaker Collection.

add_model_groups(collection_name: str, model_groups: List[str])[source]#

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.

create(collection_name: str, parent_collection_name: str | None = None)[source]#

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: List[str])[source]#

Deletes a list of Collections.

Parameters:

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

list_collection(collection_name: str | None = None)[source]#

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.

move_model_group(source_collection_name: str, model_group: str, destination_collection_name: str)[source]#

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.

remove_model_groups(collection_name: str, model_groups: List[str])[source]#

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.