首页 文章

如何将更大的.csv文件传递给亚马逊sagemaker,以便使用批量转换作业进行预测

提问于
浏览
0

我创建了一个自定义模型并将其部署在sagemaker上 . 我正在使用批转换作业调用 endpoints . 如果输入文件很小,即csv文件中的行数较少,则它可以工作 . 如果我上传了大约200000行的文件,我在cloudwatch日志中收到此错误 .

2018-11-21 09:11:52.666476: W external/org_tensorflow/tensorflow/core/framework/allocator.cc:113]
Allocation of 2878368000 exceeds 10% of system memory.
2018-11-21 09:11:53.166493: W external/org_tensorflow/tensorflow/core/framework/allocator.cc:113] 
Allocation of 2878368000 exceeds 10% of system memory.
[2018-11-21 09:12:02,544] ERROR in serving: <_Rendezvous of RPC that 
terminated with:
#011status = StatusCode.DEADLINE_EXCEEDED
#011details = "Deadline Exceeded"
#011debug_error_string = "
{
"created": "@1542791522.543282048",
"description": "Error received from peer",
"file": "src/core/lib/surface/call.cc",
"file_line": 1017,
"grpc_message": "Deadline Exceeded",
"grpc_status": 4
}
"

可能出现问题的任何想法 . 这是我用来创建转换作业的转换函数 .

transformer =sagemaker.transformer.Transformer(
base_transform_job_name='Batch-Transform',
model_name='sagemaker-tensorflow-2018-11-21-07-58-15-887',
instance_count=1,
instance_type='ml.m4.xlarge',
output_path='s3://2-n2m-sagemaker-json-output/out_files/'

)
input_location = 's3://1-n2m-n2g-csv-input/smal_sagemaker_sample.csv'
transformer.transform(input_location, content_type='text/csv', split_type='Line')

.csv文件包含2列customer的名字和姓氏,然后我使用input_fn()在sagemaker本身中对其进行预处理 .

1 回答

  • 0

    该错误看起来来自GRPC客户端在服务器能够响应之前关闭连接 . (在https://github.com/aws/sagemaker-tensorflow-container/issues/46上有sagemaker tensorflow容器的现有功能请求,以使此超时可配置)

    您可以尝试使用sagemaker Transformer进行一些操作,以限制每个请求的大小,使其适合超时:

    • max_payload 设置为较小的值,例如2-3 MB(the default is 6 MB

    • 如果您的实例指标表明它有备用的计算/内存资源,请尝试 max_concurrent_transforms > 1以使用多个工作程序

    • 将csv文件拆分为多个输入文件 . 使用更大的数据集,您还可以增加实例计数以扇出处理

相关问题