【问题标题】:How to increase AWS Sagemaker invocation time out while waiting for a response如何在等待响应时增加 AWS Sagemaker 调用超时
【发布时间】:2021-01-22 13:13:57
【问题描述】:

我将一个大型 3D 模型部署到 aws sagemaker。推理需要 2 分钟或更长时间。从 Python 调用预测器时出现以下错误:

An error occurred (ModelError) when calling the InvokeEndpoint operation: Received server error (0) from model with message "Your invocation timed out while waiting for a response from container model. Review the latency metrics for each container in Amazon CloudWatch, resolve the issue, and try again."'

在 Cloud Watch 中,我还看到容器正在处理时出现一些 PING 超时:

2020-10-07T16:02:39.718+02:00 2020/10/07 14:02:39 https://forums.aws.amazon.com/ 106#106: *251 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 10.32.0.2, server: , request: "GET /ping HTTP/1.1", upstream: "http://unix:/tmp/gunicorn.sock/ping", host: "model.aws.local:8080"

如何增加调用超时时间?

或者有没有办法对 sagemaker 端点进行异步调用?

【问题讨论】:

  • 您的赏金将在几个小时后结束。我的回答够了吗?如果是这样,请考虑接受或授予赏金,否则请考虑澄清问题或就您遇到的任何问题对我的回答发表评论。 stackoverflow.com/help/bounty

标签: python amazon-web-services timeout amazon-sagemaker inference


【解决方案1】:

目前无法增加超时时间——这是 GitHub 中的一个未解决问题。查看有关 SO 的问题和类似问题,您似乎可以将批量转换与推理结合使用。

参考文献

https://stackoverflow.com/a/55642675/806876

Sagemaker Python SDK 超时问题:https://github.com/aws/sagemaker-python-sdk/issues/1119

【讨论】:

    【解决方案2】:

    这个超时实际上是在服务器端指定的——具体的端点。您可以尝试bring your own container 也称为BYOC 的方式,这样您就可以完全控制端点端的所有内容,包括超时。

    您还可以引用此 repo 的端点部分,它来自我的一位同事 - https://github.com/jackie930/yolov4-SageMaker

    您应该更改的超时存在于serve.py model_server_timeout = os.environ.get('MODEL_SERVER_TIMEOUT', 60)

    【讨论】:

    • 我已经修改了默认的 sagemaker 容器并更改了两个超时。但是,这个超时似乎来自容器外部..
    • 是的,在客户端,SageMaker 运行时也有 60 的超时,并且无法更改,所以我的解决方案是在端点内部,我们让作业在 单独的进程中运行 并在作业完成之前响应调用。作业完成后,必须将结果发送回客户端。
    猜你喜欢
    • 2017-06-15
    • 2018-10-06
    • 2019-12-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-10
    相关资源
    最近更新 更多