0
votes

I was invoking the SageMaker endpoint from my angular front-end when I came across this error on AWS CloudWatch regarding my model making inferences from the data (In the form of a comma-separated string with target values at the first index) I was sending : Unable to parse numeric values. The string I'm using to invoke the endpoint was : "1533071820,0.05619,0.05619,0.05611,0.05611,0.006076\n"

String request = "1533071820,0.05619,0.05619,0.05611,0.05611,0.006076\n"

ByteBufferbuf = ByteBuffer.wrap(request.getBytes()); invokeEndpointRequest.setBody(buf); Use the SageMaker API AmazonSageMakerRuntime amazonSageMaker = AmazonSageMakerRuntimeClientBuilder.defaultClient(); Invoke the model endpoint on SageMaker InvokeEndpointResult invokeEndpointResult = amazonSageMaker.invokeEndpoint(invokeEndpointRequest);

The result I was expecting from the endpoint is a JSON object with the 'score' attribute in the format : {"predictions": [{"score": xxxxxxx}]}

I am getting a 'ModelError: Unable to evaluate payload' from the IDE logs and 'Unable to parse numeric values on CloudWatch'

1

1 Answers

0
votes

So, upon debugging this issue, I found that because of the newline character at the end, the model was assuming there are 2 strings in my input but there's only one. Hence, the error. So I just changed the string to : "1533071820,0.05619,0.05619,0.05611,0.05611,0.006076". And if I'm parsing more than one payload(batch), it's: "1533071820,0.05619,0.05619,0.05611,0.05611,0.006076\n1533071820,0.05619,0.05619,0.05611,0.05611,0.006076" where my 2 inputs are separated by that newline character and more importantly, there's no newline character at the end