My problem is slightly different. I need to invoke the model through a Sagemaker endpoint. I tried to add the parameter and it didn’t work.
client = boto3.client(‘sagemaker-runtime’)
s = {“inputs”: input_sentence, “parameters”: {“truncation”:True}}
payload = json.dumps(s).encode(‘utf-8’)
content_type = “application/json”
endpoint_name = “huggingface-pytorch-inference-2021-09-21-18-08-15-185”
accept = “application/json”
response = client.invoke_endpoint(
EndpointName=endpoint_name,
ContentType=content_type,
Accept=accept,
Body=payload,
)
I’m getting the following error with long input -
ModelError: An error occurred (ModelError) when calling the InvokeEndpoint operation: Received client error (400) from model with message "{
“code”: 400,
“type”: “InternalServerException”,
“message”: “The size of tensor a (577) must match the size of tensor b (512) at non-singleton dimension 1”
}