1 Answer
- Newest
- Most votes
- Most comments
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.
- 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'))
- 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!
Relevant content
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 3 years ago