Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

With AWS SageMaker, is it possible to deploy a pre-trained model using the sagemaker SDK?

I'm trying to avoid migrating an existing model training process to SageMaker and avoid creating a custom Docker container to host our trained model.

My hope was to inject our existing, trained model into the pre-built scikit learn container that AWS provides via the sagemaker-python-sdk. All of the examples that I have found require training the model first which creates the model/model configuration in SageMaker. This is then deployed with the deploy method.

Is it possible to provide a trained model to the deploy method and have it hosted in the pre-built scikit learn container that AWS provides?

For reference, the examples I've seen follow this order of operations:

  1. Creating an instance of sagemaker.sklearn.estimator.SKLearn and providing a training script
  2. Call the fit method on it
  3. This creates the model/model configuration in SageMaker
  4. Call the deploy method on the SKLearn instance which automagically takes the model created in step 2/3 and deploys it in the pre-build scikit learn container as an HTTPS endpoint.
like image 374
Ryan Fisher Avatar asked Feb 28 '19 01:02

Ryan Fisher


1 Answers

Yes, you can import existing models to SageMaker.

For scikit-learn, you would use the SKLearnModel() object to load to model from S3 and create it in SageMaker. Then, you could deploy it as usual.

https://sagemaker.readthedocs.io/en/latest/sagemaker.sklearn.html

Here's a full example based on MXNet that will point you in the right direction: https://github.com/awslabs/amazon-sagemaker-examples/blob/master/sagemaker-python-sdk/mxnet_onnx_superresolution/mxnet_onnx.ipynb

like image 135
Julien Simon Avatar answered Sep 28 '22 02:09

Julien Simon