Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kubeflow-pipeline aws sagemaker example MNIST Classification - throwing an error while invoking the endpoint #1401

Closed
vackysh opened this issue May 30, 2019 · 4 comments
Assignees

Comments

@vackysh
Copy link

vackysh commented May 30, 2019

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

@Jeffwan
Copy link
Member

Jeffwan commented Jun 8, 2019

@mbaijal is working on SageMaker components. Meghna, could you help take a look at this issue?

@mbaijal
Copy link
Contributor

mbaijal commented Jun 10, 2019

@Jeffwan Will take a look.

@Jeffwan
Copy link
Member

Jeffwan commented Apr 10, 2020

This should be resolved after #3374

Feel free to reopen if this still exist

/close

@k8s-ci-robot
Copy link
Contributor

@Jeffwan: Closing this issue.

In response to this:

This should be resolved after #3374

Feel free to reopen if this still exist

/close

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.

magdalenakuhn17 pushed a commit to magdalenakuhn17/pipelines that referenced this issue Oct 22, 2023
Also updated README with a note about the kubectl version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants