aws lambda使用_使用SAM在AWS Lambda上部署Sklearn机器学习

本文介绍了如何将Sklearn机器学习模型部署到AWS Lambda服务上,通过Serverless应用程序模型(SAM)进行操作。教程详细阐述了整个过程,旨在帮助数据科学家将模型无缝集成到AWS云环境中。
摘要由CSDN通过智能技术生成

aws lambda使用

Building machine learning models on a laptop is straightforward.

在笔记本电脑上构建机器学习模型非常简单。

Deploying models so they’re available in production is not.

部署模型以使其在生产中不可用。

Productionizing ML is hard. Not only does it combine SDE, ML and DevOps. But there’s no one-size fits all approach.

生产ML很难。 它不仅结合了SDE,ML和DevOps。 但是,没有一种千篇一律的方法。

A company’s setup depends on a combination of business requirements, financial constraints and technical skills.

公司的设置取决于业务需求,财务限制和技术技能的组合。

Today we’ll learn to deploy serverless ML on Lambda.

今天,我们将学习在Lambda上部署无服务器 ML。

While most ML is not a good fit for serverless, it can make sense on occasion. I’ll explain when it makes sense in a moment.

尽管大多数ML都不适合无服务器,但有时还是有道理的。 一会儿我会解释一下。

目录: (Table of contents:)

  1. Background information

    背景资料
  2. Train a model locally

    在本地训练模型
  3. Push the model to S3

    将模型推到S3
  4. Build a SAM application

    生成SAM应用程序
  5. Test the application locally

    在本地测试应用程序
  6. Deploy the application to AWS

    将应用程序部署到AWS
  7. Test the API

    测试API
  8. Conclusion

    结论

背景 (Background)

ML什么时候适合无服务器? (When is a ML a good fit for serverless?)

Your ML is a good fit for Lambda if…

如果……,您的ML非常适合Lambda。

  • Your model is small. Lambda reloads your model on each request so a large model is is going to result in slow response times.

    您的模型很小。 Lambda会在每个请求上重新加载模型,因此大型模型将导致响应时间变慢。

  • Data vectors are small. Lambda comes with a 3GB memory ceiling. So if your input data is massive, it’s just going to crash.

    数据向量很小。 Lambda带有3GB内存上限。 因此,如果您的输入数据非常庞大,它将崩溃。

  • You model will be sporadically accessed. Lambda scales out (not up) to infinite and charges you per request. So it’s well suited to intermittent “on-the-fly” demand.

    您的模型将被偶尔访问。 Lambda可以扩展(而不是扩展)到无限,并根据请求向您收费。 因此,它非常适合间歇性的“即时”需求。

  • Low-cost is important. Lambda charges $0.20 per million requests.

    低成本很重要。 Lambda每百万个请求收取$ 0.20。

Otherwise… consider deploying on EC2, or Sagemaker (if money is not a concern).

否则……考虑在EC2或Sagemaker上进行部署(如果不考虑金钱的话)。

什么是SAM? (What is SAM?)

SAM stands for “Serverless Application Model”. It’s an open-source framework for provisioning AWS services via code.

SAM代表“无服务器应用程序模型”。 这是一个开放源代码框架,用于通过代码配置AWS服务。

As a rule, always choose infrastructure-as-c

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值