jeffheaton / t81_558_deep_learning

T81-558: Keras - Applications of Deep Neural Networks @Washington University in St. Louis
https://sites.wustl.edu/jeffheaton/t81-558/
Other
5.72k stars 3.03k forks source link

Error while invoking endpoint #55

Closed varunmodani closed 4 years ago

varunmodani commented 4 years ago

support

Hi!

While calling the model endpoint,I'm encountering the error mentioned below.I'm using keras/tensorflow model.I have used a custom code to train and deploy the model.I tried to use the cloudwatch link provided in the error but couldn't trace the error.

Any help will be appreciated.

Code

data = train_df.iloc[0,:186].values.tolist()

response = client.invoke_endpoint(EndpointName=endpoint_name, Body=json.dumps(data))

response_body = response['Body']

print(response_body.read())

Error

ModelError Traceback (most recent call last)

in () 1 data = train_df.iloc[0,:186].values ----> 2 response = client.invoke_endpoint(EndpointName=endpoint_name, Body=json.dumps(data.tolist())) 3 response_body = response['Body'] 4 print(response_body.read()) ~/anaconda3/envs/tensorflow_p36/lib/python3.6/site-packages/botocore/client.py in _api_call(self, *args, **kwargs) 314 "%s() only accepts keyword arguments." % py_operation_name) 315 # The "self" in this scope is referring to the BaseClient. --> 316 return self._make_api_call(operation_name, kwargs) 317 318 api_call.name_ = str(py_operation_name) ~/anaconda3/envs/tensorflow_p36/lib/python3.6/site-packages/botocore/client.py in _make_api_call(self, operation_name, api_params) 624 error_code = parsed_response.get("Error", {}).get("Code") 625 error_class = self.exceptions.from_code(error_code) --> 626 raise error_class(parsed_response, operation_name) 627 else: 628 return parsed_response ModelError: An error occurred (ModelError) when calling the InvokeEndpoint operation: Received server error (500) from model with message "". See https://us-west-1.console.aws.amazon.com/cloudwatch/home?region=us-west-1#logEventViewer:group=/aws/sagemaker/Endpoints/sagemaker-tensorflow-2020-03-28-17-26-02-111 in account 805885464583 for more information.
jeffheaton commented 4 years ago

I reran the code, and there does not appear to be a bug or something that changed in SageMaker. AWS usually, the most tricky part is setting up the IAM. I am not a SageMaker expert by any means, but to know anything I would need to see the CloudWatch logs. Setup your IAM so that the endpoint has access to produce those.