aws / sagemaker-spark

A Spark library for Amazon SageMaker.
https://aws.github.io/sagemaker-spark/
Apache License 2.0
298 stars 126 forks source link

[Feature Request] Distributed inference with local mode #117

Open miaekim opened 4 years ago

miaekim commented 4 years ago

Please fill out the form below.

System Information

Describe the problem

Currently Python SageMaker SDK supports local mode.

import numpy
from sagemaker.mxnet import MXNetModel

model_location = 's3://mybucket/my_model.tar.gz'
code_location = 's3://mybucket/sourcedir.tar.gz'
image_url =  get_image_uri(sess.boto_region_name, 'image', repo_version="latest")
s3_model = MXNetModel(model_data=model_location, role='SageMakerRole', image=image_url,
                      entry_point='mnist.py', source_dir=code_location)

predictor = s3_model.deploy(initial_instance_count=1, instance_type='local')
data = numpy.zeros(shape=(1, 1, 28, 28))
predictor.predict(data)

# Tear down the endpoint container and delete the corresponding endpoint configuration
predictor.delete_endpoint()

# Deletes the model
predictor.delete_model()

And right now this SDK forces us to create endpoint when we define model.

Is there any plan to support local mode for inferencing?

chuyang-deng commented 4 years ago

Hi @miaekim,

sagemaker-spark does not provide hosting/inference in local mode or other SageMaker services in local mode like Python SDK.

miaekim commented 4 years ago

Got it. Please update this issue when you plan to implement it :)