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
"
Traceback (most recent call last):
File "sagemaker_api.py", line 28, in
Body=payload)
File "/usr/lib/python3.6/site-packages/botocore/client.py", line 357, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/usr/lib/python3.6/site-packages/botocore/client.py", line 661, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.errorfactory.ValidationError: An error occurred (ValidationError) when calling the InvokeEndpoint operation: 1 validation error detected: Value at 'body' failed to satisfy constraint: Member must not be null
"
Please help me out to resolve this error.
Regards,'
Varun
The text was updated successfully, but these errors were encountered:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
Hi @Jeffwan ,
From the github documentation, I took the below sample for invoking the sagemaker endpoint :
import json
import io
import boto3
import os
import csv
import pickle, gzip, numpy, urllib.request, json
from urllib.parse import urlparse
Load the dataset
urllib.request.urlretrieve("http://deeplearning.net/data/mnist/mnist.pkl.gz", "mnist.pkl.gz")
with gzip.open('mnist.pkl.gz', 'rb') as f:
train_set, valid_set, test_set = pickle.load(f, encoding='latin1')
#ENDPOINT_NAME = os.environ['ENDPOINT_NAME']
runtime = boto3.Session().client('sagemaker-runtime')
Simple function to create a csv from our numpy array
def np2csv(arr):
csv = io.BytesIO()
#numpy.savetxt(csv, arr, delimiter=',', fmt='%g')
return csv.getvalue().decode().rstrip()
payload = np2csv(train_set[0][30:31])
response = runtime.invoke_endpoint(EndpointName='Endpoint-20190524070606-SEHI',
ContentType='text/csv',
Body=payload)
result = json.loads(response['Body'].read().decode())
print(result)
Getting the below error
"
Traceback (most recent call last):
File "sagemaker_api.py", line 28, in
Body=payload)
File "/usr/lib/python3.6/site-packages/botocore/client.py", line 357, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/usr/lib/python3.6/site-packages/botocore/client.py", line 661, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.errorfactory.ValidationError: An error occurred (ValidationError) when calling the InvokeEndpoint operation: 1 validation error detected: Value at 'body' failed to satisfy constraint: Member must not be null
"
Please help me out to resolve this error.
Regards,'
Varun
The text was updated successfully, but these errors were encountered: