amazon-sagemaker-examples icon indicating copy to clipboard operation
amazon-sagemaker-examples copied to clipboard

Model Error - Invoke the endpoint

Open Firas-Ben-Hassan opened this issue 8 years ago • 16 comments

When I try to invoke the endpoint and start the prediction , I get this error below

ModelError: An error occurred (ModelError) when calling the InvokeEndpoint operation: Received server error (500) from model with message "

500 Internal Server Error

Internal Server Error

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.

". See https://eu-west-1.console.aws.amazon.com/cloudwatch/home?region=eu-west-1#logEventViewer:group=/aws/sagemaker/Endpoints/sagemaker-all-2018-04-11-12-00-21-560 in account 180856571690 for more information.

Firas-Ben-Hassan avatar Apr 11 '18 13:04 Firas-Ben-Hassan

As the error says, there could be either 1. server is overloaded : Solution would be to use higher instance type in sagemaker. 2 Error in application : check whether the application (prediction script) is running without any errors before running it through endpoint.

Also please post what is exact error (you can find it in cloud-watch; see the link mentioned in your error)

cna274 avatar Apr 11 '18 19:04 cna274

Closing for now. Feel free to re-open if you're still experiencing problems. Thanks.

djarpin avatar Apr 27 '18 15:04 djarpin

Hey @djarpi @cna274

I am facing the same issue. Am training the network on ml.m4.xlarge. It's working perfectly before the endpoint.

from sagemaker.predictor import RealTimePredictor
from sagemaker.pytorch import PyTorchModel

class StringPredictor(RealTimePredictor):
    def __init__(self, endpoint_name, sagemaker_session):
        super(StringPredictor, self).__init__(endpoint_name, sagemaker_session, content_type='text/plain')

model = PyTorchModel(model_data=estimator.model_data,
                     role = role,
                     framework_version='0.4.0',
                     entry_point='predict.py',
                     source_dir='serve',
                     predictor_cls=StringPredictor)
predictor = model.deploy(initial_instance_count=1 , instance_type='ml.m4.xlarge')

Can you guys please help me out?

rpalsaxena avatar Nov 13 '18 13:11 rpalsaxena

Hi @rpalsaxena ,

Did you resolve this issue as I am working on same project and have same issue with this code?

Thanks

joshisagar92 avatar Feb 17 '19 14:02 joshisagar92

did you resolve this issue i facing the same problem.

Juliopr avatar Sep 09 '19 01:09 Juliopr

Hi,

We are experiencing a similar issue, here's the error we get when invoking the Endpoint:

 ModelError: An error occurred (ModelError) when calling the InvokeEndpoint operation: Received client error (400) from model with message "Unable to evaluate payload provided: [07:01:25] /workspace/src/learner.cc:723: Check failed: mparam_.num_feature != 0 (0 vs. 0) : 0 feature is supplied.  Are you using raw Booster interface?
Stack trace:
  [bt] (0) /usr/local/lib/python3.5/dist-packages/xgboost/./lib/libxgboost.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x24) [0x7fc131392cb4]
  [bt] (1) /usr/local/lib/python3.5/dist-packages/xgboost/./lib/libxgboost.so(xgboost::LearnerImpl::LazyInitModel()+0x5bf) [0x7fc1314281ef]
  [bt] (2) /usr/local/lib/python3.5/dist-packages/xgboost/./lib/libxgboost.so(xgboost::Booster::LazyInit()+0x22) [0x7fc13139caf2]
  [bt] (3) /usr/local/lib/python3.5/dist-packages/xgboost/./lib/libxgboost.so(XGBoosterPredict+0x53) [0x7fc13138ebc3]
  [bt] (4) /usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(ffi_call_unix64+0x4c) [0x7fc15083ae20]
  [bt] (5) /usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(ffi_call+0x2eb) [0x7fc15083a88b]
  [bt] (6) /usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(_ctypes_callproc+0x49a) [0x7fc15083501a]
  [bt] (7) /usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(+0x9fcb) [0x7fc150828fcb]
  [bt] (8) /usr/bin/python3(PyObject_Call+0x47) [0x5c20e7]

". See https://eu-west-1.console.aws.amazon.com/cloudwatch/home?region=eu-west-1#logEventViewer:group=/aws/sagemaker/Endpoints/XGBoostEndpoint-CU01 in account 413242204882 for more information. 

EC2 Instance: ml.t2.medium

Is there something we need to do to make it work?

ezequielpaura avatar Sep 09 '19 07:09 ezequielpaura

I don't think anyone shared the solution to this issue here, don't understand why is the issue closed then? I am also getting the same error and wasted 2 days still no luck. Could anyone provide some inputs please and guide me to right direction???

sandeep-ahuja avatar Sep 14 '19 20:09 sandeep-ahuja

if you are using a Keras/TensorFlow model. The problems is the protobuf.pb file. The server where you deploy the model uses Tensorflow version 1.12 and you are using another version of Tensorflow in you machine. So you will need install tensorflow 1.12 in you machine and save the model in the right tensorflow version.

Juliopr avatar Sep 15 '19 03:09 Juliopr

In cloudwatch is possible see the python error in the EC instance. This help to find a solution for the problem. This error show only the API ouput and this is a standard response for some type of internal error.

Juliopr avatar Sep 15 '19 03:09 Juliopr

I wonder why this ticket is closed but no answer nor solution provided. I'm currently having the same issue now and curious to know what the answer is

aalinazar avatar Apr 29 '20 11:04 aalinazar

Maybe this helps @aalinazar ?: https://github.com/awslabs/amazon-sagemaker-examples/issues/874

ezequielpaura avatar Apr 29 '20 12:04 ezequielpaura

I was able to resolve my issue. We are seeing this kind of error because somewhere on the backend python script that we wrote has some error like ValueError.

Once I opened the cloudwatch logs, it was puzzling and I couldnt resolve the issue. But I searched for the term 'Error' in the search bar. On search, I was able to list the error and I had ValueError.

The reason for ValueError is, I tried a tutorial. The example predict_fn returned a array of two elements, [prediction, pred_prob]. The second element pred_prob had 2 elements and the first element 'prediction' had only one element. This caused dimension issues for me.

Hope this helps!

kaddynator avatar Oct 04 '20 07:10 kaddynator

same problem happened to me I still don't know why it raise that error. But when i deleted the end point then remake it it worked normally

HMMK99 avatar Jul 04 '21 13:07 HMMK99

i have the same problem please can someone help me

zinebtabet avatar Jul 10 '23 12:07 zinebtabet

Still struggling with this issue! The endpoint worked well several weeks ago...

ton731 avatar Jul 12 '23 08:07 ton731

When I try to invoke the endpoint and start the prediction , I get this error below

ModelError: An error occurred (ModelError) when calling the InvokeEndpoint operation: Received server error (500) from model with message "

500 Internal Server Error # Internal Server Error 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.

". See https://eu-west-1.console.aws.amazon.com/cloudwatch/home?region=eu-west-1#logEventViewer:group=/aws/sagemaker/Endpoints/sagemaker-all-2018-04-11-12-00-21-560 in account 180856571690 for more information.

did you find the solution for this problem ?

tabetzineb avatar Jul 12 '23 12:07 tabetzineb