json - aws sagemaker 端点的输入 json 字符串是否有限制?
问题描述
我有大约 5MB 的 json 字符串要发送到我的端点。我正在使用 boto3.client 从我的 python 客户端调用端点。它抛出 ConnectionResetError。
File "C:\Users\corona\AppData\Local\Programs\Python\Python37\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen
chunked=chunked)
File "C:\Users\corona\AppData\Local\Programs\Python\Python37\lib\site-packages\urllib3\connectionpool.py", line 354, in _make_request
conn.request(method, url, **httplib_request_kw)
File "C:\Users\corona\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 1229, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:\Users\corona\AppData\Local\Programs\Python\Python37\lib\site-packages\botocore\awsrequest.py", line 92, in _send_request
method, url, body, headers, *args, **kwargs)
File "C:\Users\corona\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 1275, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "C:\Users\corona\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 1224, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:\Users\corona\AppData\Local\Programs\Python\Python37\lib\site-packages\botocore\awsrequest.py", line 119, in _send_output
self.send(msg)
File "C:\Users\corona\AppData\Local\Programs\Python\Python37\lib\site-packages\botocore\awsrequest.py", line 203, in send
return super(AWSConnection, self).send(str)
File "C:\Users\corona\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 977, in send
self.sock.sendall(data)
File "C:\Users\corona\AppData\Local\Programs\Python\Python37\lib\ssl.py", line 1012, in sendall
v = self.send(byte_view[count:])
File "C:\Users\corona\AppData\Local\Programs\Python\Python37\lib\ssl.py", line 981, in send
return self._sslobj.write(data)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
查看跟踪,我猜这是由于 json 字符串大小。有人可以帮我解决这个问题吗?
解决方案
超过负载大小限制会导致 SageMaker Runtime 服务重置连接。
从 SageMaker文档:
端点调用的最大有效负载大小 | 5 MB
您可以使用比 JSON 更节省空间的数据格式来传输有效负载,但可用选项将取决于数据类型和您使用的模型图像(即亚马逊提供的还是自定义实现)。
推荐阅读
- wikidata-api - Wikidata Api - 子实例和子类的距离树
- python - 抽象类应该返回与预期实现方法相同的类型吗?
- jmeter - Jmeter 没有 GUI 模式运行 .jmx 不包括运行覆盖方法 getDefaultParameters()
- c# - 获取进程关闭原因信息
- nest - 默认 JsonNetSerializer 不使用驼峰式属性名称
- python - Postgres 是否缓存了我们的查询,我们如何绕过它?
- java - 读取 HTML 时的 Http 响应代码 429
- maven - 使用 maven 为 Micronaut 招摇
- matlab - 为什么在交叉验证的情况下,MATLAB 的 ROC 绘图函数 perfcurve 会产生 3 条 ROC 曲线?
- reactjs - 当孩子在'cp-react-tree-table'中展开/折叠时如何切换箭头