更新私有中心中的资源 - 亚马逊 SageMaker AI
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

更新私有中心中的资源

您可以在私有中心中更新资源以更改其元数据。您可以更新的资源包括对 Amazon 模型的 SageMaker JumpStart模型引用、自定义模型、笔记本、数据集和 JsonDoc。

更新模型、笔记本、数据集或 JsonDoc 资源时,您可以更新内容描述、显示名称、关键字和支持状态。更新模型对 JumpStart 模型的引用时,您只能更新指定要使用的最低模型版本的字段。

  • “更新模型或笔记本资源” 以包含 DataSet/JsonDoc。在 CLI 命令中, DataSets/JsonDocs 应添加到 hub-content-type参数中。

请按照特定于您希望更新的资源的部分进行操作。

更新模型或笔记本资源

要更新模型或笔记本资源,请使用 UpdateHubContentAPI。

您可以使用此 API 更新的有效元数据字段如下:

  • HubContentDescription:资源的描述。

  • HubContentDisplayName:资源的显示名称。

  • HubContentMarkdown:资源的描述,采用 Markdown 格式。

  • HubContentSearchKeywords:资源的可搜索关键字。

  • SupportStatus:资源的当前状态。

在您的请求中,请涵盖针对上述一个或多个字段的更改。如果您尝试更新任何其他字段,例如中心内容类型,则会收到错误消息。

适用于 Python (Boto3) 的 Amazon SDK

以下示例说明如何使用适用于 Python (Boto3) 的 Amazon SDK提交 UpdateHubContent请求。

注意

您在请求中指定的 HubContentVersion 表示特定版本的元数据已更新。要查找您的中心内容的所有可用版本,您可以使用 ListHubContentVersionsAPI。

import boto3 sagemaker_client = boto3.Session(region_name=<Amazon-region>).client("sagemaker") sagemaker_client.update_hub_contents( HubName=<hub-name>, HubContentName=<resource-content-name>, HubContentType=<"Model"|"Notebook">, HubContentVersion='1.0.0', # specify the correct version that you want to update HubContentDescription=<updated-description-string> )
Amazon CLI

以下示例说明如何使用Amazon CLI提交 update-hub-content请求。

aws sagemaker update-hub-content \ --hub-name <hub-name> \ --hub-content-name <resource-content-name> \ --hub-content-type <"Model"|"Notebook"> \ --hub-content-version "1.0.0" \ --hub-content-description <updated-description-string>

更新模型参考

要更新模型对 JumpStart 模型的引用,请使用 UpdateHubContentReferenceAPI。

您只能更新模型参考的 MinVersion 字段。

适用于 Python (Boto3) 的 Amazon SDK

以下示例说明如何使用适用于 Python (Boto3) 的 Amazon SDK提交 UpdateHubContentReference请求。

import boto3 sagemaker_client = boto3.Session(region_name=<Amazon-region>).client("sagemaker") update_response = sagemaker_client.update_hub_content_reference( HubName=<hub-name>, HubContentName=<model-reference-content-name>, HubContentType='ModelReference', MinVersion='1.0.0' )
Amazon CLI

以下示例说明如何使用Amazon CLI提交 update-hub-content-reference请求。

aws sagemaker update-hub-content-reference \ --hub-name <hub-name> \ --hub-content-name <model-reference-content-name> \ --hub-content-type "ModelReference" \ --min-version "1.0.0"