繁体   English   中英

如何调试 sagemaker 批量转换中的调用超时错误?

[英]how to debug invocation timeout error in sagemaker batch transform?

我正在试验 sagemaker,使用此处列表中的容器https://github.com/aws/deep-learning-containers/blob/master/available_images.md来运行我的 model 并覆盖 inference.py 中的 model_fn 和 predict_fn 函数用于加载 model 和预测的文件,如链接所示( https://github.com/PacktPublishing/Learn-Amazon-SageMaker-second-edition/blob/main/Chapter%2007/huggingface/src/torchserve-predictor.py ) . 我不断收到调用超时错误 =>“模型服务器未在 3600 秒内响应 /invocations 请求”。 我是否在我的 inference.py 代码中遗漏了任何关于添加一些东西来响应 ping/healthcheck 的东西?

file : inference.py

import json
import torch
from transformers import AutoConfig, AutoTokenizer, DistilBertForSequenceClassification

JSON_CONTENT_TYPE = 'application/json'

def model_fn(model_dir):
    config_path = '{}/config.json'.format(model_dir)
    model_path =  '{}/pytorch_model.bin'.format(model_dir)
    config = AutoConfig.from_pretrained(config_path)
   ...

def predict_fn(input_data, model):
    //return predictions
...

问题不在于健康检查。 容器未响应 /invocations 请求,这可能是由于 model 从输入数据中获取预测所需的时间比预期的要长。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM