Skip to content

Commit 1778849

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 1778849

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

README.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,24 @@ 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+
200+
from sagemaker.mxnet import MXNetModel
201+
202+
s3_model = MXNetModel(model_data='s3://mybucket/my_model.tar.gz', role='SageMakerRole',
203+
entry_point=mxnet_model.entry_point, image=mxnet_model.image)
204+
205+
predictor = s3_model.deploy(initial_instance_count=1, instance_type='local')
206+
data = numpy.zeros(shape=(1, 1, 28, 28))
207+
predictor.predict(data)
208+
209+
# Tear down the endpoint container
210+
predictor.delete_endpoint()
211+
212+
195213
For detailed examples of running docker in local mode, see:
196214

197215
- `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)