【问题标题】:How do I invoke a Amazon SageMaker endpoint with the Python SDK如何使用 Python 开发工具包调用 Amazon SageMaker 终端节点
【发布时间】:2023-03-26 12:20:01
【问题描述】:

我正在尝试使用这个非常简单的命令:

import boto3 client = boto3.client('sagemaker-runtime')

列在documentation

但我收到此错误:

UnknownServiceError: Unknown service: 'sagemaker-runtime'. Valid service names are: acm, etc..

我的目标是能够调用我在 Amazon SageMaker 中创建的终端节点。

我是在 Sagemaker 中的 Jupyter 笔记本上执行此操作的,所以我觉得这应该没问题。如何让它在此处和 Sagemaker 环境之外运行?

【问题讨论】:

    标签: amazon-web-services amazon-sagemaker


    【解决方案1】:

    文档不正确。这就是您使用 SageMaker Python SDK 获取客户端的方式。

    import boto3
    client = boto3.client('runtime.sagemaker')
    

    我已经成功地做到了。而且,正如 John 所说,请务必更新您的 boto3awscli 版本。

    【讨论】:

      【解决方案2】:

      Amazon SageMaker 是一项非常新的服务(2017 年 12 月)。

      您需要更新您的 boto 库才能使用它:

      sudo pip install boto --upgrade
      sudo pip install boto3 --upgrade
      sudo pip install awscli --upgrade
      

      【讨论】:

      • 我也推荐 pip install --upgrade botocore
      猜你喜欢
      • 1970-01-01
      • 2018-05-30
      • 1970-01-01
      • 2020-01-20
      • 2019-06-23
      • 2019-04-23
      • 1970-01-01
      • 2018-12-17
      • 2021-01-20
      相关资源
      最近更新 更多