Skip to content

Error querying SageMaker endpoint

0

Can anyone please help with resolving this issue?

https://github.com/aws/amazon-sagemaker-examples/issues/4725

Lei

asked 2 years ago450 views
1 Answer
0

Hello,

I understand that you tried to query the Sagemaker endpoint but received the below error:

Error:

ModelError: An error occurred (ModelError) when calling the InvokeEndpoint operation: Received client error (400) from primary with message "{
"code": 400,
"type": "InternalServerException",
"message": "model_fn() takes 1 positional argument but 2 were given"
}

Here, I would like to mention that I tried to replicate the scenario at my end using the documentation you provided; however, I was successfully able to query the endpoint at my end without facing any error.

Enter image description here

Further, I deep dived into this issue, and I could find that this issue can be mitigated by adding the argument “context=None” to the model_fn() and predict_fn() as follows:

def model_fn(model_dir,context=None):

def predict_fn(data, model_and_tokenizer,context=None):

I would request that you please try this at your end and let us know how it goes for you.

If you have any difficulty or if you still run into issues, please reach out to AWS Support [1] (Sagemaker) along with your issue or use case in detail, and we would be happy to assist you further.

References:


[1] Creating support cases and case management: https://docs.aws.amazon.com/awssupport/latest/user/case-management.html#creating-a-support-casehttps://docs.aws.amazon.com/awssupport/latest/user/case-management.html#creating-a-support-case

AWS
answered 2 years ago
  • Hi Shubham, Thank you for your help. I'll try from my side.

    Lei

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.