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

喜夏-厌秋 提交于 2020-12-29 07:37:09

问题


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.

回答1:


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



来源:https://stackoverflow.com/questions/54916866/with-aws-sagemaker-is-it-possible-to-deploy-a-pre-trained-model-using-the-sagem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!