借助 AWS SageMaker,是否可以使用 sagemaker SDK 部署预训练模型? [英] With AWS SageMaker, is it possible to deploy a pre-trained model using the sagemaker SDK?

查看:78
本文介绍了借助 AWS SageMaker,是否可以使用 sagemaker SDK 部署预训练模型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图避免将现有模型训练过程迁移到 SageMaker,并避免创建自定义 Docker 容器来托管我们训练的模型.

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.

我希望将我们现有的、经过训练的模型注入到 AWS 通过 sagemaker-python-sdk.我发现的所有示例都需要先训练模型,然后在 SageMaker 中创建模型/模型配置.然后使用 deploy 方法进行部署.

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.

是否可以为 deploy 方法提供经过训练的模型,并将其托管在 AWS 提供的预构建 scikit learn 容器中?

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. 创建sagemaker.sklearn.estimator.SKLearn 实例并提供训练脚本
  2. 在其上调用fit方法
  3. 这会在 SageMaker 中创建模型/模型配置
  4. SKLearn 实例上调用 deploy 方法,该方法会自动获取在步骤 2/3 中创建的模型并将其作为 HTTPS 部署在预构建的 scikit learn 容器中端点.
  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.

推荐答案

是的,您可以将现有模型导入 SageMaker.

Yes, you can import existing models to SageMaker.

对于 scikit-learn,您将使用 SKLearnModel() 对象从 S3 加载到模型并在 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

这是一个基于 MXNet 的完整示例,它将为您指明正确的方向:https://github.com/awslabs/amazon-sagemaker-examples/blob/master/sagemaker-python-sdk/mxnet_onnx_superresolution/mxnet_onnx.ipynb

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

这篇关于借助 AWS SageMaker,是否可以使用 sagemaker SDK 部署预训练模型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆