sagemaker-python-sdk icon indicating copy to clipboard operation
sagemaker-python-sdk copied to clipboard

Load endpoint?

Open yash1 opened this issue 8 years ago • 2 comments

Hi,

How can you load an existing endpoint after you've deployed it for predictions? The notebook example I've seen show end to end training to deployment but what if you want to reuse a previous model just to make predictions?

yash1 avatar Jan 02 '18 22:01 yash1

If you have an existing endpoint, you just need to create a Predictor object and provide it your endpoint name. This will give you an object that is the same as the object created by the Estimators in the end-to-end examples. Then, simply call its predict() method.

You can either use the generic RealTimePredictor class, which does not do any serialization/deserialization logic on your input, but can be configured to do so through constructor arguments: http://sagemaker.readthedocs.io/en/stable/predictors.html

Or you can use the TensorFlow / MXNet specific predictor classes, which have default serialization/deserialization logic: http://sagemaker.readthedocs.io/en/stable/sagemaker.tensorflow.html#tensorflow-predictor http://sagemaker.readthedocs.io/en/stable/sagemaker.mxnet.html#mxnet-predictor

Example code using the TensorFlow predictor:

from sagemaker.tensorflow import TensorFlowPredictor

predictor = TensorFlowPredictor('myexistingendpoint')
result = predictor.predict(['my request body'])

winstonaws avatar Jan 03 '18 01:01 winstonaws

Added answer to the FAQ on our README as well. Please reopen if you have further questions.

winstonaws avatar Jan 05 '18 21:01 winstonaws