SageMaker batchTransform MultiRecord 错误 - 无法将数据解析为 JSON。确保 Content-Type 标头设置为“application/json”

问题描述 投票:0回答:1

我正在尝试调用 sagemaker 批量转换

输入文件 example.jsonl

{"number":"0060540745","brand_name":"XYZ","generic_keywords":"123"}
{"number":"0060540745","brand_name":"XYZ","generic_keywords":"123"}
{"number":"0060540745","brand_name":"XYZ","generic_keywords":"123"}

当我使用batchStrategy作为

SingleRecord
转换工作正常

当我尝试将批量策略更改为

MultiRecord
时,我开始收到错误

错误

Unable to parse data as JSON. Make sure the Content-Type header is set to "application/json"

如果您检查我的作业配置,我已经按上述设置了我的 contentType。

我该如何解决这个问题

我尝试使用以下内容类型,例如

"application/json"

"application/jsonlines"

"application/x+jsonlines"

amazon-web-services amazon-sagemaker inference
1个回答
0
投票

我认为既然你设置为多记录,则必须修改 input_fn 来处理 jsonlines 而不是 json。

© www.soinside.com 2019 - 2024. All rights reserved.