gpt4 book ai didi

python - Sagemaker-其他端点

转载 作者:行者123 更新时间:2023-12-02 21:11:24 25 4
gpt4 key购买 nike

我使用scikit Learn创建了自己的模型。除了标准终结点,“/ ping”和“/ invocations”我添加了第三个终结点,“/ estimates”(它称为predict_probabilities())。

当我在本地运行容器时,所有端点都能正常工作。当我将其部署为Sagemaker'/ invocations'上的端点时,它可以正常工作。使用相同的身份验证 token (由Postman生成),调用'/ estimates'给我一个错误:

<AccessDeniedException>
<Message>Unable to determine service/operation name to be authorized</Message>
</AccessDeniedException>

我什至看不到在cloudwatch中调用“/ estimates”的尝试。
有什么方法可以创建第三个端点,还是应该为此创建另一个容器并提供“/调用”的概率?

最佳答案

我假设您在看到AccessDeniedException时正在尝试调用https://runtime.sagemaker.us-west-2.amazonaws.com/endpoints/<YOUR_ENDPOINT_NAME>/estimates

如果是这种情况,则与您针对未映射到SageMaker Runtime API的URL发出请求有关。如果没有此类映射,SigV4不会解释或签署您的请求,因此无法对您进行身份验证。

为了调用您的端点,您应该始终将请求发送到https://runtime.sagemaker.us-west-2.amazonaws.com/endpoints/<YOUR_ENDPOINT_NAME>/invocations。如documentation中所述,SageMaker总是通过/invocations路径将请求转发到您的模型容器。

如果您希望将不同的模型行为 bundle 到同一容器中,建议您在InvokeEndpoint请求中包含CustomAttribute。该 header 将传递到您的容器,然后容器可以根据自定义属性值做出不同的响应。

关于python - Sagemaker-其他端点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54403302/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com