invoke endpoint fail
Hi Sagemaker Community,
I am a starter for using Sagemaker. Right now I want to invoke a endpoint to reload a model using Python, but I am a little confused about what should set for "Body". I am using the example code of linear learner on mnist.
And here is my reload code:
import boto3
import json
sagemaker = boto3.client('runtime.sagemaker')
result = sagemaker.invoke_endpoint(
EndpointName='linear-learner-2018-07-13-06-01-55-399',
Body = json.dumps(test_set[0].tolist())
)
I got an error: ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
I don't know what cause that and how to fix it. Can you help me with it?
Hi @Rulovescoding
- It looks like your payload is the entire MNIST test set. Can you try sending a smaller payload (maybe just a single record) instead?
- Also, can you specify
ContentType='application/json'in yourinvoke_endpoint()call? Thanks.
Closing due to inactivity. Feel free to re-open if necessary. Thanks.
Hi everybody! I'm having the same problem with the predict() method of a SM predictor. I'm sending however just one sample at a time so I cannot further reduce the payload. The problem in particular appears when my NN must process a large sample which requires some time to be analyzed. Any intuition on how to solve this? It mostly seems a timeout problem.
Thanks!
Same problem here! Did anyone figure out the cause? (seems like timeout to me as well)
I have the same problem too
Hi @fmonti , @gautiese , and @eyalgaon84 . SageMaker has several limits on inference requests. If your payload size for a single record is over 5MB or inference processing is longer than 60 seconds then passing in an S3 input (and output) path and having the container read from and write to S3 directly is probably the easiest way to work around these.
Thanks for this! I didnt see the 5MB limit anywhere, Im sure thats whats tripping my endpoint.
payload size for a single record is over 5MB
This limit has recently been removed from the InvokeEndpoint API and most of the containers provided by SageMaker.
@jesterhazy How is the limit imposed? I think I'm running into it building a BYO model on top of sagemaker-tensorflow-serving-container. Attempting to modify client_max_body_size in nginx.conf did not help.
@jesterhazy @austinmw
Running into the same problem of BYO Docker image. In my nginx.conf, I set client_max_body_size 100M; and the Docker image works fine locally. However, when I deploy the Docker on a Sagemaker endpoint via ECR, it throws ConnectionResetError: [Erro 104] Connection reset by peer.
My JSON string has 5721461 characters/bytes. It's a standard size 1x299x299x3 image array.
The endpoint works fine if I throw a small bogus payload.
Where and how can I change the InvokeEndpoint API payload size limit?
@djarpin Could you please have a look at
https://forums.aws.amazon.com/message.jspa?messageID=927004#927004
I am facing similar issue. Let know if you require additional details.
Also, I am not able to find any sample request format for linear-learner to use in boto3/invoke_endpoint. However, I can make successfull inference call inside sagemaker notebook instance.