Skip to content

Commit aebcfb4

Browse files
author
Ignacio Quintero
committed
Add an example for local mode deployment of models
If there is an existing model it can be deployed locally using local mode. This feature is already present but there is no example in the README.
1 parent 704cd31 commit aebcfb4

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,23 @@ instance type.
192192
mxnet_estimator.delete_endpoint()
193193
194194
195+
If you have an existing model and would like to deploy it locally you can do that as well. Make sure
196+
you don't pass a real sagemaker_session to the Model constructor.
197+
198+
.. code:: python
199+
from sagemaker.mxnet import MXNetModel
200+
201+
s3_model = MXNetModel(model_data='s3://mybucket/my_model.tar.gz', role='SageMakerRole',
202+
entry_point=mxnet_model.entry_point, image=mxnet_model.image)
203+
204+
predictor = s3_model.deploy(initial_instance_count=1, instance_type='local')
205+
data = numpy.zeros(shape=(1, 1, 28, 28))
206+
predictor.predict(data)
207+
208+
# Tear down the endpoint container
209+
predictor.delete_endpoint()
210+
211+
195212
For detailed examples of running docker in local mode, see:
196213

197214
- `TensorFlow local mode example notebook <https://github.com/awslabs/amazon-sagemaker-examples/blob/master/sagemaker-python-sdk/tensorflow_distributed_mnist/tensorflow_local_mode_mnist.ipynb>`__.

0 commit comments

Comments
 (0)