An error occurred (ModelError) when calling the InvokeEndpoint operation

0

Hello,
I received the following error message when I tried to send an array to my model:

An error occurred (ModelError) when calling the InvokeEndpoint operation: Received server error (500) from container-1 with message "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<title>500 Internal Server Error</title> <h1>Internal Server Error</h1> <p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p> ". See https://us-east-1.console.aws.amazon.com/cloudwatch/home?region=us-east-1#logEventViewer:group

I have created inference pipeline containing preprocessing and autoencoder model and deployed it to a single endpoint. Am trying to send raw data in text/csv format. EX: "39, 4, 9, 8, contact"

Please help me out in this.

Much appreciated,
Karthik

已提問 3 年前檢視次數 13015 次
1 個回答
0

Hello,

So the issue here is most likely with your inference code and how you are parsing/transforming the data coming in. Your endpoint is up and running but the format in which you are feeding it data is confusing it. The endpoint is expecting encoded data thus you need to convert your payload into the appropriate data format, there are two manners in which you can approach this.

  1. Use a serializer, when creating your endpoint with the predictor class you want to use the SageMaker Serializer to automatically encode/decode your data, this is configured while creating your endpoint. Look at the following code snippet below.

from sagemaker.predictor import csv_serializer
rf_pred = rf.deploy(1, "ml.m4.xlarge", serializer=csv_serializer)

#for prediction, decode the data properly
print(rf_pred.predict(payload).decode('utf-8'))

  1. If you choose not to use the serializer you want to encode the data on your own using something such as json.dumps(payload) to encode your data properly before sending the data to the endpoint.

Extra Resources:
SageMaker Serializers: https://sagemaker.readthedocs.io/en/stable/api/inference/serializers.html

Hope this helps!

已回答 3 年前
profile picture
專家
已審閱 1 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南