You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Exception messages raised in input_fn are not shown after invoke_endpoint raises an error #2067
Hi,
I'm using SKLearn estimator and my inference script contains something like:
def predict_fn(input_data, model):
a = input_data.get('a')
if asset_type and type(a) != str:
raise Exception(f'The asset type must be a string, not {type(asset_type).__name__}')
after running the following code with a false body, e.g. a = [a, b, c]:
I get: {'Error': {'Message': 'Received server error (500) from model with message "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">\n<title>500 Internal Server Error</title>\n<h1>Internal Server Error</h1>\n<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>\n"..... }
Why can't I see my exception message in the output as written in input_fn? (in the cloudWatch console it is shown)
changed the title [-]Exception messages raised in input_fn are not shown after invoke_endpoint raises error[/-][+]Exception messages raised in input_fn are not shown after invoke_endpoint raises an error[/+]on Jan 5, 2021
Thank you for the quick response, I tried also the SKLearn predictor from the SDK:
from sagemaker.sklearn.model import SKLearnPredictor
input_data = {'a': [8108]} # not a string as required
try:
predictor = SKLearnPredictor(endpoint_name=endpoint_name, serializer=sagemaker.serializers.JSONSerializer('application/json'))
inference_response = predictor.predict(data=input_data)
print(inference_response)
except client.exceptions.ModelError as e:
print(e.response)
but I still get the same non-informative error:
{'Error': {'Message': 'Received server error (500) from model with message
"<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">\n<title>500 Internal Server Error</title>\n<h1>Internal Server Error</h1>\n<p>The server encountered an internal error and was unable to complete your request...}
Activity
[-]Exception messages raised in input_fn are not shown after invoke_endpoint raises error[/-][+]Exception messages raised in input_fn are not shown after invoke_endpoint raises an error[/+]ajaykarpur commentedon Jan 5, 2021
It looks like you're using
boto3, not the SageMaker Python SDK. Here is relevant documentation for the SageMaker Python SDK: https://sagemaker.readthedocs.io/en/stable/frameworks/sklearn/sagemaker.sklearn.htmlYou can install the SDK with
pip install sagemaker.MichalShuviPowtoon commentedon Jan 6, 2021
Thank you for the quick response, I tried also the SKLearn predictor from the SDK:
but I still get the same non-informative error:
ahsan-z-khan commentedon Sep 30, 2021
Hi @MichalShuviPowtoon, please reopen if the issue still persists.
Fix recipe override errors in evaluator (#2067)
Nova release (#5969)