[英]how to run a pre-trained model in AWS sagemaker?
I have a model.pkl file which is pre-trained and all other files related to the ml model.我有一个经过预训练的 model.pkl 文件以及与 ml model 相关的所有其他文件。 I want it to deploy it on the aws sagemaker.
我希望它将它部署在 aws sagemaker 上。 But without training, how to deploy it to the aws sagmekaer, as fit() method in aws sagemaker run the train command and push the model.tar.gz to the s3 location and when deploy method is used it uses the same s3 location to deploy the model, we don't manual create the same location in s3 as it is created by the aws model and name it given by using some timestamp.
但是没有培训,如何将其部署到 aws sagmekaer,因为 aws sagemaker 中的 fit() 方法运行 train 命令并将 model.tar.gz 推送到 s3 位置,当使用部署方法时,它使用相同的 s3 位置部署 model,我们不会在 s3 中手动创建与由 aws model 创建的位置相同的位置,并使用一些时间戳给它命名。 How to put out our own personalized model.tar.gz file in the s3 location and call the deploy() function by using the same s3 location.
如何将我们自己的个性化 model.tar.gz 文件放在 s3 位置,并使用相同的 s3 位置调用 deploy() function。
All you need is:所有你需要的是:
model.tar.gz
archivemodel.tar.gz
存档中的任意 S3 位置model.pkl
, serve it and handle inferences.model.pkl
,为其提供服务并处理推理。When you ask for an endpoint deployment, SageMaker will take care of downloading your model.tar.gz
and uncompressing to the appropriate location in the docker image of the server, which is /opt/ml/model
当您请求端点部署时,SageMaker 将负责下载您的
model.tar.gz
并解压缩到服务器的 docker 映像中的适当位置,即/opt/ml/model
Depending on the framework you use, you may use either a pre-existing docker image (available for Scikit-learn, TensorFlow, PyTorch, MXNet) or you may need to create your own. Depending on the framework you use, you may use either a pre-existing docker image (available for Scikit-learn, TensorFlow, PyTorch, MXNet) or you may need to create your own.
Regarding your following experience:关于您的以下经历:
when deploy method is used it uses the same s3 location to deploy the model, we don't manual create the same location in s3 as it is created by the aws model and name it given by using some timestamp
当使用部署方法时,它使用相同的 s3 位置来部署 model,我们不会在 s3 中手动创建与由 aws model 创建的位置相同的位置,并使用一些时间戳给它命名
I agree that sometimes the demos that use the SageMaker Python SDK (one of the many available SDKs for SageMaker) may be misleading, in the sense that they often leverage the fact that an Estimator
that has just been trained can be deployed ( Estimator.deploy(..)
) in the same session, without having to instantiate the intermediary model concept that maps inference code to model artifact.我同意有时使用SageMaker Python SDK (SageMaker 的众多可用 SDK 之一)的演示可能会产生误导,因为它们经常利用可以部署刚刚训练的
Estimator
的事实 ( Estimator.deploy(..)
) Estimator.deploy(..)
) 在同一个 session 中,无需实例化将推理代码映射到 model 工件的中间 model 概念。 This design is presumably done on behalf of code compacity, but in real life, training and deployment of a given model may well be done from different scripts running in different systems.这种设计大概是为了代码紧凑性而完成的,但在现实生活中,给定 model 的训练和部署很可能通过在不同系统中运行的不同脚本来完成。 It's perfectly possible to deploy a model with training it previously in the same session, you need to instantiate a
sagemaker.model.Model
object and then deploy it. It's perfectly possible to deploy a model with training it previously in the same session, you need to instantiate a
sagemaker.model.Model
object and then deploy it.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.