【问题标题】:AWS Sagemaker InvokeEndpoint: operation: Endpoint of account not foundAWS Sagemaker InvokeEndpoint:操作:找不到账户的终端节点
【发布时间】:2021-08-13 18:54:01
【问题描述】:

我一直在关注本指南:https://aws.amazon.com/blogs/machine-learning/building-an-nlu-powered-search-application-with-amazon-sagemaker-and-the-amazon-es-knn-feature/

我已经成功地从我的笔记本实例部署了模型。我还可以通过从sagemaker.predictor 调用predict() 方法来生成预测。

这就是我创建和部署模型的方式

class StringPredictor(Predictor):
    def __init__(self, endpoint_name, sagemaker_session):
        super(StringPredictor, self).__init__(endpoint_name, sagemaker_session, content_type='text/plain')

pytorch_model = PyTorchModel(model_data = inputs, 
                             role=role, 
                             entry_point ='inference.py',
                             source_dir = './code', 
                             framework_version = '1.3.1',
                             py_version='py3',
                             predictor_cls=StringPredictor)

predictor = pytorch_model.deploy(instance_type='ml.m5.large', initial_instance_count=4)

从 SageMaker 仪表板,我什至可以看到我的端点和状态是“服务中”

如果我运行aws sagemaker list-endpoints,我可以看到我想要的端点也正确显示。 我的问题是当我运行这段代码时(在 sagemaker 之外),我收到了一个错误:

import boto3
sm_runtime_client = boto3.client('sagemaker-runtime')
payload = "somestring that is used here"
response = sm_runtime_client.invoke_endpoint(EndpointName='pytorch-inference-xxxx',ContentType='text/plain',Body=payload)

这是抛出的错误

botocore.errorfactory.ValidationError: An error occurred (ValidationError) when calling the InvokeEndpoint operation: Endpoint pytorch-inference-xxxx of account xxxxxx not found.

这很奇怪,因为我可以从 sagemaker 笔记本中很好地查看和运行端点,而且我也可以运行 predict() 方法。

我已经验证了地区、端点名称和帐号。

【问题讨论】:

    标签: python python-3.x amazon-web-services pytorch amazon-sagemaker


    【解决方案1】:

    我遇到了完全相同的错误,我刚刚通过设置正确的区域修复了我的错误。

    我已经验证了地区、端点名称和帐号。

    我知道您已经表明您已经验证了该区域,但就我而言,远程计算机配置了另一个区域。所以我只是在我的远程计算机上运行了以下命令

    aws configure
    

    一旦我再次设置了密钥 ID 和密钥,我设置了正确的区域,错误就消失了。

    【讨论】:

      猜你喜欢
      • 2019-01-28
      • 2023-02-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-15
      • 2019-04-23
      • 2022-08-02
      • 2018-05-30
      相关资源
      最近更新 更多